DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=17177>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=17177

Should never produce a null "holder" value (for IN/OUT args)





------- Additional Comments From [EMAIL PROTECTED]  2003-02-18 20:55 -------
Possible fix.  I've investigated this and have the following fix.

In RPCProvider.java, replace the following code...

       // 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();

                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
()));
                }
            }
        }



with the following code....


        // Now ensure all INOUT and OUT arguments are setup.
        for ( int i = 0; i < argValues.length; i++ ) {
            if ( argValues[i] == null ) {
                // We have a null argument.  If this an INOUT or OUT parameter,
                // setup a suitable holder for it.
                ParameterDesc param = operation.getParameter(i);
                if (param.getMode() == ParameterDesc.OUT ||
                    param.getMode() == ParameterDesc.INOUT) {
                    
                    Class holderClass = param.getJavaType();

                    if (holderClass != null &&
                        Holder.class.isAssignableFrom(holderClass)) {
                        argValues[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[i]);
                        p.setParamDesc(param);
                        outs.add(p);
                    } else {
                        // FIXME, should have separate messages for OUT and 
INOUT cases.
                        throw new AxisFault(Messages.getMessage
("badOutParameter00",
                 "" + param.getQName(),
                 operation.getName()));
                    }
                }
            }
        }


In addition to performing the work for OUT parameters, this correctly handles 
any INOUT parameters that were not set previously.  It also seems to be more 
correct in that it avoids the "numArgs + i" construct that, it seems, could 
index the wrong slot in argValues[].

Note: Please note the //FIXME comment that asks for a unique error message for 
the INOUT case.

Reply via email to