Program: 83077
Project: 83077
Buggy source:
/** 
 * Invoke a Java method from JavaScript. This is called solely from native code.
 * @param jscontext JSContext* passed as an integer
 * @param jsthis JavaScript reference to Java object
 * @param jsargs array of JavaScript values for parameters
 * @param returnValue JavaScript value to return result in
 * @throws RuntimeException if improper arguments are suppliedTODO(jat): lift most of this interface to platform-independent code (only exceptions still need to be made platform-independent)
 */
public void invoke(int jscontext,int jsthisInt,int[] jsargsInt,int returnValueInt){
  JsValue jsthis=new JsValueMoz(jsthisInt);
  JsValue jsargs[]=new JsValue[jsargsInt.length];
  for (int i=0; i < jsargsInt.length; ++i) {
    jsargs[i]=new JsValueMoz(jsargsInt[i]);
  }
  JsValue returnValue=new JsValueMoz(returnValueInt);
  Class[] paramTypes=method.getParameterTypes();
  int argc=paramTypes.length;
  Object args[]=new Object[argc];
  if (jsargs.length < argc) {
    throw new RuntimeException("String_Node_Str" + method);
  }
  Object jthis=null;
  if ((method.getModifiers() & Modifier.STATIC) == 0) {
    jthis=JsValueGlue.get(jsthis,method.getDeclaringClass(),"String_Node_Str");
  }
  for (int i=0; i < argc; ++i) {
    args[i]=JsValueGlue.get(jsargs[i],paramTypes[i],"String_Node_Str");
  }
  try {
    Object result;
    try {
      result=method.invoke(jthis,args);
    }
 catch (    IllegalAccessException e) {
      e.printStackTrace();
      throw new RuntimeException(e);
    }
    JsValueGlue.set(returnValue,classLoader,method.getReturnType(),result);
  }
 catch (  InvocationTargetException e) {
    Throwable t=e.getTargetException();
    ModuleSpaceMoz.setThrownJavaException(t);
    LowLevelMoz.raiseJavaScriptException(jscontext);
  }
catch (  IllegalArgumentException e) {
    System.err.println("String_Node_Str" + method.toString() + "String_Node_Str");
    for (int i=0; i < argc; ++i) {
      System.err.println("String_Node_Str" + i + "String_Node_Str"+ paramTypes[i].toString()+ "String_Node_Str"+ jsargs[i].getTypeString()+ "String_Node_Str"+ args[i].toString());
    }
    throw e;
  }
}

Fixed version (ground truth):
/** 
 * Invoke a Java method from JavaScript. This is called solely from native code.
 * @param jsthis JavaScript reference to Java object
 * @param jsargs array of JavaScript values for parameters
 * @param returnValue JavaScript value to return result in
 * @throws RuntimeException if improper arguments are suppliedTODO(jat): lift most of this interface to platform-independent code (only exceptions still need to be made platform-independent)
 */
public void invoke(int jsthisInt,int[] jsargsInt,int returnValueInt){
  JsValue jsthis=new JsValueMoz(jsthisInt);
  JsValue jsargs[]=new JsValue[jsargsInt.length];
  for (int i=0; i < jsargsInt.length; ++i) {
    jsargs[i]=new JsValueMoz(jsargsInt[i]);
  }
  JsValue returnValue=new JsValueMoz(returnValueInt);
  Class[] paramTypes=method.getParameterTypes();
  int argc=paramTypes.length;
  Object args[]=new Object[argc];
  if (jsargs.length < argc) {
    throw new RuntimeException("String_Node_Str" + method);
  }
  Object jthis=null;
  if ((method.getModifiers() & Modifier.STATIC) == 0) {
    jthis=JsValueGlue.get(jsthis,method.getDeclaringClass(),"String_Node_Str");
  }
  for (int i=0; i < argc; ++i) {
    args[i]=JsValueGlue.get(jsargs[i],paramTypes[i],"String_Node_Str");
  }
  try {
    Object result;
    try {
      result=method.invoke(jthis,args);
    }
 catch (    IllegalAccessException e) {
      e.printStackTrace();
      throw new RuntimeException(e);
    }
    JsValueGlue.set(returnValue,classLoader,method.getReturnType(),result);
  }
 catch (  InvocationTargetException e) {
    Throwable t=e.getTargetException();
    ModuleSpaceMoz.setThrownJavaException(t);
    LowLevelMoz.raiseJavaScriptException();
  }
catch (  IllegalArgumentException e) {
    System.err.println("String_Node_Str" + method.toString() + "String_Node_Str");
    for (int i=0; i < argc; ++i) {
      System.err.println("String_Node_Str" + i + "String_Node_Str"+ paramTypes[i].toString()+ "String_Node_Str"+ jsargs[i].getTypeString()+ "String_Node_Str"+ args[i].toString());
    }
    throw e;
  }
}