java.lang.arrayindexoutofboundsexception:100

Source: Internet
Author: User

The following error message is encountered when parsing XML with SAXParser:

java.lang.arrayindexoutofboundsexception: 100        at  Com.sun.org.apache.xerces.internal.impl.XMLEntityScanner.scanLiteral (xmlentityscanner.java:1145)          at  Com.sun.org.apache.xerces.internal.impl.XMLScanner.scanAttributeValue (xmlscanner.java:996)          at  Com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.scanAttribute (Xmlnsdocumentscannerimpl.java : 438)         at  Com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.scanStartElement ( xmlnsdocumentscannerimpl.java:254)         at  Com.sun.org.apache.xerces.internal.impl.xmldocumentfragmentscannerimpl$fragmentcontentdriver.next ( xmldocumentfragmentscannerimpl.java:2778)         at  Com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImPl.next (xmldocumentscannerimpl.java:606)         at  Com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.next (xmlnsdocumentscannerimpl.java:117)          at  Com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument ( xmldocumentfragmentscannerimpl.java:510)         at  Com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse (xml11configuration.java:848)          at  Com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse (xml11configuration.java:777)          at com.sun.org.apache.xerces.internal.parsers.xmlparser.parse ( xmlparser.java:141)         at  Com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse (abstractsaxparser.java:1213)       &Nbsp;  at com.sun.org.apache.xerces.internal.jaxp.saxparserimpl$jaxpsaxparser.parse ( saxparserimpl.java:649)         at  Com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl.parse (saxparserimpl.java:333)          at javax.xml.parsers.saxparser.parse (saxparser.java:195)         &NBSP, ....

The reason is that there is a bug in the XML parsing in the JDK, there is a tag property with more than 100 newline in the error XML structure, which causes the error as above. I checked the Internet. Someone has already found this problem https://bugs.openjdk.java.net/browse/JDK-8080085

, the issue should have been fixed in the latest JDK8, pending validation.

Workaround: Preprocess The Unmarshal string, replacing multiple newline characters with an empty string

Str.replaceall ("[\n|\r\n]{100,}", "")

java.lang.arrayindexoutofboundsexception:100

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.