You are viewing a plain text version of this content. The canonical link for it is here.
Posted to axis-cvs@ws.apache.org by gd...@apache.org on 2004/09/22 14:27:34 UTC

cvs commit: ws-axis/java/src/org/apache/axis/message RPCElement.java

gdaniels    2004/09/22 05:27:34

  Modified:    java/src/org/apache/axis/message RPCElement.java
  Log:
  Fix bug:
  
  http://nagoya.apache.org/jira/browse/AXIS-1485
  
  When resolving wrapped services, treat a single value as OK to slot
  into an array if the component type of the array is compatible.
  
  Thanks to Nelson Minar for the patch.
  
  Revision  Changes    Path
  1.95      +19 -0     ws-axis/java/src/org/apache/axis/message/RPCElement.java
  
  Index: RPCElement.java
  ===================================================================
  RCS file: /home/cvs/ws-axis/java/src/org/apache/axis/message/RPCElement.java,v
  retrieving revision 1.94
  retrieving revision 1.95
  diff -u -r1.94 -r1.95
  --- RPCElement.java	8 Jul 2004 08:51:57 -0000	1.94
  +++ RPCElement.java	22 Sep 2004 12:27:33 -0000	1.95
  @@ -42,6 +42,7 @@
   import java.util.Vector;
   import java.util.Iterator;
   import java.util.List;
  +import java.util.Collection;
   
   public class RPCElement extends SOAPBodyElement
   {
  @@ -223,6 +224,24 @@
   
                                   // Get the type in the signature (java type or its holder)
                                   Class sigType = paramDesc.getJavaType();
  +
  +                                // if the type is an array but the value is not
  +                                // an array or Collection, put it into an
  +                                // ArrayList so that we correctly recognize it
  +                                // as convertible
  +                                if (sigType.isArray()) {
  +                                    if (value != null &&
  +                                            JavaUtils.isConvertable(value,
  +                                               sigType.getComponentType()) &&
  +                                          !(value.getClass().isArray()) &&
  +                                          !(value instanceof Collection)) {
  +                                        ArrayList list = new ArrayList();
  +                                        list.add(value);
  +                                        value = list;
  +                                        rpcParam.setObjectValue(value);
  +                                    }
  +                                }
  +
                                   if(!JavaUtils.isConvertable(value, sigType, isEncoded))
                                       match = false;
                               }