You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-dev@axis.apache.org by gd...@apache.org on 2002/01/31 19:33:29 UTC

cvs commit: xml-axis/java/src/org/apache/axis/encoding/ser ArraySerializer.java

gdaniels    02/01/31 10:33:29

  Modified:    java/src/org/apache/axis/encoding/ser ArraySerializer.java
  Log:
  Clean up code a little (this prevents a bug which apparently manifests with
  Xerces 1.4.0).
  
  Revision  Changes    Path
  1.3       +23 -20    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.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- ArraySerializer.java	31 Jan 2002 03:26:09 -0000	1.2
  +++ ArraySerializer.java	31 Jan 2002 18:33:29 -0000	1.3
  @@ -210,29 +210,32 @@
           }
           
           Attributes attrs = attributes;
  +
  +        if (attributes != null) {
  +            AttributesImpl attrImpl = null;
           
  -        if (attributes != null &&
  -            attributes.getIndex(Constants.URI_CURRENT_SOAP_ENC,
  -                                Constants.ATTR_ARRAY_TYPE) == -1) {
  -            String encprefix = context.getPrefixForURI(Constants.URI_CURRENT_SOAP_ENC);
  -            AttributesImpl attrImpl = new AttributesImpl(attributes);
  -            attrImpl.addAttribute(Constants.URI_CURRENT_SOAP_ENC, 
  -                                  Constants.ATTR_ARRAY_TYPE,
  -                                  encprefix + ":arrayType",
  -                                  "CDATA",
  -                                  arrayType);
  -            attrs = attrImpl;
  -        }
  +            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;
  +            }
   
  -        // Force type to be SOAP_ARRAY for all array serialization.
  -        int typeI = attributes.getIndex(Constants.URI_CURRENT_SCHEMA_XSI,
  -                                        "type");
  -        if (typeI != -1) {
  -            AttributesImpl attrImpl = new AttributesImpl(attrs);
  -            attrImpl.removeAttribute(typeI);
  -            attrs = context.setTypeAttribute(attrImpl, Constants.SOAP_ARRAY);
  +            // 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);
  +            }
           }
  -
           
           context.startElement(name, attrs);