Program: 29742
Project: 29742
Buggy source:
/** 
 * Invoke a particular method on this MBean, and return any returned value. <p><strong>IMPLEMENTATION NOTE</strong> - This implementation will attempt to invoke this method on the MBean itself, or (if not available) on the managed resource object associated with this MBean.</p>
 * @param name Name of the operation to be invoked
 * @param params Array containing the method parameters of this operation
 * @param signature Array containing the class names representingthe signature of this operation
 * @exception MBeanException if the initializer of an objectthrows an exception
 * @exception ReflectioNException if a Java reflection exceptionoccurs when invoking a method
 */
public Object invoke(String name,Object params[],String signature[]) throws MBeanException, ReflectionException {
  if ((resource instanceof DynamicMBean) && !(resource instanceof BaseModelMBean)) {
    return ((DynamicMBean)resource).invoke(name,params,signature);
  }
  if (name == null)   throw new RuntimeOperationsException(new IllegalArgumentException("String_Node_Str"),"String_Node_Str");
  if (log.isLoggable(Level.FINE))   log.fine("String_Node_Str" + name);
  Method method=invokeAttMap.get(name);
  if (method == null) {
    if (params == null)     params=new Object[0];
    if (signature == null)     signature=new String[0];
    if (params.length != signature.length)     throw new RuntimeOperationsException(new IllegalArgumentException("String_Node_Str"),"String_Node_Str");
    ModelMBeanOperationInfo opInfo=info.getOperation(name);
    if (opInfo == null)     throw new MBeanException(new ServiceNotFoundException("String_Node_Str" + name),"String_Node_Str" + name);
    Class types[]=new Class[signature.length];
    for (int i=0; i < signature.length; i++) {
      types[i]=getAttributeClass(signature[i]);
    }
    Object object=null;
    Exception exception=null;
    try {
      object=this;
      method=object.getClass().getMethod(name,types);
    }
 catch (    NoSuchMethodException e) {
      exception=e;
      ;
    }
    try {
      if ((method == null) && (resource != null)) {
        object=resource;
        method=object.getClass().getMethod(name,types);
      }
    }
 catch (    NoSuchMethodException e) {
      exception=e;
    }
    if (method == null) {
      throw new ReflectionException(exception,"String_Node_Str" + name + "String_Node_Str");
    }
    invokeAttMap.put(name,method);
  }
  Object result=null;
  try {
    if (method.getDeclaringClass().isAssignableFrom(this.getClass())) {
      result=method.invoke(this,params);
    }
 else {
      result=method.invoke(resource,params);
    }
  }
 catch (  InvocationTargetException e) {
    Throwable t=e.getTargetException();
    log.log(Level.SEVERE,"String_Node_Str" + name,t);
    if (t == null)     t=e;
    if (t instanceof RuntimeException)     throw new RuntimeOperationsException((RuntimeException)t,"String_Node_Str" + name);
 else     if (t instanceof Error)     throw new RuntimeErrorException((Error)t,"String_Node_Str" + name);
 else     throw new MBeanException((Exception)t,"String_Node_Str" + name);
  }
catch (  Exception e) {
    log.log(Level.SEVERE,"String_Node_Str" + name,e);
    throw new MBeanException(e,"String_Node_Str" + name);
  }
  return (result);
}

Fixed version (ground truth):
/** 
 * Invoke a particular method on this MBean, and return any returned value. <p><strong>IMPLEMENTATION NOTE</strong> - This implementation will attempt to invoke this method on the MBean itself, or (if not available) on the managed resource object associated with this MBean.</p>
 * @param name Name of the operation to be invoked
 * @param params Array containing the method parameters of this operation
 * @param signature Array containing the class names representingthe signature of this operation
 * @exception MBeanException if the initializer of an objectthrows an exception
 * @exception ReflectioNException if a Java reflection exceptionoccurs when invoking a method
 */
public Object invoke(String name,Object params[],String signature[]) throws MBeanException, ReflectionException {
  if ((resource instanceof DynamicMBean) && !(resource instanceof BaseModelMBean)) {
    return ((DynamicMBean)resource).invoke(name,params,signature);
  }
  if (name == null)   throw new RuntimeOperationsException(new IllegalArgumentException("String_Node_Str"),"String_Node_Str");
  if (log.isLoggable(Level.FINE))   log.fine("String_Node_Str" + name);
  Method method=invokeAttMap.get(name);
  if (method == null) {
    if (params == null)     params=new Object[0];
    if (signature == null)     signature=new String[0];
    if (params.length != signature.length)     throw new RuntimeOperationsException(new IllegalArgumentException("String_Node_Str"),"String_Node_Str");
    ModelMBeanOperationInfo opInfo=info.getOperation(name);
    if (opInfo == null)     throw new MBeanException(new ServiceNotFoundException("String_Node_Str" + name),"String_Node_Str" + name);
    Class types[]=new Class[signature.length];
    for (int i=0; i < signature.length; i++) {
      types[i]=getAttributeClass(signature[i]);
    }
    Object object=null;
    Exception exception=null;
    try {
      object=this;
      method=object.getClass().getMethod(name,types);
    }
 catch (    NoSuchMethodException e) {
      exception=e;
      ;
    }
    try {
      if ((method == null) && (resource != null)) {
        object=resource;
        method=object.getClass().getMethod(name,types);
      }
    }
 catch (    NoSuchMethodException e) {
      exception=e;
    }
    if (method == null) {
      throw new ReflectionException(exception,"String_Node_Str" + name + "String_Node_Str");
    }
    invokeAttMap.put(name,method);
  }
  Object result=null;
  try {
    if (method.getDeclaringClass().isAssignableFrom(this.getClass())) {
      result=method.invoke(this,params);
    }
 else {
      result=method.invoke(resource,params);
    }
  }
 catch (  InvocationTargetException e) {
    Throwable t=e.getTargetException();
    log.log(Level.SEVERE,"String_Node_Str" + name,t);
    if (t == null)     t=e;
    if (t instanceof RuntimeException)     throw new RuntimeOperationsException((RuntimeException)t,"String_Node_Str" + name);
 else     if (t instanceof Error)     throw new RuntimeErrorException((Error)t,"String_Node_Str" + name);
 else     if (t instanceof Exception)     throw new MBeanException((Exception)t,"String_Node_Str" + name);
  }
catch (  Exception e) {
    log.log(Level.SEVERE,"String_Node_Str" + name,e);
    throw new MBeanException(e,"String_Node_Str" + name);
  }
  return (result);
}