[prev in list] [next in list] [prev in thread] [next in thread] 

List:       xmlbeans-dev
Subject:    [jira] Created: (XMLBEANS-78) NPE when processing XMLStreamReader Midstream
From:       "Dan Diephouse (JIRA)" <xmlbeans-dev () xml ! apache ! org>
Date:       2004-10-28 16:18:40
Message-ID: 1990245997.1098980320563.JavaMail.apache () nagoya
[Download RAW message or body]

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
    Priority: Blocker


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
-
If you want more information on JIRA, or have a bug to report see:
   http://www.atlassian.com/software/jira


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@xmlbeans.apache.org
For additional commands, e-mail: dev-help@xmlbeans.apache.org


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic