Program: 21156
Project: 21156
Buggy source:
@Override public void handlePremium(DownloadLink downloadLink,Account account) throws Exception {
  try {
    if (downloadLink.getLinkType() == DownloadLink.LINKTYPE_CONTAINER) {
      if (Sniffy.hasSniffer())       throw new SnifferException();
    }
    String freeOrPremiumSelectPostURL=null;
    Request request=null;
    String error=null;
    long startTime=System.currentTimeMillis();
    Rapidshare.correctURL(downloadLink);
    br=login(account,true);
    br.setFollowRedirects(false);
    br.setAcceptLanguage(ACCEPT_LANGUAGE);
    br.getPage(downloadLink.getDownloadURL());
    String directurl=br.getRedirectLocation();
    if (directurl == null) {
      logger.finest("String_Node_Str");
      if (account.getStringProperty("String_Node_Str",null) == null)       throw new PluginException(LinkStatus.ERROR_PREMIUM,LinkStatus.VALUE_ID_PREMIUM_DISABLE);
      if ((error=findError(br.toString())) != null) {
        logger.warning(error);
        if (Regex.matches(error,Pattern.compile("String_Node_Str"))) {
          account.setProperty("String_Node_Str",null);
          throw new PluginException(LinkStatus.ERROR_RETRY);
        }
        if (Regex.matches(error,Pattern.compile("String_Node_Str"))) {
          throw new PluginException(LinkStatus.ERROR_FILE_NOT_FOUND);
        }
        if (Regex.matches(error,Pattern.compile("String_Node_Str"))) {
          throw new PluginException(LinkStatus.ERROR_FILE_NOT_FOUND);
        }
        if (Regex.matches(error,Pattern.compile("String_Node_Str"))) {
          throw new PluginException(LinkStatus.ERROR_TEMPORARILY_UNAVAILABLE,"String_Node_Str",120 * 1000l);
        }
        if (Regex.matches(error,Pattern.compile("String_Node_Str"))) {
          throw new PluginException(LinkStatus.ERROR_FILE_NOT_FOUND);
        }
        if (Regex.matches(error,Pattern.compile("String_Node_Str"))) {
          throw new PluginException(LinkStatus.ERROR_PREMIUM,JDLocale.L("String_Node_Str","String_Node_Str"),LinkStatus.VALUE_ID_PREMIUM_DISABLE);
        }
        if (Regex.matches(error,Pattern.compile("String_Node_Str"))) {
          throw new PluginException(LinkStatus.ERROR_PREMIUM,dynTranslate(error),LinkStatus.VALUE_ID_PREMIUM_DISABLE);
        }
 else         if (Regex.matches(error,Pattern.compile("String_Node_Str"))) {
          throw new PluginException(LinkStatus.ERROR_PREMIUM,JDLocale.L("String_Node_Str","String_Node_Str"),LinkStatus.VALUE_ID_PREMIUM_TEMP_DISABLE);
        }
 else         if (Regex.matches(error,Pattern.compile("String_Node_Str"))) {
          throw new PluginException(LinkStatus.ERROR_PREMIUM,dynTranslate(error),LinkStatus.VALUE_ID_PREMIUM_DISABLE);
        }
 else         if (Regex.matches(error,Pattern.compile("String_Node_Str"))) {
          throw new PluginException(LinkStatus.ERROR_PREMIUM,dynTranslate(error),LinkStatus.VALUE_ID_PREMIUM_TEMP_DISABLE);
        }
 else         if (Regex.matches(error,Pattern.compile("String_Node_Str"))) {
          throw new PluginException(LinkStatus.ERROR_TEMPORARILY_UNAVAILABLE,JDLocale.LF("String_Node_Str","String_Node_Str",error.substring(11,error.indexOf("String_Node_Str"))),3600 * 1000l);
        }
 else         if (Regex.matches(error,Pattern.compile("String_Node_Str"))) {
          account.setProperty("String_Node_Str",null);
          throw new PluginException(LinkStatus.ERROR_PREMIUM,JDLocale.L("String_Node_Str","String_Node_Str"),LinkStatus.VALUE_ID_PREMIUM_DISABLE);
        }
 else {
          account.setProperty("String_Node_Str",null);
          throw new PluginException(LinkStatus.ERROR_FATAL,dynTranslate(error));
        }
      }
      freeOrPremiumSelectPostURL=new Regex(br,PATTERN_FIND_MIRROR_URL).getMatch(0);
      if (freeOrPremiumSelectPostURL == null) {
        if ((error=findError(br + "String_Node_Str")) != null) {
          throw new PluginException(LinkStatus.ERROR_FATAL,dynTranslate(error));
        }
        reportUnknownError(br,1);
        logger.warning("String_Node_Str");
        throw new PluginException(LinkStatus.ERROR_RETRY);
      }
      Form[] forms=br.getForms();
      br.submitForm(forms[1]);
      String postTarget=getDownloadTarget(downloadLink,br.toString());
      if (postTarget == null)       throw new PluginException(LinkStatus.ERROR_PLUGIN_DEFEKT);
      request=br.createGetRequest(postTarget);
    }
 else {
      logger.finest("String_Node_Str");
      request=br.createGetRequest(directurl);
    }
    dl=new RAFDownload(this,downloadLink,request);
    dl.setResume(true);
    dl.setChunkNum(JDUtilities.getSubConfig("String_Node_Str").getIntegerProperty(Configuration.PARAM_DOWNLOAD_MAX_CHUNKS,2));
    URLConnectionAdapter urlConnection;
    try {
      urlConnection=dl.connect(br);
    }
 catch (    Exception e) {
      br.setRequest(request);
      request=br.createGetRequest(null);
      logger.info("String_Node_Str" + request.getUrl().toString().substring(0,35));
      dl=new RAFDownload(this,downloadLink,request);
      dl.setResume(true);
      dl.setChunkNum(JDUtilities.getSubConfig("String_Node_Str").getIntegerProperty(Configuration.PARAM_DOWNLOAD_MAX_CHUNKS,2));
      urlConnection=dl.connect(br);
    }
    if (!urlConnection.isContentDisposition() && urlConnection.getHeaderField("String_Node_Str") != null) {
      br.setRequest(request);
      br.followConnection();
      if ((error=findError(br.toString())) != null) {
        logger.warning(error);
        if (Regex.matches(error,Pattern.compile("String_Node_Str"))) {
          account.setProperty("String_Node_Str",null);
          throw new PluginException(LinkStatus.ERROR_RETRY);
        }
        if (Regex.matches(error,Pattern.compile("String_Node_Str"))) {
          throw new PluginException(LinkStatus.ERROR_FILE_NOT_FOUND);
        }
        if (Regex.matches(error,Pattern.compile("String_Node_Str"))) {
          throw new PluginException(LinkStatus.ERROR_FILE_NOT_FOUND);
        }
        if (Regex.matches(error,Pattern.compile("String_Node_Str"))) {
          throw new PluginException(LinkStatus.ERROR_TEMPORARILY_UNAVAILABLE,"String_Node_Str",120 * 1000l);
        }
        if (Regex.matches(error,Pattern.compile("String_Node_Str"))) {
          throw new PluginException(LinkStatus.ERROR_FILE_NOT_FOUND);
        }
        if (Regex.matches(error,Pattern.compile("String_Node_Str"))) {
          throw new PluginException(LinkStatus.ERROR_PREMIUM,JDLocale.L("String_Node_Str","String_Node_Str"),LinkStatus.VALUE_ID_PREMIUM_DISABLE);
        }
        if (Regex.matches(error,Pattern.compile("String_Node_Str"))) {
          throw new PluginException(LinkStatus.ERROR_PREMIUM,dynTranslate(error),LinkStatus.VALUE_ID_PREMIUM_DISABLE);
        }
 else         if (Regex.matches(error,Pattern.compile("String_Node_Str"))) {
          throw new PluginException(LinkStatus.ERROR_PREMIUM,JDLocale.L("String_Node_Str","String_Node_Str"),LinkStatus.VALUE_ID_PREMIUM_TEMP_DISABLE);
        }
 else         if (Regex.matches(error,Pattern.compile("String_Node_Str"))) {
          throw new PluginException(LinkStatus.ERROR_PREMIUM,dynTranslate(error),LinkStatus.VALUE_ID_PREMIUM_DISABLE);
        }
 else         if (Regex.matches(error,Pattern.compile("String_Node_Str"))) {
          throw new PluginException(LinkStatus.ERROR_PREMIUM,dynTranslate(error),LinkStatus.VALUE_ID_PREMIUM_TEMP_DISABLE);
        }
 else         if (Regex.matches(error,Pattern.compile("String_Node_Str"))) {
          throw new PluginException(LinkStatus.ERROR_TEMPORARILY_UNAVAILABLE,JDLocale.LF("String_Node_Str","String_Node_Str",error.substring(11,error.indexOf("String_Node_Str"))),3600 * 1000l);
        }
 else         if (Regex.matches(error,Pattern.compile("String_Node_Str"))) {
          account.setProperty("String_Node_Str",null);
          throw new PluginException(LinkStatus.ERROR_PREMIUM,JDLocale.L("String_Node_Str","String_Node_Str"),LinkStatus.VALUE_ID_PREMIUM_DISABLE);
        }
 else {
          account.setProperty("String_Node_Str",null);
          throw new PluginException(LinkStatus.ERROR_FATAL,dynTranslate(error));
        }
      }
 else {
        reportUnknownError(br.toString(),6);
        throw new PluginException(LinkStatus.ERROR_RETRY);
      }
    }
    downloadLink.setProperty("String_Node_Str",(System.currentTimeMillis() - startTime));
    dl.startDownload();
    downloadLink.setProperty("String_Node_Str",(System.currentTimeMillis() - startTime));
    int dif=(int)((System.currentTimeMillis() - startTime) / 1000);
    if (dif > 0)     downloadLink.setProperty("String_Node_Str",(downloadLink.getDownloadSize() / dif) / 1024);
    if (downloadLink.getStringProperty("String_Node_Str") != null) {
      new File(downloadLink.getFileOutput()).delete();
      downloadLink.getLinkStatus().setStatusText("String_Node_Str" + downloadLink.getStringProperty("String_Node_Str") + "String_Node_Str"+ downloadLink.getProperty("String_Node_Str")+ "String_Node_Str");
      ArrayList<DownloadLink> ret=new ArrayList<DownloadLink>();
      String msg="String_Node_Str";
      for (      DownloadLink dLink : downloadLink.getFilePackage().getDownloadLinks()) {
        if (dLink.getLinkStatus().hasStatus(LinkStatus.FINISHED)) {
          ret.add(dLink);
          msg+="String_Node_Str" + dLink.getStringProperty("String_Node_Str") + "String_Node_Str"+ dLink.getProperty("String_Node_Str")+ "String_Node_Str";
        }
 else         if (dLink.getLinkStatus().isFailed()) {
          ret.add(dLink);
          msg+="String_Node_Str" + dLink.getStringProperty("String_Node_Str") + "String_Node_Str";
        }
 else {
          return;
        }
      }
      final String passToThread=msg;
      new Thread(){
        public void run(){
          TextAreaDialog.showDialog(SimpleGUI.CURRENTGUI.getFrame(),"String_Node_Str","String_Node_Str",passToThread);
        }
      }
.start();
    }
  }
  finally {
    if (!downloadLink.getLinkStatus().hasStatus(LinkStatus.FINISHED)) {
      selectedServer=null;
    }
  }
}

Fixed version (ground truth):
@Override public void handlePremium(DownloadLink downloadLink,Account account) throws Exception {
  try {
    if (downloadLink.getLinkType() == DownloadLink.LINKTYPE_CONTAINER) {
      if (Sniffy.hasSniffer())       throw new SnifferException();
    }
    String freeOrPremiumSelectPostURL=null;
    Request request=null;
    String error=null;
    long startTime=System.currentTimeMillis();
    Rapidshare.correctURL(downloadLink);
    br=login(account,true);
    br.setFollowRedirects(false);
    br.setAcceptLanguage(ACCEPT_LANGUAGE);
    br.getPage(downloadLink.getDownloadURL());
    String directurl=br.getRedirectLocation();
    if (directurl == null) {
      logger.finest("String_Node_Str");
      if (account.getStringProperty("String_Node_Str",null) == null) {
        logger.info("String_Node_Str");
        throw new PluginException(LinkStatus.ERROR_PREMIUM,LinkStatus.VALUE_ID_PREMIUM_DISABLE);
      }
      if ((error=findError(br.toString())) != null) {
        logger.warning(error);
        if (Regex.matches(error,Pattern.compile("String_Node_Str"))) {
          account.setProperty("String_Node_Str",null);
          throw new PluginException(LinkStatus.ERROR_RETRY);
        }
        if (Regex.matches(error,Pattern.compile("String_Node_Str"))) {
          throw new PluginException(LinkStatus.ERROR_FILE_NOT_FOUND);
        }
        if (Regex.matches(error,Pattern.compile("String_Node_Str"))) {
          throw new PluginException(LinkStatus.ERROR_FILE_NOT_FOUND);
        }
        if (Regex.matches(error,Pattern.compile("String_Node_Str"))) {
          throw new PluginException(LinkStatus.ERROR_TEMPORARILY_UNAVAILABLE,"String_Node_Str",120 * 1000l);
        }
        if (Regex.matches(error,Pattern.compile("String_Node_Str"))) {
          throw new PluginException(LinkStatus.ERROR_FILE_NOT_FOUND);
        }
        if (Regex.matches(error,Pattern.compile("String_Node_Str"))) {
          logger.finest("String_Node_Str" + br);
          throw new PluginException(LinkStatus.ERROR_PREMIUM,JDLocale.L("String_Node_Str","String_Node_Str"),LinkStatus.VALUE_ID_PREMIUM_DISABLE);
        }
        if (Regex.matches(error,Pattern.compile("String_Node_Str"))) {
          logger.finest("String_Node_Str" + br);
          throw new PluginException(LinkStatus.ERROR_PREMIUM,dynTranslate(error),LinkStatus.VALUE_ID_PREMIUM_DISABLE);
        }
 else         if (Regex.matches(error,Pattern.compile("String_Node_Str"))) {
          logger.finest("String_Node_Str" + br);
          throw new PluginException(LinkStatus.ERROR_PREMIUM,JDLocale.L("String_Node_Str","String_Node_Str"),LinkStatus.VALUE_ID_PREMIUM_TEMP_DISABLE);
        }
 else         if (Regex.matches(error,Pattern.compile("String_Node_Str"))) {
          logger.finest("String_Node_Str" + br);
          throw new PluginException(LinkStatus.ERROR_PREMIUM,dynTranslate(error),LinkStatus.VALUE_ID_PREMIUM_DISABLE);
        }
 else         if (Regex.matches(error,Pattern.compile("String_Node_Str"))) {
          logger.finest("String_Node_Str" + br);
          throw new PluginException(LinkStatus.ERROR_PREMIUM,dynTranslate(error),LinkStatus.VALUE_ID_PREMIUM_TEMP_DISABLE);
        }
 else         if (Regex.matches(error,Pattern.compile("String_Node_Str"))) {
          throw new PluginException(LinkStatus.ERROR_TEMPORARILY_UNAVAILABLE,JDLocale.LF("String_Node_Str","String_Node_Str",error.substring(11,error.indexOf("String_Node_Str"))),3600 * 1000l);
        }
 else         if (Regex.matches(error,Pattern.compile("String_Node_Str"))) {
          account.setProperty("String_Node_Str",null);
          logger.finest("String_Node_Str" + br);
          throw new PluginException(LinkStatus.ERROR_PREMIUM,JDLocale.L("String_Node_Str","String_Node_Str"),LinkStatus.VALUE_ID_PREMIUM_DISABLE);
        }
 else {
          account.setProperty("String_Node_Str",null);
          throw new PluginException(LinkStatus.ERROR_FATAL,dynTranslate(error));
        }
      }
      freeOrPremiumSelectPostURL=new Regex(br,PATTERN_FIND_MIRROR_URL).getMatch(0);
      if (freeOrPremiumSelectPostURL == null) {
        if ((error=findError(br + "String_Node_Str")) != null) {
          throw new PluginException(LinkStatus.ERROR_FATAL,dynTranslate(error));
        }
        reportUnknownError(br,1);
        logger.warning("String_Node_Str");
        throw new PluginException(LinkStatus.ERROR_RETRY);
      }
      Form[] forms=br.getForms();
      br.submitForm(forms[1]);
      String postTarget=getDownloadTarget(downloadLink,br.toString());
      if (postTarget == null)       throw new PluginException(LinkStatus.ERROR_PLUGIN_DEFEKT);
      request=br.createGetRequest(postTarget);
    }
 else {
      logger.finest("String_Node_Str");
      request=br.createGetRequest(directurl);
    }
    dl=new RAFDownload(this,downloadLink,request);
    dl.setResume(true);
    dl.setChunkNum(JDUtilities.getSubConfig("String_Node_Str").getIntegerProperty(Configuration.PARAM_DOWNLOAD_MAX_CHUNKS,2));
    URLConnectionAdapter urlConnection;
    try {
      urlConnection=dl.connect(br);
    }
 catch (    Exception e) {
      br.setRequest(request);
      request=br.createGetRequest(null);
      logger.info("String_Node_Str" + request.getUrl().toString().substring(0,35));
      dl=new RAFDownload(this,downloadLink,request);
      dl.setResume(true);
      dl.setChunkNum(JDUtilities.getSubConfig("String_Node_Str").getIntegerProperty(Configuration.PARAM_DOWNLOAD_MAX_CHUNKS,2));
      urlConnection=dl.connect(br);
    }
    if (!urlConnection.isContentDisposition() && urlConnection.getHeaderField("String_Node_Str") != null) {
      br.setRequest(request);
      br.followConnection();
      if ((error=findError(br.toString())) != null) {
        logger.warning(error);
        if (Regex.matches(error,Pattern.compile("String_Node_Str"))) {
          account.setProperty("String_Node_Str",null);
          throw new PluginException(LinkStatus.ERROR_RETRY);
        }
        if (Regex.matches(error,Pattern.compile("String_Node_Str"))) {
          throw new PluginException(LinkStatus.ERROR_FILE_NOT_FOUND);
        }
        if (Regex.matches(error,Pattern.compile("String_Node_Str"))) {
          throw new PluginException(LinkStatus.ERROR_FILE_NOT_FOUND);
        }
        if (Regex.matches(error,Pattern.compile("String_Node_Str"))) {
          throw new PluginException(LinkStatus.ERROR_TEMPORARILY_UNAVAILABLE,"String_Node_Str",120 * 1000l);
        }
        if (Regex.matches(error,Pattern.compile("String_Node_Str"))) {
          throw new PluginException(LinkStatus.ERROR_FILE_NOT_FOUND);
        }
        if (Regex.matches(error,Pattern.compile("String_Node_Str"))) {
          throw new PluginException(LinkStatus.ERROR_PREMIUM,JDLocale.L("String_Node_Str","String_Node_Str"),LinkStatus.VALUE_ID_PREMIUM_DISABLE);
        }
        if (Regex.matches(error,Pattern.compile("String_Node_Str"))) {
          throw new PluginException(LinkStatus.ERROR_PREMIUM,dynTranslate(error),LinkStatus.VALUE_ID_PREMIUM_DISABLE);
        }
 else         if (Regex.matches(error,Pattern.compile("String_Node_Str"))) {
          throw new PluginException(LinkStatus.ERROR_PREMIUM,JDLocale.L("String_Node_Str","String_Node_Str"),LinkStatus.VALUE_ID_PREMIUM_TEMP_DISABLE);
        }
 else         if (Regex.matches(error,Pattern.compile("String_Node_Str"))) {
          throw new PluginException(LinkStatus.ERROR_PREMIUM,dynTranslate(error),LinkStatus.VALUE_ID_PREMIUM_DISABLE);
        }
 else         if (Regex.matches(error,Pattern.compile("String_Node_Str"))) {
          throw new PluginException(LinkStatus.ERROR_PREMIUM,dynTranslate(error),LinkStatus.VALUE_ID_PREMIUM_TEMP_DISABLE);
        }
 else         if (Regex.matches(error,Pattern.compile("String_Node_Str"))) {
          throw new PluginException(LinkStatus.ERROR_TEMPORARILY_UNAVAILABLE,JDLocale.LF("String_Node_Str","String_Node_Str",error.substring(11,error.indexOf("String_Node_Str"))),3600 * 1000l);
        }
 else         if (Regex.matches(error,Pattern.compile("String_Node_Str"))) {
          account.setProperty("String_Node_Str",null);
          throw new PluginException(LinkStatus.ERROR_PREMIUM,JDLocale.L("String_Node_Str","String_Node_Str"),LinkStatus.VALUE_ID_PREMIUM_DISABLE);
        }
 else {
          account.setProperty("String_Node_Str",null);
          throw new PluginException(LinkStatus.ERROR_FATAL,dynTranslate(error));
        }
      }
 else {
        reportUnknownError(br.toString(),6);
        throw new PluginException(LinkStatus.ERROR_RETRY);
      }
    }
    downloadLink.setProperty("String_Node_Str",(System.currentTimeMillis() - startTime));
    dl.startDownload();
    downloadLink.setProperty("String_Node_Str",(System.currentTimeMillis() - startTime));
    int dif=(int)((System.currentTimeMillis() - startTime) / 1000);
    if (dif > 0)     downloadLink.setProperty("String_Node_Str",(downloadLink.getDownloadSize() / dif) / 1024);
    if (downloadLink.getStringProperty("String_Node_Str") != null) {
      new File(downloadLink.getFileOutput()).delete();
      downloadLink.getLinkStatus().setStatusText("String_Node_Str" + downloadLink.getStringProperty("String_Node_Str") + "String_Node_Str"+ downloadLink.getProperty("String_Node_Str")+ "String_Node_Str");
      ArrayList<DownloadLink> ret=new ArrayList<DownloadLink>();
      String msg="String_Node_Str";
      for (      DownloadLink dLink : downloadLink.getFilePackage().getDownloadLinks()) {
        if (dLink.getLinkStatus().hasStatus(LinkStatus.FINISHED)) {
          ret.add(dLink);
          msg+="String_Node_Str" + dLink.getStringProperty("String_Node_Str") + "String_Node_Str"+ dLink.getProperty("String_Node_Str")+ "String_Node_Str";
        }
 else         if (dLink.getLinkStatus().isFailed()) {
          ret.add(dLink);
          msg+="String_Node_Str" + dLink.getStringProperty("String_Node_Str") + "String_Node_Str";
        }
 else {
          return;
        }
      }
      final String passToThread=msg;
      new Thread(){
        public void run(){
          TextAreaDialog.showDialog(SimpleGUI.CURRENTGUI.getFrame(),"String_Node_Str","String_Node_Str",passToThread);
        }
      }
.start();
    }
  }
  finally {
    if (!downloadLink.getLinkStatus().hasStatus(LinkStatus.FINISHED)) {
      selectedServer=null;
    }
  }
}