I was asking this because in 1.2.7 there was an issue where Axiom swallowed exceptions and left the parser in an inconsistent state.
Andreas On Tue, Mar 3, 2009 at 11:09, Amila Suriarachchi <[email protected]> wrote: > > > On Tue, Mar 3, 2009 at 2:46 PM, Andreas Veithen <[email protected]> > wrote: >> >> Amila, >> >> Do you also get the same error with 1.2.8? > > yes, but I am thinking this is not a problem with axiom. > > thanks, > Amila. > - Show quoted text - >> >> Andreas >> >> On Tue, Mar 3, 2009 at 09:15, Amila Suriarachchi >> <[email protected]> wrote: >> > hi, >> > >> > I ran the following code using jdk 1.6 with wstx-asl-3.2.4.jar and >> > without >> > it. with axiom 1.2.7 jars. >> > >> > Thread class. >> > >> > public class TestFileCreater implements Runnable { >> > >> > public static final String INPUT_XML = "soapmessage/test.xml"; >> > >> > public void run() { >> > System.out.println("Starting thread with id " + >> > Thread.currentThread().getId()); >> > for (int i = 0; i < 1000; i++) { >> > try { >> > FileInputStream inputStream = new >> > FileInputStream(INPUT_XML); >> > XMLStreamReader xmlReader = >> > StAXUtils.createXMLStreamReader(inputStream); >> > OMElement omElement = new >> > StAXOMBuilder(xmlReader).getDocumentElement(); >> > >> > FileOutputStream outputStream = new >> > FileOutputStream("/home/amila/temp/output/test_" + i + "_" + >> > Thread.currentThread().getId() +".xml"); >> > XMLStreamWriter xmlStreamWriter = >> > StAXUtils.createXMLStreamWriter(outputStream); >> > omElement.serializeAndConsume(xmlStreamWriter); >> > >> > inputStream.close(); >> > outputStream.flush(); >> > outputStream.close(); >> > >> > } catch (FileNotFoundException e) { >> > e.printStackTrace(); >> > } catch (XMLStreamException e) { >> > e.printStackTrace(); >> > } catch (IOException e) { >> > e.printStackTrace(); >> > } >> > } >> > } >> > } >> > >> > main class >> > public static void main(String[] args) { >> > for (int i = 0; i < 100; i++) { >> > TestFileCreater testFileCreater = new TestFileCreater(); >> > Thread thread = new Thread(testFileCreater); >> > thread.start(); >> > } >> > } >> > >> > When I ran this with wstx-asl-3.2.4.jar all the iterations completed >> > without >> > any problem. but without the >> > wstx-asl-3.2.4.jar (i.e. with the jdk xmlstream parser) it gives the >> > following exception. >> > >> > javax.xml.stream.XMLStreamException: java.io.IOException: Bad file >> > descriptor >> > at >> > >> > com.sun.xml.internal.stream.writers.XMLStreamWriterImpl.writeStartElement(XMLStreamWriterImpl.java:1335) >> > at >> > >> > org.apache.axiom.om.impl.MTOMXMLStreamWriter.writeStartElement(MTOMXMLStreamWriter.java:111) >> > at >> > >> > org.apache.axiom.om.impl.serialize.StreamingOMSerializer.serializeElement(StreamingOMSerializer.java:194) >> > at >> > >> > org.apache.axiom.om.impl.serialize.StreamingOMSerializer.serializeNode(StreamingOMSerializer.java:104) >> > at >> > >> > org.apache.axiom.om.impl.serialize.StreamingOMSerializer.serialize(StreamingOMSerializer.java:68) >> > at >> > >> > org.apache.axiom.om.impl.serialize.StreamingOMSerializer.serialize(StreamingOMSerializer.java:57) >> > at >> > >> > org.apache.axiom.om.impl.util.OMSerializerUtil.serializeByPullStream(OMSerializerUtil.java:548) >> > at >> > >> > org.apache.axiom.om.impl.llom.OMElementImpl.internalSerialize(OMElementImpl.java:928) >> > at >> > >> > org.apache.axiom.om.impl.llom.OMElementImpl.internalSerializeAndConsume(OMElementImpl.java:947) >> > at >> > >> > org.apache.axiom.om.impl.llom.OMNodeImpl.serializeAndConsume(OMNodeImpl.java:388) >> > at test.com.xml.TestFileCreater.run(TestFileCreater.java:45) >> > at java.lang.Thread.run(Thread.java:619) >> > Caused by: java.io.IOException: Bad file descriptor >> > at java.io.FileOutputStream.write(Native Method) >> > at >> > >> > com.sun.xml.internal.stream.writers.UTF8OutputStreamWriter.write(UTF8OutputStreamWriter.java:94) >> > at >> > >> > com.sun.xml.internal.stream.writers.UTF8OutputStreamWriter.write(UTF8OutputStreamWriter.java:129) >> > at >> > >> > com.sun.xml.internal.stream.writers.XMLStreamWriterImpl.writeStartElement(XMLStreamWriterImpl.java:1328) >> > ... 11 more >> > >> > Am I doing some thing wrong with the test case or is this an known issue >> > with Jdk xmlstream parser? >> > >> > Any thoughts? >> > >> > thanks, >> > Amila. >> > >> > >> > >> > -- >> > Amila Suriarachchi >> > WSO2 Inc. >> > blog: http://amilachinthaka.blogspot.com/ >> > > > > > -- > - Show quoted text - > Amila Suriarachchi > WSO2 Inc. > blog: http://amilachinthaka.blogspot.com/ >
