gdaniels    02/01/31 13:52:19

  Modified:    java/src/org/apache/axis/encoding/ser ArraySerializer.java
  Log:
  Clean up code a bit differently, to really solve Xerces 1.4.0 issue.
  
  Revision  Changes    Path
  1.4       +27 -24    
xml-axis/java/src/org/apache/axis/encoding/ser/ArraySerializer.java
  
  Index: ArraySerializer.java
  ===================================================================
  RCS file: 
/home/cvs/xml-axis/java/src/org/apache/axis/encoding/ser/ArraySerializer.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- ArraySerializer.java      31 Jan 2002 18:33:29 -0000      1.3
  +++ ArraySerializer.java      31 Jan 2002 21:52:19 -0000      1.4
  @@ -209,35 +209,38 @@
               }
           }
           
  -        Attributes attrs = attributes;
  -
  +        AttributesImpl attrs;
           if (attributes != null) {
  -            AttributesImpl attrImpl = null;
  -        
  -            if (attributes.getIndex(Constants.URI_CURRENT_SOAP_ENC,
  -                                    Constants.ATTR_ARRAY_TYPE) == -1) {
  -                String encprefix = 
context.getPrefixForURI(Constants.URI_CURRENT_SOAP_ENC);
  -                attrImpl = new AttributesImpl(attributes);
  -                attrImpl.addAttribute(Constants.URI_CURRENT_SOAP_ENC, 
  -                                      Constants.ATTR_ARRAY_TYPE,
  -                                      encprefix + ":arrayType",
  -                                      "CDATA",
  -                                      arrayType);
  -                attrs = attrImpl;
  +            if (attributes instanceof AttributesImpl) {
  +                attrs = (AttributesImpl)attributes;
  +            } else {
  +                attrs = new AttributesImpl(attributes);
               }
  +        } else {
  +            attrs = new AttributesImpl();
  +        }
   
  -            // Force type to be SOAP_ARRAY for all array serialization.
  -            int typeI = attributes.getIndex(Constants.URI_CURRENT_SCHEMA_XSI,
  -                                            "type");
  -            if (typeI != -1) {
  -                if (attrImpl == null)
  -                    attrImpl = new AttributesImpl(attributes);
  -                attrImpl.removeAttribute(typeI);
  -                attrs = context.setTypeAttribute(attrImpl, Constants.SOAP_ARRAY);
  -            }
  +        if (attrs.getIndex(Constants.URI_CURRENT_SOAP_ENC,
  +                           Constants.ATTR_ARRAY_TYPE) == -1) {
  +            String encprefix = 
context.getPrefixForURI(Constants.URI_CURRENT_SOAP_ENC);
  +            attrs.addAttribute(Constants.URI_CURRENT_SOAP_ENC, 
  +                                  Constants.ATTR_ARRAY_TYPE,
  +                                  encprefix + ":arrayType",
  +                                  "CDATA",
  +                                  arrayType);
  +        }
  +        
  +        // Force type to be SOAP_ARRAY for all array serialization.
  +        int typeI = attrs.getIndex(Constants.URI_CURRENT_SCHEMA_XSI,
  +                                   "type");
  +        if (typeI != -1) {
  +            attrs.removeAttribute(typeI);
  +            attributes = context.setTypeAttribute(attrs, Constants.SOAP_ARRAY);
  +        } else {
  +            attributes = attrs;
           }
           
  -        context.startElement(name, attrs);
  +        context.startElement(name, attributes);
   
           if (dim2Len < 0) {
               // Normal case, serialize each array element
  
  
  


Reply via email to