Writer attribute prefixes not checked for null
----------------------------------------------

                 Key: WSCOMMONS-501
                 URL: https://issues.apache.org/jira/browse/WSCOMMONS-501
             Project: WS-Commons
          Issue Type: Bug
          Components: AXIOM
    Affects Versions: Axiom 1.2.8
            Reporter: Jason Fager


In org.apache.axiom.om.impl.serialize.StreamingOMSerializer.serializeElement(), 
line 373 (1.2.8)/402 (trunk as of 9/16/2009), the attribute prefix taken from 
the reader is checked against the prefix for the same namespace in the writer, 
to see if it needs to be changed to the writer's prefix.  It should only be 
changed in the case where the writer has a different, non-empty prefix.  
However, the only "non-emptiness" checked for is the empty string - null is 
currently not considered empty.

Broken:
              
if (!prefix.equals(writerPrefix) && !"".equals(writerPrefix)) {  //WRONG, 
doesn't check for null
    prefix = writerPrefix;                
}


Fixed:
              
if (writerPrefix != null && !prefix.equals(writerPrefix) && 
!"".equals(writerPrefix)) {  //Right, check for null first.
    prefix = writerPrefix;                
}



-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to