[ http://issues.apache.org/jira/browse/XERCESJ-1182?page=all ]
Michael Glavassevich resolved XERCESJ-1182.
-------------------------------------------
Resolution: Fixed
There was a race condition which allowed the XMLStreamReader constructor to
return before the start document event is produced. I've fixed that as well as
significantly simplified the thread handling.
> Race condition results in invalid event type being reported from
> XMLStreamReader
> --------------------------------------------------------------------------------
>
> Key: XERCESJ-1182
> URL: http://issues.apache.org/jira/browse/XERCESJ-1182
> Project: Xerces2-J
> Issue Type: Bug
> Components: StAX
> Reporter: Lucian Holland
> Assigned To: Michael Glavassevich
> Attachments: test.xml
>
>
> The following code prints out "7" as it should do - the first event is a
> START_DOCUMENT event.
> SAXParserFactory factory = SAXParserFactory.newInstance();
> factory.setNamespaceAware(true);
> factory.setFeature("http://xml.org/sax/features/namespace-prefixes",
> true);
> SAXParser parser = factory.newSAXParser();
> SAXSource source = new SAXSource(parser.getXMLReader(), new
> InputSource(FunctionalTestEventReading.class.getResourceAsStream("test.xml")));
>
> XMLInputFactory inFac = new XMLInputFactoryImpl();
> XMLStreamReader reader = inFac.createXMLStreamReader(source);
> Thread.sleep(1000);
> System.err.println(reader.getEventType());
> If I remove the Thread.sleep, however, it prints "0". It would seem like
> something is being kicked off in another thread, and not having time to get
> the first bit of the document parsed before the call to getEventType(). FWIW
> I'm running this under Eclipse in a simple test class with a main method -
> presumably this is somewhat dependent on machine speed/environment etc. to be
> able to reproduce. I have attached the xml file I'm testing with.
--
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]