The MessageBinding implementation throws a NULL Pointer exception if the root 
element of the XMLStreamReader i/o message does NOT contain a namespace.
------------------------------------------------------------------------------------------------------------------------------------------------------

                 Key: XFIRE-867
                 URL: http://jira.codehaus.org/browse/XFIRE-867
             Project: XFire
          Issue Type: Bug
          Components: Core
    Affects Versions: 1.2.3
            Reporter: Scott Seixas
         Assigned To: Dan Diephouse


I am developing a solution using XFire that uses MessageBinding to transport 
the entire XML input from the XFire client to my defined service as an 
XMLStreamReader object.  However, the OutMessageSender handler attempts to 
serialize the XMLStreamReader object type to the XMLStreamWriter object via the 
copy method in org.codehaus.xfire.util.STAXUtils.

During the STAXUtils copy, the writeStartElement method is invoked and if the 
root element of the XMLStreamReader object does not contain a namespace then a 
NULL Pointer exception is thrown because of the following two lines of code:

//STAXUtils.writeStatElement 
//line  168
String uri = reader.getNamespaceURI();
//line 175
String boundPrefix = writer.getPrefix( uri );

When copying the root start element of the XMLStreamReader object, if the 
namespace is empty or not defined then the uri string above is NULL, and 
writer.getPrefix( NULL ) throws a Null Pointer exception.

I resolved this problem locally by modifying line 175 to the following:

// My fix - line 175
String boundPrefix = writer.getPrefix( uri != null ? uri : "" );

This prevents the NULL value from being passed as the input of writer.getPrefix.

In general it seems reasonable to require that the root element of the 
XMLStreamReader object have a namespace, but in the case of MessageBinding the 
XFire framework should NOT fail because the XML input/output does not have a 
proper namespace.  In this case it should not concern itself with the structure 
of the XML i/o. 

Please fix so that I can implement MessageBinding with XML i/o that does not 
contain namespaces.

Regards,

Scott Seixas
Software Engineer
CA - Clarity Division, BSO (formerly Niku)
650.298.5923
[EMAIL PROTECTED]

-- 
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

        

---------------------------------------------------------------------
To unsubscribe from this list please visit:

    http://xircles.codehaus.org/manage_email

Reply via email to