Program: 46576
Project: 46576
Buggy source:
/** 
 * if (theClass is a Script) { run it like a script } else if (theClass has a main method) { run the main method } else if (theClass instanceof GroovyTestCase) { use the test runner to run it } else if (theClass implements Runnable) { if (theClass has a constructor with String[] params) instanciate theClass with this constructor and run else if (theClass has a no-args constructor) instanciate theClass with the no-args constructor and run }
 */
private Object runScriptOrMainOrTestOrRunnable(Class scriptClass,String[] args){
  if (scriptClass == null) {
    return null;
  }
  if (Script.class.isAssignableFrom(scriptClass)) {
    Script script=null;
    try {
      script=(Script)scriptClass.newInstance();
    }
 catch (    InstantiationException e) {
    }
catch (    IllegalAccessException e) {
    }
    if (script != null) {
      script.setBinding(context);
      script.setProperty("String_Node_Str",args);
      return script.run();
    }
  }
  try {
    scriptClass.getMethod("String_Node_Str",new Class[]{String[].class});
    return InvokerHelper.invokeMethod(scriptClass,"String_Node_Str",new Object[]{args});
  }
 catch (  NoSuchMethodException e) {
    if (Runnable.class.isAssignableFrom(scriptClass)) {
      return runRunnable(scriptClass,args);
    }
    if (isJUnit3Test(scriptClass)) {
      return runJUnit3Test(scriptClass);
    }
    if (isJUnit3TestSuite(scriptClass)) {
      return runJUnit3TestSuite(scriptClass);
    }
    if (isJUnit4Test(scriptClass)) {
      return runJUnit4Test(scriptClass);
    }
    if (isTestNgTest(scriptClass)) {
      return runTestNgTest(scriptClass);
    }
    throw new GroovyRuntimeException("String_Node_Str" + "String_Node_Str" + "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str");
  }
}

Fixed version (ground truth):
/** 
 * if (theClass is a Script) { run it like a script } else if (theClass has a main method) { run the main method } else if (theClass instanceof GroovyTestCase) { use the test runner to run it } else if (theClass implements Runnable) { if (theClass has a constructor with String[] params) instantiate theClass with this constructor and run else if (theClass has a no-args constructor) instantiate theClass with the no-args constructor and run }
 */
private Object runScriptOrMainOrTestOrRunnable(Class scriptClass,String[] args){
  if (scriptClass == null) {
    return null;
  }
  if (Script.class.isAssignableFrom(scriptClass)) {
    Script script=null;
    try {
      script=(Script)scriptClass.newInstance();
    }
 catch (    InstantiationException e) {
    }
catch (    IllegalAccessException e) {
    }
    if (script != null) {
      script.setBinding(context);
      script.setProperty("String_Node_Str",args);
      return script.run();
    }
  }
  try {
    scriptClass.getMethod("String_Node_Str",new Class[]{String[].class});
    return InvokerHelper.invokeMethod(scriptClass,"String_Node_Str",new Object[]{args});
  }
 catch (  NoSuchMethodException e) {
    if (Runnable.class.isAssignableFrom(scriptClass)) {
      return runRunnable(scriptClass,args);
    }
    if (isJUnit3Test(scriptClass)) {
      return runJUnit3Test(scriptClass);
    }
    if (isJUnit3TestSuite(scriptClass)) {
      return runJUnit3TestSuite(scriptClass);
    }
    if (isJUnit4Test(scriptClass)) {
      return runJUnit4Test(scriptClass);
    }
    if (isTestNgTest(scriptClass)) {
      return runTestNgTest(scriptClass);
    }
    throw new GroovyRuntimeException("String_Node_Str" + "String_Node_Str" + "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str");
  }
}