Program: 21142
Project: 21142
Buggy source:
/** 
 * Diese Methode erstellt einen neuen Captchadialog und liefert den eingegebenen Text zurück.
 * @param controller Der Controller
 * @param plugin Das Plugin, das dieses Captcha fordert
 * @param host der Host von dem die Methode verwendet werden soll
 * @param file
 * @return Der vom Benutzer eingegebene Text
 * @throws InterruptedException
 */
public static String getCaptcha(Plugin plugin,String method,File file,boolean forceJAC) throws InterruptedException {
  String host;
  if (method == null) {
    host=plugin.getHost();
  }
 else {
    host=method.toLowerCase();
  }
  JDUtilities.getController().fireControlEvent(new ControlEvent(plugin,ControlEvent.CONTROL_CAPTCHA_LOADED,file));
  jd.controlling.JDLogger.getLogger().info("String_Node_Str" + host + "String_Node_Str"+ JAntiCaptcha.hasMethod(JDUtilities.getJACMethodsDirectory(),host));
  if (forceJAC || JAntiCaptcha.hasMethod(JDUtilities.getJACMethodsDirectory(),host) && JDUtilities.getConfiguration().getBooleanProperty(Configuration.PARAM_JAC_METHODS + "String_Node_Str" + host,true) && !configuration.getBooleanProperty(Configuration.PARAM_CAPTCHA_JAC_DISABLE,false)) {
    if (!JAntiCaptcha.hasMethod(JDUtilities.getJACMethodsDirectory(),host) || !JDUtilities.getConfiguration().getBooleanProperty(Configuration.PARAM_JAC_METHODS + "String_Node_Str" + host,true)) {
      return null;
    }
    JFrame jf=new JFrame();
    Image captchaImage;
    try {
      captchaImage=ImageIO.read(file);
      MediaTracker mediaTracker=new MediaTracker(jf);
      mediaTracker.addImage(captchaImage,0);
      try {
        mediaTracker.waitForID(0);
      }
 catch (      InterruptedException e) {
        return null;
      }
      mediaTracker.removeImage(captchaImage);
      JAntiCaptcha jac=new JAntiCaptcha(JDUtilities.getJACMethodsDirectory(),host);
      Captcha captcha=jac.createCaptcha(captchaImage);
      String captchaCode=jac.checkCaptcha(captcha);
      if (jac.isExtern()) {
        if (captchaCode == null || captchaCode.trim().length() == 0) {
          plugin.setCaptchaDetectID(Plugin.CAPTCHA_USER_INPUT);
          acquireUserIOSemaphore();
          captchaCode=JDUtilities.getController().getCaptchaCodeFromUser(plugin,file,captchaCode);
          releaseUserIOSemaphore();
        }
        return captchaCode;
      }
      jd.controlling.JDLogger.getLogger().info("String_Node_Str" + captchaCode);
      jd.controlling.JDLogger.getLogger().info("String_Node_Str" + captcha.getValityPercent());
      jd.controlling.JDLogger.getLogger().info("String_Node_Str" + captcha.isPerfectObjectDetection());
      plugin.setLastCaptcha(captcha);
      String code=null;
      plugin.setCaptchaDetectID(Plugin.CAPTCHA_JAC);
      LetterComperator[] lcs=captcha.getLetterComperators();
      double vp=0.0;
      if (lcs == null) {
        vp=100.0;
      }
 else {
        for (        LetterComperator element : lcs) {
          if (element == null) {
            vp=100.0;
            break;
          }
          vp=Math.max(vp,element.getValityPercent());
        }
      }
      jd.controlling.JDLogger.getLogger().info("String_Node_Str" + vp);
      if (plugin.useUserinputIfCaptchaUnknown() && vp > (double)JDUtilities.getSubConfig("String_Node_Str").getIntegerProperty(Configuration.AUTOTRAIN_ERROR_LEVEL,18)) {
        plugin.setCaptchaDetectID(Plugin.CAPTCHA_USER_INPUT);
        acquireUserIOSemaphore();
        code=JDUtilities.getController().getCaptchaCodeFromUser(plugin,file,captchaCode);
        releaseUserIOSemaphore();
      }
 else {
        return captchaCode;
      }
      if (code != null && code.equals(captchaCode)) {
        return captchaCode;
      }
      return code;
    }
 catch (    IOException e1) {
      JDLogger.exception(e1);
      return null;
    }
  }
 else {
    acquireUserIOSemaphore();
    plugin.setCaptchaDetectID(Plugin.CAPTCHA_USER_INPUT);
    String code=JDUtilities.getController().getCaptchaCodeFromUser(plugin,file,null);
    releaseUserIOSemaphore();
    return code;
  }
}

Fixed version (ground truth):
/** 
 * Diese Methode erstellt einen neuen Captchadialog und liefert den eingegebenen Text zurück.
 * @param controller Der Controller
 * @param plugin Das Plugin, das dieses Captcha fordert
 * @param host der Host von dem die Methode verwendet werden soll
 * @param file
 * @return Der vom Benutzer eingegebene Text
 * @throws InterruptedException
 */
public static String getCaptcha(Plugin plugin,String method,File file,boolean forceJAC) throws InterruptedException {
  String host;
  if (method == null) {
    host=plugin.getHost();
  }
 else {
    host=method.toLowerCase();
  }
  JDUtilities.getController().fireControlEvent(new ControlEvent(plugin,ControlEvent.CONTROL_CAPTCHA_LOADED,file));
  jd.controlling.JDLogger.getLogger().info("String_Node_Str" + host + "String_Node_Str"+ JAntiCaptcha.hasMethod(JDUtilities.getJACMethodsDirectory(),host));
  if (forceJAC || JAntiCaptcha.hasMethod(JDUtilities.getJACMethodsDirectory(),host) && JDUtilities.getConfiguration().getBooleanProperty(Configuration.PARAM_JAC_METHODS + "String_Node_Str" + host,true) && !configuration.getBooleanProperty(Configuration.PARAM_CAPTCHA_JAC_DISABLE,false)) {
    if (!JAntiCaptcha.hasMethod(JDUtilities.getJACMethodsDirectory(),host) || !JDUtilities.getConfiguration().getBooleanProperty(Configuration.PARAM_JAC_METHODS + "String_Node_Str" + host,true)) {
      return null;
    }
    JFrame jf=SimpleGUI.CURRENTGUI;
    Image captchaImage;
    try {
      captchaImage=ImageIO.read(file);
      MediaTracker mediaTracker=new MediaTracker(jf);
      mediaTracker.addImage(captchaImage,0);
      try {
        mediaTracker.waitForID(0);
      }
 catch (      InterruptedException e) {
        return null;
      }
      mediaTracker.removeImage(captchaImage);
      JAntiCaptcha jac=new JAntiCaptcha(JDUtilities.getJACMethodsDirectory(),host);
      Captcha captcha=jac.createCaptcha(captchaImage);
      String captchaCode=jac.checkCaptcha(captcha);
      if (jac.isExtern()) {
        if (captchaCode == null || captchaCode.trim().length() == 0) {
          plugin.setCaptchaDetectID(Plugin.CAPTCHA_USER_INPUT);
          acquireUserIOSemaphore();
          captchaCode=JDUtilities.getController().getCaptchaCodeFromUser(plugin,file,captchaCode);
          releaseUserIOSemaphore();
        }
        return captchaCode;
      }
      jd.controlling.JDLogger.getLogger().info("String_Node_Str" + captchaCode);
      jd.controlling.JDLogger.getLogger().info("String_Node_Str" + captcha.getValityPercent());
      jd.controlling.JDLogger.getLogger().info("String_Node_Str" + captcha.isPerfectObjectDetection());
      plugin.setLastCaptcha(captcha);
      String code=null;
      plugin.setCaptchaDetectID(Plugin.CAPTCHA_JAC);
      LetterComperator[] lcs=captcha.getLetterComperators();
      double vp=0.0;
      if (lcs == null) {
        vp=100.0;
      }
 else {
        for (        LetterComperator element : lcs) {
          if (element == null) {
            vp=100.0;
            break;
          }
          vp=Math.max(vp,element.getValityPercent());
        }
      }
      jd.controlling.JDLogger.getLogger().info("String_Node_Str" + vp);
      if (plugin.useUserinputIfCaptchaUnknown() && vp > (double)JDUtilities.getSubConfig("String_Node_Str").getIntegerProperty(Configuration.AUTOTRAIN_ERROR_LEVEL,18)) {
        plugin.setCaptchaDetectID(Plugin.CAPTCHA_USER_INPUT);
        acquireUserIOSemaphore();
        code=JDUtilities.getController().getCaptchaCodeFromUser(plugin,file,captchaCode);
        releaseUserIOSemaphore();
      }
 else {
        return captchaCode;
      }
      if (code != null && code.equals(captchaCode)) {
        return captchaCode;
      }
      return code;
    }
 catch (    IOException e1) {
      JDLogger.exception(e1);
      return null;
    }
  }
 else {
    acquireUserIOSemaphore();
    plugin.setCaptchaDetectID(Plugin.CAPTCHA_USER_INPUT);
    String code=JDUtilities.getController().getCaptchaCodeFromUser(plugin,file,null);
    releaseUserIOSemaphore();
    return code;
  }
}