[ http://issues.apache.org/jira/browse/XMLBEANS-78?page=all ] Dan Diephouse resolved XMLBEANS-78: -----------------------------------
Fix Version: Version 2 Resolution: Fixed This issue is all resolved now in CVS (I can't remember, but either my patch was applied or the latest version of stax fixed it). > NPE when processing XMLStreamReader Midstream > --------------------------------------------- > > Key: XMLBEANS-78 > URL: http://issues.apache.org/jira/browse/XMLBEANS-78 > Project: XMLBeans > Type: Bug > Versions: Version 2 > Environment: Latest CVS, Windows XP, Java 1.5 > Reporter: Dan Diephouse > Assignee: Lawrence Jones > Priority: Blocker > Fix For: Version 2 > Attachments: XMLStreamReaderBug.java, amazon2.xml, depth.patch, > prefix.patch, prefixanddepth.patch > > I am attempting to read in a SOAP response into XmlBeans with an > XMLStreamReader. I've skipped to body in the XMLStreamReader. When doing a > XmlObject.Factory.parse( streamReader ) it throws this: > java.lang.IllegalArgumentException: prefix cannot be "null" when creating a > QName > at javax.xml.namespace.QName.<init>(Unknown Source) > at com.bea.xml.stream.MXParser.getName(MXParser.java:1432) > at > org.apache.xmlbeans.impl.newstore2.Locale.loadXMLStreamReader(Locale.java:979) > at > org.apache.xmlbeans.impl.newstore2.Locale.parseToXmlObject(Locale.java:703) > at > org.apache.xmlbeans.impl.newstore2.Locale.parseToXmlObject(Locale.java:693) > at > org.apache.xmlbeans.impl.schema.SchemaTypeLoaderBase.parse(SchemaTypeLoaderBase.java:217) > at org.apache.xmlbeans.XmlObject$Factory.parse(XmlObject.java:645) > at XMLStreamReaderBug.testBug(XMLStreamReaderBug.java:25) > at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) > at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) > at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) > at java.lang.reflect.Method.invoke(Unknown Source) > at junit.framework.TestCase.runTest(TestCase.java:154) > at junit.framework.TestCase.runBare(TestCase.java:127) > at junit.framework.TestResult$1.protect(TestResult.java:106) > at junit.framework.TestResult.runProtected(TestResult.java:124) > at junit.framework.TestResult.run(TestResult.java:109) > at junit.framework.TestCase.run(TestCase.java:118) > at junit.framework.TestSuite.runTest(TestSuite.java:208) > at junit.framework.TestSuite.run(TestSuite.java:203) > at > org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:421) > at > org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:305) > at > org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:186) > This is fixed easily enough, by checking if the prefix is null in the Locale > class and acting accordingly. Once this is done though, I get: > java.lang.NullPointerException > at > org.apache.xmlbeans.impl.newstore2.Cur$CurLoadContext.finish(Cur.java:3032) > at > org.apache.xmlbeans.impl.newstore2.Locale.loadXMLStreamReader(Locale.java:1069) > at > org.apache.xmlbeans.impl.newstore2.Locale.parseToXmlObject(Locale.java:703) > at > org.apache.xmlbeans.impl.newstore2.Locale.parseToXmlObject(Locale.java:693) > at > org.apache.xmlbeans.impl.schema.SchemaTypeLoaderBase.parse(SchemaTypeLoaderBase.java:217) > at org.apache.xmlbeans.XmlObject$Factory.parse(XmlObject.java:645) > at XMLStreamReaderBug.testBug(XMLStreamReaderBug.java:25) > at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) > at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) > at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) > at java.lang.reflect.Method.invoke(Unknown Source) > at junit.framework.TestCase.runTest(TestCase.java:154) > at junit.framework.TestCase.runBare(TestCase.java:127) > at junit.framework.TestResult$1.protect(TestResult.java:106) > at junit.framework.TestResult.runProtected(TestResult.java:124) > at junit.framework.TestResult.run(TestResult.java:109) > at junit.framework.TestCase.run(TestCase.java:118) > at junit.framework.TestSuite.runTest(TestSuite.java:208) > at junit.framework.TestSuite.run(TestSuite.java:203) > at > org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:421) > at > org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:305) > at > org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:186) > I'll attach a testcase showing this bug and my patch for Locale which checks > for a null prefix. The null prefix bug could also be problem with the StAX > RI - however I'ved tried it with both the RI and Woodstox. Both give me the > same issue with the prefix being null. -- This message is automatically generated by JIRA. - If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa - For more information on JIRA, see: http://www.atlassian.com/software/jira --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]