Program: 21280
Project: 21280
Buggy source:
public boolean doInteraction(Object arg){
  int okCounter=0;
  Configuration configuration=JDUtilities.getConfiguration();
  String script=configuration.getStringProperty(Configuration.PARAM_HTTPSEND_REQUESTS);
  String user=configuration.getStringProperty(Configuration.PARAM_HTTPSEND_USER);
  String pass=configuration.getStringProperty(Configuration.PARAM_HTTPSEND_PASS);
  String ip=configuration.getStringProperty(Configuration.PARAM_HTTPSEND_IP);
  retries++;
  logger.info("String_Node_Str" + retries);
  ProgressController progress=new ProgressController(JDLocale.L("String_Node_Str","String_Node_Str"),10);
  progress.setStatusText(JDLocale.L("String_Node_Str","String_Node_Str" + retries));
  if (user != null || pass != null) {
    Authenticator.setDefault(new InternalAuthenticator(user,pass));
  }
  if (script == null) {
    progress.finalize();
    return parseError("String_Node_Str");
  }
  String preIp=JDUtilities.getIPAddress();
  logger.finer("String_Node_Str" + preIp);
  progress.setStatusText(JDLocale.L("String_Node_Str","String_Node_Str") + preIp);
  script=script.replaceAll("String_Node_Str","String_Node_Str");
  script=script.replaceAll("String_Node_Str","String_Node_Str");
  script=script.replaceAll("String_Node_Str","String_Node_Str");
  script=script.replaceAll("String_Node_Str","String_Node_Str");
  script=script.replaceAll("String_Node_Str","String_Node_Str");
  script=script.replaceAll("String_Node_Str","String_Node_Str");
  Document xmlScript;
  variables=new HashMap<String,String>();
  variables.put("String_Node_Str",user);
  variables.put("String_Node_Str",pass);
  variables.put("String_Node_Str",new BASE64Encoder().encode((user + "String_Node_Str" + pass).getBytes()));
  variables.put("String_Node_Str",ip);
  headerProperties=new HashMap<String,String>();
  progress.increase(1);
  try {
    xmlScript=HTTPLiveHeader.parseXmlString(script,false);
    Node root=xmlScript.getChildNodes().item(0);
    if (root == null || !root.getNodeName().equalsIgnoreCase("String_Node_Str")) {
      progress.finalize();
      return parseError("String_Node_Str");
    }
    NodeList steps=root.getChildNodes();
    progress.addToMax(steps.getLength());
    for (int step=0; step < steps.getLength(); step++) {
      progress.setStatusText(JDLocale.L("String_Node_Str","String_Node_Str") + step);
      progress.increase(1);
      Node current=steps.item(step);
      if (current.getNodeType() == 3) {
        continue;
      }
      if (!current.getNodeName().equalsIgnoreCase("String_Node_Str")) {
        progress.finalize();
        return parseError("String_Node_Str" + current.getNodeName());
      }
      NodeList toDos=current.getChildNodes();
      for (int toDoStep=0; toDoStep < toDos.getLength(); toDoStep++) {
        Node toDo=toDos.item(toDoStep);
        progress.setStatusText(String.format(JDLocale.L("String_Node_Str","String_Node_Str"),toDo.getNodeName()));
        if (toDo.getNodeName().equalsIgnoreCase("String_Node_Str")) {
          NamedNodeMap attributes=toDo.getAttributes();
          for (int attribute=0; attribute < attributes.getLength(); attribute++) {
            String key=attributes.item(attribute).getNodeName();
            String value=attributes.item(attribute).getNodeValue();
            String[] tmp=value.split("String_Node_Str");
            String[] params=new Regex(value,"String_Node_Str").getColumn(-1);
            if (params.length > 0) {
              String req;
              if (value.startsWith(params[0])) {
                req="String_Node_Str";
                logger.finer("String_Node_Str" + variables);
                logger.finer("String_Node_Str" + headerProperties);
                for (int i=0; i <= tmp.length; i++) {
                  logger.finer("String_Node_Str" + params[i - 1] + "String_Node_Str");
                  req+=getModifiedVariable(params[i - 1]);
                  if (i < tmp.length) {
                    req+=tmp[i];
                  }
                }
              }
 else {
                req=tmp[0];
                logger.finer("String_Node_Str" + variables);
                logger.finer("String_Node_Str" + headerProperties);
                for (int i=1; i <= tmp.length; i++) {
                  if (i > params.length) {
                    continue;
                  }
                  logger.finer("String_Node_Str" + params[i - 1] + "String_Node_Str");
                  req+=getModifiedVariable(params[i - 1]);
                  if (i < tmp.length) {
                    req+=tmp[i];
                  }
                }
              }
              value=req;
            }
            variables.put(key,value);
          }
          logger.finer("String_Node_Str" + variables);
        }
        Browser br=null;
        if (toDo.getNodeName().equalsIgnoreCase("String_Node_Str")) {
          if (toDo.getChildNodes().getLength() != 1) {
            progress.finalize();
            return parseError("String_Node_Str");
          }
          br=doRequest(toDo.getChildNodes().item(0).getNodeValue().trim());
          if (br == null || !br.getHttpConnection().isOK()) {
            okCounter--;
            logger.severe("String_Node_Str");
          }
 else {
            okCounter++;
          }
        }
        if (toDo.getNodeName().equalsIgnoreCase("String_Node_Str")) {
          logger.finer("String_Node_Str");
          if (toDo.getChildNodes().getLength() != 1) {
            progress.finalize();
            return parseError("String_Node_Str");
          }
          NamedNodeMap attributes=toDo.getAttributes();
          if (attributes.getNamedItem("String_Node_Str") == null) {
            progress.finalize();
            return parseError("String_Node_Str" + toDo);
          }
          String[] keys=attributes.getNamedItem("String_Node_Str").getNodeValue().split("String_Node_Str");
          getVariables(toDo.getChildNodes().item(0).getNodeValue().trim(),keys,br);
        }
        if (toDo.getNodeName().equalsIgnoreCase("String_Node_Str")) {
          NamedNodeMap attributes=toDo.getAttributes();
          Node item=attributes.getNamedItem("String_Node_Str");
          logger.finer("String_Node_Str" + item.getNodeValue() + "String_Node_Str");
          if (item == null) {
            return parseError("String_Node_Str");
          }
          int seconds=JDUtilities.filterInt(item.getNodeValue());
          Thread.sleep(seconds * 1000);
        }
      }
    }
  }
 catch (  SAXException e) {
    progress.finalize();
    return parseError(e.getMessage());
  }
catch (  ParserConfigurationException e) {
    e.printStackTrace();
    progress.finalize();
    return parseError(e.getMessage());
  }
catch (  Exception e) {
    e.printStackTrace();
    progress.finalize();
    return parseError(e.getCause() + "String_Node_Str" + e.getMessage());
  }
  int waittime=configuration.getIntegerProperty(Configuration.PARAM_HTTPSEND_IPCHECKWAITTIME,0);
  int maxretries=configuration.getIntegerProperty(Configuration.PARAM_HTTPSEND_RETRIES,0);
  int waitForIp=configuration.getIntegerProperty(Configuration.PARAM_HTTPSEND_WAITFORIPCHANGE,10);
  logger.finer("String_Node_Str" + waittime + "String_Node_Str");
  progress.increase(1);
  progress.setStatusText(JDLocale.L("String_Node_Str","String_Node_Str"));
  try {
    Thread.sleep(waittime * 1000);
  }
 catch (  InterruptedException e) {
  }
  String afterIP=JDUtilities.getIPAddress();
  if (!JDUtilities.validateIP(afterIP)) {
    logger.warning("String_Node_Str" + afterIP + "String_Node_Str"+ JDUtilities.getConfiguration().getStringProperty(Configuration.PARAM_GLOBAL_IP_MASK,"String_Node_Str" + "String_Node_Str"));
    JDUtilities.getGUI().displayMiniWarning(String.format(JDLocale.L("String_Node_Str","String_Node_Str"),afterIP),null,20);
    afterIP="String_Node_Str";
  }
  progress.increase(1);
  String pattern;
  pattern=JDLocale.L("String_Node_Str","String_Node_Str");
  progress.setStatusText(String.format(pattern,preIp,afterIP));
  long endTime=System.currentTimeMillis() + waitForIp * 1000;
  while (System.currentTimeMillis() <= endTime && (afterIP.equalsIgnoreCase("String_Node_Str") || afterIP == null || afterIP.equals(preIp))) {
    try {
      Thread.sleep(5 * 1000);
    }
 catch (    InterruptedException e) {
    }
    afterIP=JDUtilities.getIPAddress();
    try {
      pattern=JDLocale.L("String_Node_Str","String_Node_Str");
      progress.setStatusText(String.format(pattern,preIp,afterIP));
    }
 catch (    Exception e) {
    }
    logger.finer("String_Node_Str" + afterIP);
  }
  logger.finer("String_Node_Str" + afterIP);
  if (afterIP.equals("String_Node_Str") && !afterIP.equals(preIp)) {
    logger.warning("String_Node_Str");
    endTime=System.currentTimeMillis() + 120 * 1000;
    while (System.currentTimeMillis() <= endTime && (afterIP.equalsIgnoreCase("String_Node_Str") || afterIP == null || afterIP.equals(preIp))) {
      try {
        Thread.sleep(20 * 1000);
      }
 catch (      InterruptedException e) {
      }
      afterIP=JDUtilities.getIPAddress();
      try {
        pattern=JDLocale.L("String_Node_Str","String_Node_Str");
        progress.setStatusText(String.format(pattern,preIp,afterIP));
      }
 catch (      Exception e) {
      }
      logger.finer("String_Node_Str" + afterIP);
    }
  }
  if (!afterIP.equals(preIp) && !afterIP.equalsIgnoreCase("String_Node_Str")) {
    progress.finalize();
    logger.info("String_Node_Str" + afterIP);
    return true;
  }
  if (retries <= maxretries) {
    progress.finalize();
    return doInteraction(arg);
  }
  progress.finalize();
  logger.info("String_Node_Str" + afterIP);
  return false;
}

Fixed version (ground truth):
public boolean doInteraction(Object arg){
  int okCounter=0;
  Configuration configuration=JDUtilities.getConfiguration();
  String script=configuration.getStringProperty(Configuration.PARAM_HTTPSEND_REQUESTS);
  String user=configuration.getStringProperty(Configuration.PARAM_HTTPSEND_USER);
  String pass=configuration.getStringProperty(Configuration.PARAM_HTTPSEND_PASS);
  String ip=configuration.getStringProperty(Configuration.PARAM_HTTPSEND_IP);
  retries++;
  logger.info("String_Node_Str" + retries);
  ProgressController progress=new ProgressController(JDLocale.L("String_Node_Str","String_Node_Str"),10);
  progress.setStatusText(JDLocale.L("String_Node_Str","String_Node_Str") + retries);
  if (user != null || pass != null) {
    Authenticator.setDefault(new InternalAuthenticator(user,pass));
  }
  if (script == null) {
    progress.finalize();
    return parseError("String_Node_Str");
  }
  String preIp=JDUtilities.getIPAddress();
  logger.finer("String_Node_Str" + preIp);
  progress.setStatusText(JDLocale.L("String_Node_Str","String_Node_Str") + preIp);
  script=script.replaceAll("String_Node_Str","String_Node_Str");
  script=script.replaceAll("String_Node_Str","String_Node_Str");
  script=script.replaceAll("String_Node_Str","String_Node_Str");
  script=script.replaceAll("String_Node_Str","String_Node_Str");
  script=script.replaceAll("String_Node_Str","String_Node_Str");
  script=script.replaceAll("String_Node_Str","String_Node_Str");
  Document xmlScript;
  variables=new HashMap<String,String>();
  variables.put("String_Node_Str",user);
  variables.put("String_Node_Str",pass);
  variables.put("String_Node_Str",new BASE64Encoder().encode((user + "String_Node_Str" + pass).getBytes()));
  variables.put("String_Node_Str",ip);
  headerProperties=new HashMap<String,String>();
  progress.increase(1);
  try {
    xmlScript=HTTPLiveHeader.parseXmlString(script,false);
    Node root=xmlScript.getChildNodes().item(0);
    if (root == null || !root.getNodeName().equalsIgnoreCase("String_Node_Str")) {
      progress.finalize();
      return parseError("String_Node_Str");
    }
    NodeList steps=root.getChildNodes();
    progress.addToMax(steps.getLength());
    for (int step=0; step < steps.getLength(); step++) {
      progress.setStatusText(JDLocale.L("String_Node_Str","String_Node_Str") + step);
      progress.increase(1);
      Node current=steps.item(step);
      if (current.getNodeType() == 3) {
        continue;
      }
      if (!current.getNodeName().equalsIgnoreCase("String_Node_Str")) {
        progress.finalize();
        return parseError("String_Node_Str" + current.getNodeName());
      }
      NodeList toDos=current.getChildNodes();
      for (int toDoStep=0; toDoStep < toDos.getLength(); toDoStep++) {
        Node toDo=toDos.item(toDoStep);
        progress.setStatusText(String.format(JDLocale.L("String_Node_Str","String_Node_Str"),toDo.getNodeName()));
        if (toDo.getNodeName().equalsIgnoreCase("String_Node_Str")) {
          NamedNodeMap attributes=toDo.getAttributes();
          for (int attribute=0; attribute < attributes.getLength(); attribute++) {
            String key=attributes.item(attribute).getNodeName();
            String value=attributes.item(attribute).getNodeValue();
            String[] tmp=value.split("String_Node_Str");
            String[] params=new Regex(value,"String_Node_Str").getColumn(-1);
            if (params.length > 0) {
              String req;
              if (value.startsWith(params[0])) {
                req="String_Node_Str";
                logger.finer("String_Node_Str" + variables);
                logger.finer("String_Node_Str" + headerProperties);
                for (int i=0; i <= tmp.length; i++) {
                  logger.finer("String_Node_Str" + params[i - 1] + "String_Node_Str");
                  req+=getModifiedVariable(params[i - 1]);
                  if (i < tmp.length) {
                    req+=tmp[i];
                  }
                }
              }
 else {
                req=tmp[0];
                logger.finer("String_Node_Str" + variables);
                logger.finer("String_Node_Str" + headerProperties);
                for (int i=1; i <= tmp.length; i++) {
                  if (i > params.length) {
                    continue;
                  }
                  logger.finer("String_Node_Str" + params[i - 1] + "String_Node_Str");
                  req+=getModifiedVariable(params[i - 1]);
                  if (i < tmp.length) {
                    req+=tmp[i];
                  }
                }
              }
              value=req;
            }
            variables.put(key,value);
          }
          logger.finer("String_Node_Str" + variables);
        }
        Browser br=null;
        if (toDo.getNodeName().equalsIgnoreCase("String_Node_Str")) {
          if (toDo.getChildNodes().getLength() != 1) {
            progress.finalize();
            return parseError("String_Node_Str");
          }
          br=doRequest(toDo.getChildNodes().item(0).getNodeValue().trim());
          if (br == null || !br.getHttpConnection().isOK()) {
            okCounter--;
            logger.severe("String_Node_Str");
          }
 else {
            okCounter++;
          }
        }
        if (toDo.getNodeName().equalsIgnoreCase("String_Node_Str")) {
          logger.finer("String_Node_Str");
          if (toDo.getChildNodes().getLength() != 1) {
            progress.finalize();
            return parseError("String_Node_Str");
          }
          NamedNodeMap attributes=toDo.getAttributes();
          if (attributes.getNamedItem("String_Node_Str") == null) {
            progress.finalize();
            return parseError("String_Node_Str" + toDo);
          }
          String[] keys=attributes.getNamedItem("String_Node_Str").getNodeValue().split("String_Node_Str");
          getVariables(toDo.getChildNodes().item(0).getNodeValue().trim(),keys,br);
        }
        if (toDo.getNodeName().equalsIgnoreCase("String_Node_Str")) {
          NamedNodeMap attributes=toDo.getAttributes();
          Node item=attributes.getNamedItem("String_Node_Str");
          logger.finer("String_Node_Str" + item.getNodeValue() + "String_Node_Str");
          if (item == null) {
            return parseError("String_Node_Str");
          }
          int seconds=JDUtilities.filterInt(item.getNodeValue());
          Thread.sleep(seconds * 1000);
        }
      }
    }
  }
 catch (  SAXException e) {
    progress.finalize();
    return parseError(e.getMessage());
  }
catch (  ParserConfigurationException e) {
    e.printStackTrace();
    progress.finalize();
    return parseError(e.getMessage());
  }
catch (  Exception e) {
    e.printStackTrace();
    progress.finalize();
    return parseError(e.getCause() + "String_Node_Str" + e.getMessage());
  }
  int waittime=configuration.getIntegerProperty(Configuration.PARAM_HTTPSEND_IPCHECKWAITTIME,0);
  int maxretries=configuration.getIntegerProperty(Configuration.PARAM_HTTPSEND_RETRIES,0);
  int waitForIp=configuration.getIntegerProperty(Configuration.PARAM_HTTPSEND_WAITFORIPCHANGE,10);
  logger.finer("String_Node_Str" + waittime + "String_Node_Str");
  progress.increase(1);
  progress.setStatusText(JDLocale.L("String_Node_Str","String_Node_Str"));
  try {
    Thread.sleep(waittime * 1000);
  }
 catch (  InterruptedException e) {
  }
  String afterIP=JDUtilities.getIPAddress();
  if (!JDUtilities.validateIP(afterIP)) {
    logger.warning("String_Node_Str" + afterIP + "String_Node_Str"+ JDUtilities.getConfiguration().getStringProperty(Configuration.PARAM_GLOBAL_IP_MASK,"String_Node_Str" + "String_Node_Str"));
    JDUtilities.getGUI().displayMiniWarning(String.format(JDLocale.L("String_Node_Str","String_Node_Str"),afterIP),null,20);
    afterIP="String_Node_Str";
  }
  progress.increase(1);
  String pattern;
  pattern=JDLocale.L("String_Node_Str","String_Node_Str");
  progress.setStatusText(String.format(pattern,preIp,afterIP));
  long endTime=System.currentTimeMillis() + waitForIp * 1000;
  while (System.currentTimeMillis() <= endTime && (afterIP.equalsIgnoreCase("String_Node_Str") || afterIP == null || afterIP.equals(preIp))) {
    try {
      Thread.sleep(5 * 1000);
    }
 catch (    InterruptedException e) {
    }
    afterIP=JDUtilities.getIPAddress();
    try {
      pattern=JDLocale.L("String_Node_Str","String_Node_Str");
      progress.setStatusText(String.format(pattern,preIp,afterIP));
    }
 catch (    Exception e) {
    }
    logger.finer("String_Node_Str" + afterIP);
  }
  logger.finer("String_Node_Str" + afterIP);
  if (afterIP.equals("String_Node_Str") && !afterIP.equals(preIp)) {
    logger.warning("String_Node_Str");
    endTime=System.currentTimeMillis() + 120 * 1000;
    while (System.currentTimeMillis() <= endTime && (afterIP.equalsIgnoreCase("String_Node_Str") || afterIP == null || afterIP.equals(preIp))) {
      try {
        Thread.sleep(20 * 1000);
      }
 catch (      InterruptedException e) {
      }
      afterIP=JDUtilities.getIPAddress();
      try {
        pattern=JDLocale.L("String_Node_Str","String_Node_Str");
        progress.setStatusText(String.format(pattern,preIp,afterIP));
      }
 catch (      Exception e) {
      }
      logger.finer("String_Node_Str" + afterIP);
    }
  }
  if (!afterIP.equals(preIp) && !afterIP.equalsIgnoreCase("String_Node_Str")) {
    progress.finalize();
    logger.info("String_Node_Str" + afterIP);
    return true;
  }
  if (retries <= maxretries) {
    progress.finalize();
    return doInteraction(arg);
  }
  progress.finalize();
  logger.info("String_Node_Str" + afterIP);
  return false;
}