https://issues.apache.org/bugzilla/show_bug.cgi?id=38216

Chris O'Connor <tom...@croconnor.co.uk> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|RESOLVED                    |REOPENED
         Resolution|FIXED                       |

--- Comment #6 from Chris O'Connor <tom...@croconnor.co.uk> 2012-01-17 14:49:57 
UTC ---
Very useful feature and i'm just putting it onto our tomcat 6 boxes. However it
doesn't account for the invocation of the mbean returning null when outputting
the result. I propose that the invokeOperation becomes

    public void invokeOperation(PrintWriter writer, String onameStr, String op,
String[] valuesStr){
        try {
            ObjectName oname=new ObjectName( onameStr );
            MBeanOperationInfo methodInfo = registry.getMethodInfo(oname,op);
            MBeanParameterInfo[] signature = methodInfo.getSignature();
            String[] signatureTypes = new String[signature.length];
            Object[] values = new Object[signature.length];
            for (int i = 0; i < signature.length; i++) {
               MBeanParameterInfo pi = signature[i];
               signatureTypes[i] = pi.getType();
               values[i] = registry.convertValue(pi.getType(), valuesStr[i] );
           }

            Object retVal = mBeanServer.invoke(oname,op,values,signatureTypes);
            if(retVal != null){
                writer.println("OK - Operation " + op + " returned:");
                output("", writer, retVal);
            }else{
                writer.println("OK - Operation " + op + " without return
value");
            }
        } catch( Exception ex ) {
            writer.println("Error - " + ex.toString());
            ex.printStackTrace(writer);
        }
    }

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org

Reply via email to