Once the marshallDocument method is invoked with sysout as the output 
stream, sysouts after that stops working.

        mctx.marshalDocument(objA, "UTF-8", null, System.out);
        System.out.println("objA marshall complete");
        mctx.marshalDocument(objB, "UTF-8", null, System.out);
        System.out.println("objB marshall complete");

Its because the jibx is doing the equivalent of System.out.close() 
somewhere in the code.

On a little analysis:
org.jibx.runtime.impl.MarshallingContext.endDocument() calls the 
m_writer.close(),
which invokes the UTF8StreamWriter.close() .

If the close method in StreamWriterBase is modified as follows then the 
stream are only closed if it is not the sysout stream.

 public void close() throws IOException {
        flush();
        if (m_stream != null && m_stream != System.out) {
            m_stream.close();
            m_stream = null;
        }
    }

I have not tested this fix, just enumerating on one of the possible 
solutions.

regards
Varghese

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
jibx-devs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jibx-devs

Reply via email to