Backports
Issue | Fix Version | Assignee | Priority | Status | Resolution | Resolved In Build |
---|---|---|---|---|---|---|
JDK-8163656 | 8u121 | Joe Wang | P3 | Resolved | Fixed | b01 |
JDK-8156150 | 8u112 | Joe Wang | P3 | Resolved | Fixed | b01 |
JDK-8167772 | emb-8u121 | Joe Wang | P3 | Resolved | Fixed | b01 |
Description
Under certain circumstances, the following exception might occur during XML scanning:
Exception in thread "main" java.util.MissingResourceException: EXPECTED_SQUARE_BRACKET_TO_CLOSE_INTERNAL_SUBSET
at com.sun.org.apache.xerces.internal.impl.msg.XMLMessageFormatter.formatMessage(java.xml@9-internal/XMLMessageFormatter.java:99)
at com.sun.xml.internal.stream.StaxErrorReporter.reportError(java.xml@9-internal/StaxErrorReporter.java:93)
at com.sun.org.apache.xerces.internal.impl.XMLScanner.reportFatalError(java.xml@9-internal/XMLScanner.java:1444)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl$DTDDriver.dispatch(java.xml@9-internal/XMLDocumentScannerImpl.java:1109)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl$DTDDriver.next(java.xml@9-internal/XMLDocumentScannerImpl.java:1044)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl$PrologDriver.next(java.xml@9-internal/XMLDocumentScannerImpl.java:932)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(java.xml@9-internal/XMLDocumentScannerImpl.java:601)
at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.next(java.xml@9-internal/XMLNSDocumentScannerImpl.java:111)
at com.sun.org.apache.xerces.internal.impl.XMLStreamReaderImpl.next(java.xml@9-internal/XMLStreamReaderImpl.java:553)
at com.sun.xml.internal.stream.XMLEventReaderImpl.nextEvent(java.xml@9-internal/XMLEventReaderImpl.java:83)
at com.sap.cl.xml.test.XMLEventReaderTest.main(XMLEventReaderTest.java:39)
Following is a small test to reproduce the behavior:
public static void main(String[] args) throws Exception {
StringBuilder xmlcontentbuilder = new StringBuilder(XMLEntityManager.DEFAULT_BUFFER_SIZE * 2);
xmlcontentbuilder.append("<?xml version=\"1.0\" encoding=\"ISO-8859-1\"?>\r\n");
xmlcontentbuilder.append("<!DOCTYPE dummy [\r\n");
xmlcontentbuilder.append(" <!ELEMENT dummy EMPTY>\r\n");
xmlcontentbuilder.append(" <!--\r\n");
xmlcontentbuilder.append(" ");
int textlen = XMLEntityManager.DEFAULT_BUFFER_SIZE - xmlcontentbuilder.length() - 2 - 1;
for (int i = 0; i < textlen; i++)
xmlcontentbuilder.append('a');
xmlcontentbuilder.append("\r\n");
xmlcontentbuilder.append(" -->\r\n");
xmlcontentbuilder.append(" ]\r\n");
xmlcontentbuilder.append(">\r\n");
xmlcontentbuilder.append("<dummy>\r\n");
xmlcontentbuilder.append("</dummy>\r\n");
XMLInputFactory factory = XMLInputFactory.newInstance();
factory.setProperty(XMLInputFactory.SUPPORT_DTD, false);
StringReader stringReader = new StringReader(xmlcontentbuilder.toString());
XMLEventReader reader = factory.createXMLEventReader(stringReader);
while (reader.hasNext()) {
XMLEvent event = reader.nextEvent();
System.out.println("Event Type: " + event.getEventType());
}
}
Exception in thread "main" java.util.MissingResourceException: EXPECTED_SQUARE_BRACKET_TO_CLOSE_INTERNAL_SUBSET
at com.sun.org.apache.xerces.internal.impl.msg.XMLMessageFormatter.formatMessage(java.xml@9-internal/XMLMessageFormatter.java:99)
at com.sun.xml.internal.stream.StaxErrorReporter.reportError(java.xml@9-internal/StaxErrorReporter.java:93)
at com.sun.org.apache.xerces.internal.impl.XMLScanner.reportFatalError(java.xml@9-internal/XMLScanner.java:1444)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl$DTDDriver.dispatch(java.xml@9-internal/XMLDocumentScannerImpl.java:1109)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl$DTDDriver.next(java.xml@9-internal/XMLDocumentScannerImpl.java:1044)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl$PrologDriver.next(java.xml@9-internal/XMLDocumentScannerImpl.java:932)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(java.xml@9-internal/XMLDocumentScannerImpl.java:601)
at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.next(java.xml@9-internal/XMLNSDocumentScannerImpl.java:111)
at com.sun.org.apache.xerces.internal.impl.XMLStreamReaderImpl.next(java.xml@9-internal/XMLStreamReaderImpl.java:553)
at com.sun.xml.internal.stream.XMLEventReaderImpl.nextEvent(java.xml@9-internal/XMLEventReaderImpl.java:83)
at com.sap.cl.xml.test.XMLEventReaderTest.main(XMLEventReaderTest.java:39)
Following is a small test to reproduce the behavior:
public static void main(String[] args) throws Exception {
StringBuilder xmlcontentbuilder = new StringBuilder(XMLEntityManager.DEFAULT_BUFFER_SIZE * 2);
xmlcontentbuilder.append("<?xml version=\"1.0\" encoding=\"ISO-8859-1\"?>\r\n");
xmlcontentbuilder.append("<!DOCTYPE dummy [\r\n");
xmlcontentbuilder.append(" <!ELEMENT dummy EMPTY>\r\n");
xmlcontentbuilder.append(" <!--\r\n");
xmlcontentbuilder.append(" ");
int textlen = XMLEntityManager.DEFAULT_BUFFER_SIZE - xmlcontentbuilder.length() - 2 - 1;
for (int i = 0; i < textlen; i++)
xmlcontentbuilder.append('a');
xmlcontentbuilder.append("\r\n");
xmlcontentbuilder.append(" -->\r\n");
xmlcontentbuilder.append(" ]\r\n");
xmlcontentbuilder.append(">\r\n");
xmlcontentbuilder.append("<dummy>\r\n");
xmlcontentbuilder.append("</dummy>\r\n");
XMLInputFactory factory = XMLInputFactory.newInstance();
factory.setProperty(XMLInputFactory.SUPPORT_DTD, false);
StringReader stringReader = new StringReader(xmlcontentbuilder.toString());
XMLEventReader reader = factory.createXMLEventReader(stringReader);
while (reader.hasNext()) {
XMLEvent event = reader.nextEvent();
System.out.println("Event Type: " + event.getEventType());
}
}
Attachments
Issue Links
- backported by
-
JDK-8156150 Issue in XMLScanner: EXPECTED_SQUARE_BRACKET_TO_CLOSE_INTERNAL_SUBSET when skipping large DOCTYPE section with CRLF at wrong place
- Resolved
-
JDK-8163656 Issue in XMLScanner: EXPECTED_SQUARE_BRACKET_TO_CLOSE_INTERNAL_SUBSET when skipping large DOCTYPE section with CRLF at wrong place
- Resolved
-
JDK-8167772 Issue in XMLScanner: EXPECTED_SQUARE_BRACKET_TO_CLOSE_INTERNAL_SUBSET when skipping large DOCTYPE section with CRLF at wrong place
- Resolved