Program: 21401
Project: 21401
Buggy source:
@Override public PluginStep doStep(PluginStep step,DownloadLink parameter){
  DownloadLink downloadLink=null;
  try {
    logger.info("String_Node_Str" + step);
    downloadLink=(DownloadLink)parameter;
switch (step.getStep()) {
case PluginStep.STEP_WAIT_TIME:
      requestInfo=getRequest(new URL(downloadLink.getUrlDownloadDecrypted()),null,null,true);
    String script=getBetween(requestInfo.getHtmlCode(),"String_Node_Str","String_Node_Str");
  if (requestInfo.getHtmlCode().indexOf("String_Node_Str") >= 0) {
    step.setStatus(PluginStep.STATUS_ERROR);
    downloadLink.setStatus(DownloadLink.STATUS_ERROR_FILE_ABUSED);
    return step;
  }
if (requestInfo.containsHTML("String_Node_Str")) {
  step.setStatus(PluginStep.STATUS_ERROR);
  downloadLink.setStatus(DownloadLink.STATUS_ERROR_TEMPORARILY_UNAVAILABLE);
  return step;
}
Vector<Vector<String>> matches=getAllSimpleMatches(script,"String_Node_Str");
String url=null;
for (int i=0; i < matches.size(); i++) {
if (url == null) url="String_Node_Str" + host;
url+=matches.elementAt(i).elementAt(0);
}
String newURL=url;
logger.info(url);
if (newURL != null) {
newURL=newURL.replaceAll("String_Node_Str","String_Node_Str");
requestInfo=getRequest((new URL(newURL)),null,downloadLink.getName(),true);
actionString="String_Node_Str" + getFirstMatch(requestInfo.getHtmlCode(),frameForCaptcha,1);
actionString=actionString.replaceAll("String_Node_Str","String_Node_Str");
requestInfo=getRequest((new URL(actionString)),"String_Node_Str",newURL,true);
captchaAddress="String_Node_Str" + getFirstMatch(requestInfo.getHtmlCode(),patternForCaptcha,1);
captchaAddress=captchaAddress.replaceAll("String_Node_Str","String_Node_Str");
postTarget=getFormInputHidden(requestInfo.getHtmlCode());
}
logger.info(captchaAddress + "String_Node_Str" + postTarget);
if (captchaAddress == null || postTarget == null) {
}
step.setStatus(PluginStep.STATUS_DONE);
return step;
case PluginStep.STEP_GET_CAPTCHA_FILE:
File file=this.getLocalCaptchaFile(this);
if (!JDUtilities.download(file,captchaAddress) || !file.exists()) {
logger.severe("String_Node_Str" + captchaAddress);
step.setParameter(null);
step.setStatus(PluginStep.STATUS_ERROR);
downloadLink.setStatus(DownloadLink.STATUS_ERROR_CAPTCHA_IMAGEERROR);
return step;
}
 else {
step.setParameter(file);
step.setStatus(PluginStep.STATUS_USER_INPUT);
}
break;
case PluginStep.STEP_DOWNLOAD:
try {
requestInfo=postRequest((new URL(actionString)),requestInfo.getCookie(),actionString,null,postTarget + "String_Node_Str" + (String)steps.get(1).getParameter(),true);
postTarget=getFirstMatch(requestInfo.getHtmlCode(),patternForDownloadlink,1);
postTarget=postTarget.replaceAll("String_Node_Str","String_Node_Str");
}
 catch (Exception e) {
downloadLink.setStatus(DownloadLink.STATUS_ERROR_UNKNOWN);
step.setStatus(PluginStep.STATUS_ERROR);
e.printStackTrace();
}
try {
URLConnection urlConnection=new URL(postTarget).openConnection();
int length=urlConnection.getContentLength();
downloadLink.setDownloadMax(length);
downloadLink.setName(this.getFileNameFormHeader(urlConnection));
if (!hasEnoughHDSpace(downloadLink)) {
downloadLink.setStatus(DownloadLink.STATUS_ERROR_NO_FREE_SPACE);
step.setStatus(PluginStep.STATUS_ERROR);
return step;
}
if (download(downloadLink,urlConnection)) {
step.setStatus(PluginStep.STATUS_DONE);
downloadLink.setStatus(DownloadLink.STATUS_DONE);
return null;
}
 else {
logger.severe("String_Node_Str");
downloadLink.setStatus(DownloadLink.STATUS_ERROR_CAPTCHA_WRONG);
step.setStatus(PluginStep.STATUS_ERROR);
}
}
 catch (IOException e) {
logger.severe("String_Node_Str" + e.toString());
downloadLink.setStatus(DownloadLink.STATUS_ERROR_UNKNOWN);
step.setStatus(PluginStep.STATUS_ERROR);
return step;
}
break;
}
}
 catch (Exception e) {
downloadLink.setStatus(DownloadLink.STATUS_ERROR_UNKNOWN);
step.setStatus(PluginStep.STATUS_ERROR);
e.printStackTrace();
return step;
}
return step;
}

Fixed version (ground truth):
@Override public PluginStep doStep(PluginStep step,DownloadLink parameter){
  DownloadLink downloadLink=null;
  try {
    logger.info("String_Node_Str" + step);
    downloadLink=(DownloadLink)parameter;
switch (step.getStep()) {
case PluginStep.STEP_WAIT_TIME:
      requestInfo=getRequest(new URL(downloadLink.getUrlDownloadDecrypted()),null,null,true);
    if (requestInfo.getHtmlCode().indexOf("String_Node_Str") >= 0) {
      step.setStatus(PluginStep.STATUS_ERROR);
      downloadLink.setStatus(DownloadLink.STATUS_ERROR_FILE_ABUSED);
      return step;
    }
  if (requestInfo.containsHTML("String_Node_Str")) {
    step.setStatus(PluginStep.STATUS_ERROR);
    downloadLink.setStatus(DownloadLink.STATUS_ERROR_TEMPORARILY_UNAVAILABLE);
    return step;
  }
String newURL="String_Node_Str" + requestInfo.getConnection().getURL().getHost() + getFirstMatch(requestInfo.getHtmlCode(),baseLink,1);
System.out.println(newURL);
logger.info(newURL);
if (newURL != null) {
newURL=newURL.replaceAll("String_Node_Str","String_Node_Str");
requestInfo=getRequest((new URL(newURL)),null,downloadLink.getName(),true);
actionString="String_Node_Str" + getFirstMatch(requestInfo.getHtmlCode(),frameForCaptcha,1);
actionString=actionString.replaceAll("String_Node_Str","String_Node_Str");
System.out.println(actionString);
requestInfo=getRequest((new URL(actionString)),"String_Node_Str",newURL,true);
captchaAddress="String_Node_Str" + getFirstMatch(requestInfo.getHtmlCode(),patternForCaptcha,1);
captchaAddress=captchaAddress.replaceAll("String_Node_Str","String_Node_Str");
System.out.println(captchaAddress);
postTarget=getFormInputHidden(requestInfo.getHtmlCode());
}
logger.info(captchaAddress + "String_Node_Str" + postTarget);
if (captchaAddress == null || postTarget == null) {
}
step.setStatus(PluginStep.STATUS_DONE);
return step;
case PluginStep.STEP_GET_CAPTCHA_FILE:
File file=this.getLocalCaptchaFile(this);
if (!JDUtilities.download(file,captchaAddress) || !file.exists()) {
logger.severe("String_Node_Str" + captchaAddress);
step.setParameter(null);
step.setStatus(PluginStep.STATUS_ERROR);
downloadLink.setStatus(DownloadLink.STATUS_ERROR_CAPTCHA_IMAGEERROR);
return step;
}
 else {
step.setParameter(file);
step.setStatus(PluginStep.STATUS_USER_INPUT);
}
break;
case PluginStep.STEP_DOWNLOAD:
try {
requestInfo=postRequest((new URL(actionString)),requestInfo.getCookie(),actionString,null,postTarget + "String_Node_Str" + (String)steps.get(1).getParameter(),true);
postTarget=getFirstMatch(requestInfo.getHtmlCode(),patternForDownloadlink,1);
postTarget=postTarget.replaceAll("String_Node_Str","String_Node_Str");
}
 catch (Exception e) {
downloadLink.setStatus(DownloadLink.STATUS_ERROR_UNKNOWN);
step.setStatus(PluginStep.STATUS_ERROR);
e.printStackTrace();
}
try {
URLConnection urlConnection=new URL(postTarget).openConnection();
int length=urlConnection.getContentLength();
downloadLink.setDownloadMax(length);
downloadLink.setName(this.getFileNameFormHeader(urlConnection));
if (!hasEnoughHDSpace(downloadLink)) {
downloadLink.setStatus(DownloadLink.STATUS_ERROR_NO_FREE_SPACE);
step.setStatus(PluginStep.STATUS_ERROR);
return step;
}
if (download(downloadLink,urlConnection)) {
step.setStatus(PluginStep.STATUS_DONE);
downloadLink.setStatus(DownloadLink.STATUS_DONE);
return null;
}
 else {
logger.severe("String_Node_Str");
downloadLink.setStatus(DownloadLink.STATUS_ERROR_CAPTCHA_WRONG);
step.setStatus(PluginStep.STATUS_ERROR);
}
}
 catch (IOException e) {
logger.severe("String_Node_Str" + e.toString());
downloadLink.setStatus(DownloadLink.STATUS_ERROR_UNKNOWN);
step.setStatus(PluginStep.STATUS_ERROR);
return step;
}
break;
}
}
 catch (Exception e) {
downloadLink.setStatus(DownloadLink.STATUS_ERROR_UNKNOWN);
step.setStatus(PluginStep.STATUS_ERROR);
e.printStackTrace();
return step;
}
return step;
}