[ 
https://issues.apache.org/jira/browse/AXIS2-2104?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12469977
 ] 

Volker Reichel commented on AXIS2-2104:
---------------------------------------

There's another problem which shows up when 'namespace' is null.

So the fix is:

       // Now write out the list of namespace declarations in this list that we 
constructed
     // while doing the "set" processing.
     if (writePrefixList != null) {
         for (int i=0; i<writePrefixList.size(); i++) {
         String prefix = (String) writePrefixList.get(i);
         String namespace = (String) writeNSList.get(i);
         if (! "".equals(prefix) && namespace != null) {
             writer.writeNamespace(prefix, namespace);
         } else {
             if (namespace != null) {
                    writer.writeDefaultNamespace(namespace);
             } else {
// namespace == null should not occur!!
             }
         }
      }
    }


 

> StreamingOMSerializer.serializeElement cannot handle empty namespace prefix 
> aka default namespace
> -------------------------------------------------------------------------------------------------
>
>                 Key: AXIS2-2104
>                 URL: https://issues.apache.org/jira/browse/AXIS2-2104
>             Project: Axis 2.0 (Axis2)
>          Issue Type: Bug
>          Components: om
>    Affects Versions: 1.1.1
>            Reporter: Volker Reichel
>
> When serializing XML a default namespace will throw a NPE in method 
> serializeElement().
>        // Now write out the list of namespace declarations in this list that 
> we constructed
>       // while doing the "set" processing.
>       if (writePrefixList != null) {
>               for (int i=0; i<writePrefixList.size(); i++) {
>                       String prefix = (String) writePrefixList.get(i);
>                       String namespace = (String) writeNSList.get(i); 
>  ========>  if (prefix != null) {   <<<<<<<<=======
>                       writer.writeNamespace(prefix, namespace);
>               } else {
>                       writer.writeDefaultNamespace(namespace);
>               }
>               }
>         }
> Fix is easy:  Replace marked section with:
> if ( ! "".equals(prefix)) {

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


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to