Java XMLStreamWriter isEntityExpansionLimitException(XMLStreamException e)

Here you can find the source of isEntityExpansionLimitException(XMLStreamException e)

Description

Tests whether the provided exception is an entity expansion exception.

License

Apache License

Parameter

Parameter Description
e the <code>XMLStreamException</code> to test

Return

true if entity expansion exception, false otherwise

Declaration

public static boolean isEntityExpansionLimitException(XMLStreamException e) 

Method Source Code

//package com.java2s;
/**// ww  w  .  j  a  v  a 2s  .c  om
 * Copyright Microsoft Corporation
 * 
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 * http://www.apache.org/licenses/LICENSE-2.0
 * 
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

import javax.xml.stream.XMLStreamException;

public class Main {
    private final static String ENTITY_EXPANSION_EXCEPTION_MESSAGE = "(.|\n)*Message: JAXP00010001: The parser has encountered more than \"\\d+\" entity expansions in this document; this is the limit imposed by the JDK\\.";

    /**
     * Tests whether the provided exception is an entity expansion exception.
     * 
     * Some versions of Java cause an exception to be incorrectly thrown when more XMLStreamReaders have been
     * created by a single factory than the entity expansion limit property (default 64000). The default form of this
     * exception is: "ParseError at [row,col]:[1,1]\n
     * Message: JAXP00010001: The parser has encountered more than
     * \"64000\" entity expansions in this document; this is the limit imposed by the JDK."
     * 
     * @param e
     *            the <code>XMLStreamException</code> to test
     * @return
     *         true if entity expansion exception, false otherwise
     */
    public static boolean isEntityExpansionLimitException(XMLStreamException e) {
        return e.getMessage() != null && e.getMessage().matches(ENTITY_EXPANSION_EXCEPTION_MESSAGE);
    }
}

Related

  1. CreateSimpleTagAndContent(XMLStreamWriter serializer, String tag, String content)
  2. CreateTable(XMLStreamWriter serializer)
  3. createXMLStreamWriter(StringWriter outWriter)
  4. exportCoordinateList(XMLStreamWriter writer, List coordinates, String separator)
  5. getXMLStreamWriter(final Writer writer)
  6. isPrefixDeclared(XMLStreamWriter writer, String nsUri, String prefix)
  7. renderPath(XMLStreamWriter writer, String pathData, String id, String style)
  8. serializeEndpart(XMLStreamWriter writer)
  9. setValueType(XMLStreamWriter xml, String dataType)