This is a proposed patch in relationship to defect AXIS-2586

In the class : org.apache.axis.encoding.ser.BeanDeserializer.
Problem: getDeserializer wasn't getting the right deserializer for array types when the xmlType is set.
Solution: apply the default XML Type when we are getting an array deserializer

I modified the following method (see method comments to know where changes were applied).

   protected Deserializer getDeserializer(QName xmlType,
                                          Class javaType,
                                          String href,
                                          DeserializationContext context) {
       if (javaType.isArray()) {
           context.setDestinationClass(javaType);
       }
       // See if we have a cached deserializer
       if (cacheStringDSer != null) {
           if (String.class.equals(javaType) &&
               href == null &&
               (cacheXMLType == null && xmlType == null ||
                cacheXMLType != null && cacheXMLType.equals(xmlType))) {
               cacheStringDSer.reset();
               return cacheStringDSer;
           }
       }
       
       Deserializer dSer = null;

       // MODIFICATION DONE HERE : Added the "&& ! javatype.isArray()" part in the line below
       if (xmlType != null && href == null && ! javatype.isArray() ) {
           // Use the xmlType to get the deserializer.
           dSer = context.getDeserializerForType(xmlType);
       } else {
           // If the xmlType is not set, get a default xmlType
           TypeMapping tm = context.getTypeMapping();
           QName defaultXMLType = tm.getTypeQName(javaType);
           // If there is not href, then get the deserializer
           // using the javaType and default XMLType,
           // If there is an href, the create the generic
           // DeserializerImpl and set its default type (the
           // default type is used if the href'd element does
           // not have an xsi:type.
           if (href == null) {
               dSer = context.getDeserializer(javaType, defaultXMLType);
           } else {
               dSer = new DeserializerImpl();
               context.setDestinationClass(javaType);
               dSer.setDefaultType(defaultXMLType);
           }
       }
       if (javaType.equals(String.class) &&
           dSer instanceof SimpleDeserializer) {
           cacheStringDSer = (SimpleDeserializer) dSer;
           cacheXMLType = xmlType;
       }
       return dSer;
   }


Note: The source problem seems to be that the client sends its arrays identified with types when special conditions are met.

Steve McDuff

Reply via email to