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 di...@apache.org on 2003/03/14 15:33:41 UTC

cvs commit: xml-axis/java/src/org/apache/axis/providers/java RPCProvider.java

dims        2003/03/14 06:33:41

  Modified:    java/src/org/apache/axis/providers/java RPCProvider.java
  Log:
  Fix for Bug 17177 - Should never produce a null "holder" value (for IN/OUT args)
  
  Notes:
  Tested with the "MS SOAP Toolkit 3.0" but could happen with other toolkits as well.
  
  Revision  Changes    Path
  1.105     +38 -20    xml-axis/java/src/org/apache/axis/providers/java/RPCProvider.java
  
  Index: RPCProvider.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/providers/java/RPCProvider.java,v
  retrieving revision 1.104
  retrieving revision 1.105
  diff -u -r1.104 -r1.105
  --- RPCProvider.java	2 Mar 2003 06:36:19 -0000	1.104
  +++ RPCProvider.java	14 Mar 2003 14:33:41 -0000	1.105
  @@ -261,27 +261,45 @@
           checkMethodName(msgContext, allowedMethods, operation.getName());
   
           // Now create any out holders we need to pass in
  -        if (numArgs < argValues.length) {
  -            ArrayList outParams = operation.getOutParams();
  -            for (int i = 0; i < outParams.size(); i++) {
  -                ParameterDesc param = (ParameterDesc) outParams.get(i);
  -                Class holderClass = param.getJavaType();
  +        int count = numArgs;
  +        for (int i = 0; i < argValues.length; i++) {
  +            
  +            // We are interested only in OUT/INOUT
  +            ParameterDesc param = operation.getParameter(i);
  +            if(param.getMode() == ParameterDesc.IN)
  +                continue;
   
  -                if (holderClass != null &&
  -                        Holder.class.isAssignableFrom(holderClass)) {
  -                    argValues[numArgs + i] = holderClass.newInstance();
  -                    // Store an RPCParam in the outs collection so we
  -                    // have an easy and consistent way to write these
  -                    // back to the client below
  -                    RPCParam p = new RPCParam(param.getQName(),
  -                            argValues[numArgs + i]);
  -                    p.setParamDesc(param);
  -                    outs.add(p);
  -                } else {
  -                    throw new AxisFault(Messages.getMessage("badOutParameter00",
  -                            "" + param.getQName(),
  -                            operation.getName()));
  -                }
  +            Class holderClass = param.getJavaType();
  +            if (holderClass != null &&
  +                    Holder.class.isAssignableFrom(holderClass)) {
  +                int index = count;
  +                if (param.getMode()==ParameterDesc.OUT) {
  +                    // OUT params don't have param order, just stick them at the end. 
  +                    count++;
  +                } else if (param.getMode()==ParameterDesc.INOUT) {
  +                    // Use the parameter order if specified or just stick them to the end.  
  +                    if(param.getOrder() != -1) {
  +                        index = param.getOrder();
  +                    } else {
  +                        count++;
  +                    }
  +                    // If it's already filled, don't muck with it
  +                    if(argValues[index] != null) {
  +                        continue;
  +                    }
  +                }                    
  +                argValues[index] = holderClass.newInstance();
  +                // Store an RPCParam in the outs collection so we
  +                // have an easy and consistent way to write these
  +                // back to the client below
  +                RPCParam p = new RPCParam(param.getQName(),
  +                        argValues[index]);
  +                p.setParamDesc(param);
  +                outs.add(p);
  +            } else {
  +                throw new AxisFault(Messages.getMessage("badOutParameter00",
  +                        "" + param.getQName(),
  +                        operation.getName()));
               }
           }