[jira] Created: (JIBX-344) XMLWriter does not fully reset namespace definition state after reset

View: New views
1 Messages — Rating Filter:   Alert me  

[jira] Created: (JIBX-344) XMLWriter does not fully reset namespace definition state after reset

by JIRA jira@codehaus.org :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

XMLWriter does not fully reset namespace definition state after reset
---------------------------------------------------------------------

                 Key: JIBX-344
                 URL: http://jira.codehaus.org/browse/JIBX-344
             Project: JiBX
          Issue Type: Bug
          Components: core
    Affects Versions: JiBX 1.2.1
            Reporter: Nigel Charman
            Assignee: Dennis Sosnoski
             Fix For: JiBX 1.2.2


XMLWriter can get into a state where outbound SOAP messages have no namespace defined, ie. the root element is <SOAP:Envelope>.

The bug only occurs for messages subsequent to a message that had an error.  It can be reproduced by changing the sayHello() method of  org.jibx.ws.example.hello.soap.client.HelloClient to:

    private Welcome sayHello(Greetee s) throws WsException, IOException {
        Client client = new SoapClient(m_location, m_fact);
        try {
            client.call(1);
        } catch (Exception e) {
            e.printStackTrace();
        }
        return (Welcome) client.call(s);
    }

In this example, client.call(1) causes a "Payload object must have a defined mapping" error.  The subsequent call of client.call(s) creates a message with no SOAP namespace definition.

The sequence of calls in JiBX/WS is SoapWriter.<init>() -> HttpChannel.getNormalWriter() -> TextCodecFactory$TextCodec.getWriter().  Commenting out the following code in TextCodecFactory$TextCodec.getWriter() resolves the issue:

//            if (m_writer != null && (charcode == null || charcode.equalsIgnoreCase(m_writer.getEncodingName()))) {
//              
//                // reuse the current writer
//                m_writer.setNamespaceUris(uris);
//              
//            } else

However, I guess we want to reuse the writer if we can.  I tried changing it to the following:

            if (m_writer != null && (charcode == null || charcode.equalsIgnoreCase(m_writer.getEncodingName()))) {
               
                m_writer.reset();
                // reuse the current writer
                m_writer.setNamespaceUris(uris);
               
            } else

but this didn't resolve the issue.  There must be some other state in IXMLWriter that needs resetting.  

--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

       

------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
jibx-devs mailing list
jibx-devs@...
https://lists.sourceforge.net/lists/listinfo/jibx-devs