Program: 8351
Project: 8351
Buggy source:
/** 
 * Identifies which version and name of browser to start if it specified in &#064;webtest <br> <b>sample</b><br> &#064;webtest(<b>browser="*firefox"</b>)<br>
 * @see org.testng.IInvokedMethodListener#beforeInvocation(org.testng.IInvokedMethod,org.testng.ITestResult)
 */
@Override public void beforeInvocation(IInvokedMethod method,ITestResult testResult){
  logger.entering(new Object[]{method,testResult});
  try {
    if (ListenerManager.isCurrentMethodSkipped(this)) {
      logger.exiting(ListenerManager.THREAD_EXCLUSION_MSG);
      return;
    }
    if (!method.isTestMethod() && !isSeLionAnnotatedTestClass(method)) {
      return;
    }
    if (isSeLionAnnotatedTestClass(method)) {
      if (!isValidBeforeCondition(method)) {
        return;
      }
      if (method.isTestMethod()) {
        if (isLowPriority(method)) {
          testSessionSharingRules(method);
        }
 else {
          return;
        }
      }
    }
    if (Grid.getTestSession() != null) {
      return;
    }
    AbstractTestSession testSession=TestSessionFactory.newInstance(method);
    Grid.getThreadLocalTestSession().set(testSession);
    InvokedMethodInformation methodInfo=TestNGUtils.getInvokedMethodInformation(method,testResult);
    testSession.initializeTestSession(methodInfo);
    if (!(testSession instanceof BasicTestSession)) {
      try {
        LocalGridManager.spawnLocalHub(testSession);
      }
 catch (      NoClassDefFoundError e) {
        logger.log(Level.SEVERE,"String_Node_Str" + "String_Node_Str",e);
        System.exit(1);
      }
    }
  }
 catch (  Exception e) {
    Grid.getThreadLocalException().set(e);
  }
  logger.exiting();
}

Fixed version (ground truth):
/** 
 * Identifies which version and name of browser to start if it specified in &#064;webtest <br> <b>sample</b><br> &#064;webtest(<b>browser="*firefox"</b>)<br>
 * @see org.testng.IInvokedMethodListener#beforeInvocation(org.testng.IInvokedMethod,org.testng.ITestResult)
 */
@Override public void beforeInvocation(IInvokedMethod method,ITestResult testResult){
  logger.entering(new Object[]{method,testResult});
  try {
    if (ListenerManager.isCurrentMethodSkipped(this)) {
      logger.exiting(ListenerManager.THREAD_EXCLUSION_MSG);
      return;
    }
    if (!method.isTestMethod() && !isSeLionAnnotatedTestClass(method)) {
      return;
    }
    if (isSeLionAnnotatedTestClass(method)) {
      if (!isValidBeforeCondition(method)) {
        return;
      }
      if (method.isTestMethod()) {
        if (isLowPriority(method)) {
          testSessionSharingRules(method);
        }
 else {
          return;
        }
      }
    }
    if (Grid.getTestSession() != null) {
      return;
    }
    AbstractTestSession testSession=TestSessionFactory.newInstance(method);
    Grid.getThreadLocalTestSession().set(testSession);
    InvokedMethodInformation methodInfo=TestNGUtils.getInvokedMethodInformation(method,testResult);
    testSession.initializeTestSession(methodInfo);
    if (!(testSession instanceof BasicTestSession)) {
      try {
        LocalGridManager.spawnLocalHub(testSession);
      }
 catch (      NoClassDefFoundError e) {
        logger.log(Level.SEVERE,"String_Node_Str" + "String_Node_Str",e);
        System.exit(1);
      }
    }
  }
 catch (  Exception e) {
    if (e instanceof RuntimeException) {
      throw e;
    }
    throw new RuntimeException(e.getMessage(),e);
  }
  logger.exiting();
}