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 2002/06/04 22:06:59 UTC

cvs commit: xml-axis/java/src/org/apache/axis/client Call.java

dims        2002/06/04 13:06:59

  Modified:    java/src/org/apache/axis/client Call.java
  Log:
  - Make sure that getParamList is called from only one spot.
  - Fix possible NullPointerException in getParamList
  - Fix getParamList such that if RPCParam already exists in the object array it is used as-is.
  
  Revision  Changes    Path
  1.127     +17 -10    xml-axis/java/src/org/apache/axis/client/Call.java
  
  Index: Call.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/client/Call.java,v
  retrieving revision 1.126
  retrieving revision 1.127
  diff -u -r1.126 -r1.127
  --- Call.java	31 May 2002 19:08:06 -0000	1.126
  +++ Call.java	4 Jun 2002 20:06:59 -0000	1.127
  @@ -1172,14 +1172,14 @@
               throw new AxisFault( JavaUtils.getMessage("noOperation00") );
           try {
               return this.invoke(operationName.getNamespaceURI(),
  -                    operationName.getLocalPart(), getParamList(params));
  +                    operationName.getLocalPart(), params);
           }
           catch( AxisFault af) {
               throw af;
           }
           catch( Exception exp ) {
               //if ( exp instanceof AxisFault ) throw (AxisFault) exp ;
  -
  +            exp.printStackTrace();
               throw new AxisFault( JavaUtils.getMessage("errorInvoking00", "\n" + exp) );
           }
       }
  @@ -1197,7 +1197,7 @@
        */
       public void invokeOneWay(Object[] params) {
           try {
  -            invoke( getParamList(params) );
  +            invoke( params );
           }
           catch( Exception exp ) {
               throw new JAXRPCException( exp.toString() );
  @@ -1333,7 +1333,6 @@
   
           // If we never set-up any names... then just return what was passed in
           //////////////////////////////////////////////////////////////////////
  -        log.debug( "getParamList number of params: " + params.length);
           log.debug( "operation=" + operation);
           if(operation != null) log.debug("operation.getNumParams()=" +operation.getNumParams());
           if ( operation.getNumParams() == 0 ) return( params );
  @@ -1343,11 +1342,13 @@
           /////////////////////////////////////////////////////////////////////
           numParams = operation.getNumInParams();
   
  -        if ( numParams != params.length )
  +        if ( params == null || numParams != params.length )
               throw new JAXRPCException(
                       JavaUtils.getMessage("parmMismatch00",
                       "" + params.length, "" + numParams) );
   
  +        log.debug( "getParamList number of params: " + params.length);
  +
           // All ok - so now produce an array of RPCParams
           //////////////////////////////////////////////////
           Vector result = new Vector();
  @@ -1360,14 +1361,20 @@
                   continue ;
   
               QName paramQName = param.getQName();
  -            RPCParam p = new RPCParam(paramQName.getNamespaceURI(),
  +            RPCParam rpcParam = null;
  +            Object p = params[j++];
  +            if(p instanceof RPCParam) {
  +                rpcParam = (RPCParam)p;
  +            } else {
  +                rpcParam = new RPCParam(paramQName.getNamespaceURI(),
                                         paramQName.getLocalPart(),
  -                                      params[j++] );
  +                                      p );
  +            }
               // Attach the ParameterDescription to the RPCParam
               // so that the serializer can use the (javaType, xmlType) 
               // information.
  -            p.setParamDesc(param);
  -            result.add( p );
  +            rpcParam.setParamDesc(param);
  +            result.add( rpcParam );
           }
   
           return( result.toArray() );
  @@ -1607,7 +1614,7 @@
               throw new AxisFault(JavaUtils.getMessage("mustSpecifyParms"));
           }
   
  -        RPCElement  body = new RPCElement(namespace, method, args);
  +        RPCElement  body = new RPCElement(namespace, method, getParamList(args));
   
           Object ret = invoke( body );
   
  
  
  

Re: cvs commit: xml-axis/java/src/org/apache/axis/client Call.java

Posted by Davanum Srinivas <di...@yahoo.com>.
Dug,

This should fix the problem that you had this morning.

Thanks,
dims

--- dims@apache.org wrote:
> dims        2002/06/04 13:06:59
> 
>   Modified:    java/src/org/apache/axis/client Call.java
>   Log:
>   - Make sure that getParamList is called from only one spot.
>   - Fix possible NullPointerException in getParamList
>   - Fix getParamList such that if RPCParam already exists in the object array it is used as-is.
>   
>   Revision  Changes    Path
>   1.127     +17 -10    xml-axis/java/src/org/apache/axis/client/Call.java
>   
>   Index: Call.java
>   ===================================================================
>   RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/client/Call.java,v
>   retrieving revision 1.126
>   retrieving revision 1.127
>   diff -u -r1.126 -r1.127
>   --- Call.java	31 May 2002 19:08:06 -0000	1.126
>   +++ Call.java	4 Jun 2002 20:06:59 -0000	1.127
>   @@ -1172,14 +1172,14 @@
>                throw new AxisFault( JavaUtils.getMessage("noOperation00") );
>            try {
>                return this.invoke(operationName.getNamespaceURI(),
>   -                    operationName.getLocalPart(), getParamList(params));
>   +                    operationName.getLocalPart(), params);
>            }
>            catch( AxisFault af) {
>                throw af;
>            }
>            catch( Exception exp ) {
>                //if ( exp instanceof AxisFault ) throw (AxisFault) exp ;
>   -
>   +            exp.printStackTrace();
>                throw new AxisFault( JavaUtils.getMessage("errorInvoking00", "\n" + exp) );
>            }
>        }
>   @@ -1197,7 +1197,7 @@
>         */
>        public void invokeOneWay(Object[] params) {
>            try {
>   -            invoke( getParamList(params) );
>   +            invoke( params );
>            }
>            catch( Exception exp ) {
>                throw new JAXRPCException( exp.toString() );
>   @@ -1333,7 +1333,6 @@
>    
>            // If we never set-up any names... then just return what was passed in
>            //////////////////////////////////////////////////////////////////////
>   -        log.debug( "getParamList number of params: " + params.length);
>            log.debug( "operation=" + operation);
>            if(operation != null) log.debug("operation.getNumParams()="
> +operation.getNumParams());
>            if ( operation.getNumParams() == 0 ) return( params );
>   @@ -1343,11 +1342,13 @@
>            /////////////////////////////////////////////////////////////////////
>            numParams = operation.getNumInParams();
>    
>   -        if ( numParams != params.length )
>   +        if ( params == null || numParams != params.length )
>                throw new JAXRPCException(
>                        JavaUtils.getMessage("parmMismatch00",
>                        "" + params.length, "" + numParams) );
>    
>   +        log.debug( "getParamList number of params: " + params.length);
>   +
>            // All ok - so now produce an array of RPCParams
>            //////////////////////////////////////////////////
>            Vector result = new Vector();
>   @@ -1360,14 +1361,20 @@
>                    continue ;
>    
>                QName paramQName = param.getQName();
>   -            RPCParam p = new RPCParam(paramQName.getNamespaceURI(),
>   +            RPCParam rpcParam = null;
>   +            Object p = params[j++];
>   +            if(p instanceof RPCParam) {
>   +                rpcParam = (RPCParam)p;
>   +            } else {
>   +                rpcParam = new RPCParam(paramQName.getNamespaceURI(),
>                                          paramQName.getLocalPart(),
>   -                                      params[j++] );
>   +                                      p );
>   +            }
>                // Attach the ParameterDescription to the RPCParam
>                // so that the serializer can use the (javaType, xmlType) 
>                // information.
>   -            p.setParamDesc(param);
>   -            result.add( p );
>   +            rpcParam.setParamDesc(param);
>   +            result.add( rpcParam );
>            }
>    
>            return( result.toArray() );
>   @@ -1607,7 +1614,7 @@
>                throw new AxisFault(JavaUtils.getMessage("mustSpecifyParms"));
>            }
>    
>   -        RPCElement  body = new RPCElement(namespace, method, args);
>   +        RPCElement  body = new RPCElement(namespace, method, getParamList(args));
>    
>            Object ret = invoke( body );
>    
>   
>   
>   


=====
Davanum Srinivas - http://xml.apache.org/~dims/

__________________________________________________
Do You Yahoo!?
Yahoo! - Official partner of 2002 FIFA World Cup
http://fifaworldcup.yahoo.com