Here you can find the source of isEntityExpansionLimitException(XMLStreamException e)
Parameter | Description |
---|---|
e | the <code>XMLStreamException</code> to test |
public static boolean isEntityExpansionLimitException(XMLStreamException e)
//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); } }