Program: 11974
Project: 11974
Buggy source:
/** 
 * Finish.
 * @param doc
 * @param element
 * @param position
 * @param tags
 */
public void finish(Document doc,Element element,Integer position,List<Tag> tags,Document docJunit,Element Junit) throws ExecutionException, InterruptedException, IOException {
  Junit.setAttribute("String_Node_Str",String.valueOf(calculateTotalDurationString() / 1000));
  element.setAttribute("String_Node_Str",String.valueOf(calculateTotalDurationString()));
  element.setAttribute("String_Node_Str",DATE_FORMAT.format(new Date()));
  StringBuilder stringBuilder=new StringBuilder();
  List<Step> mergedsteps=new ArrayList<Step>();
  if (stepsbg != null) {
    mergedsteps.addAll(stepsbg);
    mergedsteps.addAll(steps);
  }
 else {
    mergedsteps.addAll(steps);
  }
  addStepAndResultListing(stringBuilder,mergedsteps);
  Result skipped=null;
  Result failed=null;
  Boolean ignored=false;
  Boolean ignoreReason=false;
  String exceptionmsg="String_Node_Str";
  AsyncHttpClient client=new AsyncHttpClient();
  Future<Response> response=null;
  Boolean isJiraTicketDone=false;
  Boolean isWrongTicket=false;
  CommonG comm=new CommonG();
  String userJira=System.getProperty("String_Node_Str");
  String passJira=System.getProperty("String_Node_Str");
  Logger logger=LoggerFactory.getLogger(ThreadProperty.get("String_Node_Str"));
  String value="String_Node_Str";
  for (  Tag tag : tags) {
    if ("String_Node_Str".equals(tag.getName())) {
      ignored=true;
      for (      Tag tagNs : tags) {
        if (!(tagNs.getName().equals("String_Node_Str"))) {
          String tillFix=tagNs.getName();
          if (tillFix.startsWith("String_Node_Str")) {
            Pattern pattern=Pattern.compile("String_Node_Str");
            Matcher matcher=pattern.matcher(tillFix);
            String issue="String_Node_Str";
            if (matcher.find()) {
              issue=matcher.group(2);
            }
 else {
              isWrongTicket=true;
            }
            if (((userJira != null) || (passJira != null)) && (issue != "String_Node_Str")) {
              byte[] encodedBytes=Base64.encodeBase64(userJira.getBytes());
              byte[] encodedBytes2=Base64.encodeBase64(passJira.getBytes());
              String codeBase64="String_Node_Str" + encodedBytes + "String_Node_Str"+ encodedBytes2;
              comm.setRestHost("String_Node_Str");
              comm.setRestPort("String_Node_Str");
              comm.setClient(client);
              String endpoint="String_Node_Str" + issue;
              try {
                response=comm.generateRequest("String_Node_Str",true,endpoint,"String_Node_Str","String_Node_Str",codeBase64);
                comm.setResponse(endpoint,response.get());
              }
 catch (              Exception e) {
                logger.error("String_Node_Str" + String.valueOf(comm.getResponse().getStatusCode()));
              }
              String json=comm.getResponse().getResponse();
              try {
                value=JsonPath.read(json,"String_Node_Str");
              }
 catch (              PathNotFoundException pe) {
                logger.error("String_Node_Str");
              }
              if (value.equals("String_Node_Str")) {
                isWrongTicket=true;
              }
 else               if ("String_Node_Str".equals(value.toLowerCase()) || "String_Node_Str".equals(value.toLowerCase())) {
                isJiraTicketDone=true;
              }
            }
            exceptionmsg="String_Node_Str" + issue;
            ignoreReason=true;
            break;
          }
          if (tagNs.getName().matches("String_Node_Str")) {
            exceptionmsg="String_Node_Str";
            ignoreReason=true;
            break;
          }
          if (tagNs.getName().matches("String_Node_Str")) {
            ignoreReason=true;
            exceptionmsg="String_Node_Str";
            break;
          }
          if (tagNs.getName().matches("String_Node_Str")) {
            exceptionmsg="String_Node_Str";
            ignoreReason=true;
            break;
          }
        }
      }
    }
    String msg1=null;
    String msg2=null;
    if (ignored && (!ignoreReason || (ignoreReason && isJiraTicketDone) || (ignoreReason && isWrongTicket))) {
      element.setAttribute(STATUS,"String_Node_Str");
      if (isJiraTicketDone) {
        msg1="String_Node_Str";
        msg2="String_Node_Str";
      }
 else       if (isWrongTicket) {
        msg1="String_Node_Str";
        msg2="String_Node_Str";
      }
 else {
        msg1="String_Node_Str";
        msg2="String_Node_Str";
      }
      Element exception=createException(doc,msg1,msg1,msg2);
      element.appendChild(exception);
      Element systemOut=createExceptionJunit(docJunit,msg1,msg1,msg2);
      Junit.appendChild(systemOut);
    }
 else     if (ignored && ignoreReason) {
      element.setAttribute(STATUS,"String_Node_Str");
      Element exception=createException(doc,"String_Node_Str",exceptionmsg,"String_Node_Str");
      element.appendChild(exception);
      Element skippedElementJunit=docJunit.createElement("String_Node_Str");
      Junit.appendChild(skippedElementJunit);
      Element systemOut=systemOutPrintJunit(docJunit,exceptionmsg);
      Junit.appendChild(systemOut);
    }
 else {
      for (      Result result : results) {
        if ("String_Node_Str".equals(result.getStatus())) {
          failed=result;
        }
 else         if ("String_Node_Str".equals(result.getStatus()) || "String_Node_Str".equals(result.getStatus())) {
          skipped=result;
        }
      }
      for (      Result result : hooks) {
        if (failed == null && "String_Node_Str".equals(result.getStatus())) {
          failed=result;
        }
      }
      if (failed != null) {
        element.setAttribute(STATUS,"String_Node_Str");
        StringWriter stringWriter=new StringWriter();
        failed.getError().printStackTrace(new PrintWriter(stringWriter));
        Element exception=createException(doc,failed.getError().getClass().getName(),stringBuilder.toString(),stringWriter.toString());
        element.appendChild(exception);
        Element exceptionJunit=createExceptionJunit(docJunit,failed.getError().getClass().getName(),stringBuilder.toString(),stringWriter.toString());
        Junit.appendChild(exceptionJunit);
      }
 else       if (skipped != null) {
        if (treatSkippedAsFailure) {
          element.setAttribute(STATUS,"String_Node_Str");
          Element exception=createException(doc,"String_Node_Str",stringBuilder.toString(),"String_Node_Str");
          element.appendChild(exception);
          Element exceptionJunit=createExceptionJunit(docJunit,"String_Node_Str",stringBuilder.toString(),"String_Node_Str");
          Junit.appendChild(exceptionJunit);
        }
 else {
          element.setAttribute(STATUS,"String_Node_Str");
          Element skippedElementJunit=docJunit.createElement("String_Node_Str");
          Junit.appendChild(skippedElementJunit);
          Element systemOut=systemOutPrintJunit(docJunit,stringBuilder.toString());
          Junit.appendChild(systemOut);
        }
      }
 else {
        element.setAttribute(STATUS,"String_Node_Str");
        Element exception=createException(doc,"String_Node_Str",stringBuilder.toString(),"String_Node_Str");
        element.appendChild(exception);
        Element systemOut=systemOutPrintJunit(docJunit,stringBuilder.toString());
        Junit.appendChild(systemOut);
      }
    }
  }
}

Fixed version (ground truth):
/** 
 * Finish.
 * @param doc
 * @param element
 * @param position
 * @param tags
 */
public void finish(Document doc,Element element,Integer position,List<Tag> tags,Document docJunit,Element Junit) throws ExecutionException, InterruptedException, IOException {
  Junit.setAttribute("String_Node_Str",String.valueOf(calculateTotalDurationString() / 1000));
  element.setAttribute("String_Node_Str",String.valueOf(calculateTotalDurationString()));
  element.setAttribute("String_Node_Str",DATE_FORMAT.format(new Date()));
  StringBuilder stringBuilder=new StringBuilder();
  List<Step> mergedsteps=new ArrayList<Step>();
  if (stepsbg != null) {
    mergedsteps.addAll(stepsbg);
    mergedsteps.addAll(steps);
  }
 else {
    mergedsteps.addAll(steps);
  }
  addStepAndResultListing(stringBuilder,mergedsteps);
  Result skipped=null;
  Result failed=null;
  Boolean ignored=false;
  Boolean ignoreReason=false;
  String exceptionmsg="String_Node_Str";
  AsyncHttpClient client=new AsyncHttpClient();
  Future<Response> response=null;
  Boolean isJiraTicketDone=false;
  Boolean isWrongTicket=false;
  CommonG comm=new CommonG();
  String userJira=System.getProperty("String_Node_Str");
  String passJira=System.getProperty("String_Node_Str");
  Logger logger=LoggerFactory.getLogger(ThreadProperty.get("String_Node_Str"));
  String value="String_Node_Str";
  for (  Tag tag : tags) {
    if ("String_Node_Str".equals(tag.getName())) {
      ignored=true;
      for (      Tag tagNs : tags) {
        if (!(tagNs.getName().equals("String_Node_Str"))) {
          String tillFix=tagNs.getName();
          if (tillFix.startsWith("String_Node_Str")) {
            Pattern pattern=Pattern.compile("String_Node_Str");
            Matcher matcher=pattern.matcher(tillFix);
            String issue="String_Node_Str";
            if (matcher.find()) {
              issue=matcher.group(2);
            }
 else {
              isWrongTicket=true;
            }
            if (((userJira != null) || (passJira != null)) && (issue != "String_Node_Str")) {
              String data=userJira + "String_Node_Str" + passJira;
              byte[] encodedBytes=Base64.encodeBase64(data.getBytes());
              String encodedString=new String(encodedBytes);
              String codeBase64="String_Node_Str" + encodedString;
              comm.setRestHost("String_Node_Str");
              comm.setRestPort("String_Node_Str");
              comm.setClient(client);
              String endpoint="String_Node_Str" + issue;
              try {
                response=comm.generateRequest("String_Node_Str",true,endpoint,"String_Node_Str","String_Node_Str",codeBase64);
                comm.setResponse(endpoint,response.get());
              }
 catch (              Exception e) {
                logger.error("String_Node_Str" + String.valueOf(comm.getResponse().getStatusCode()));
              }
              String json=comm.getResponse().getResponse();
              try {
                value=JsonPath.read(json,"String_Node_Str");
              }
 catch (              PathNotFoundException pe) {
                logger.error("String_Node_Str");
              }
              if (value.equals("String_Node_Str")) {
                isWrongTicket=true;
              }
 else               if ("String_Node_Str".equals(value.toLowerCase()) || "String_Node_Str".equals(value.toLowerCase())) {
                isJiraTicketDone=true;
              }
            }
            exceptionmsg="String_Node_Str" + issue;
            ignoreReason=true;
            break;
          }
          if (tagNs.getName().matches("String_Node_Str")) {
            exceptionmsg="String_Node_Str";
            ignoreReason=true;
            break;
          }
          if (tagNs.getName().matches("String_Node_Str")) {
            ignoreReason=true;
            exceptionmsg="String_Node_Str";
            break;
          }
          if (tagNs.getName().matches("String_Node_Str")) {
            exceptionmsg="String_Node_Str";
            ignoreReason=true;
            break;
          }
        }
      }
    }
    String msg1=null;
    String msg2=null;
    if (ignored && (!ignoreReason || (ignoreReason && isJiraTicketDone) || (ignoreReason && isWrongTicket))) {
      element.setAttribute(STATUS,"String_Node_Str");
      if (isJiraTicketDone) {
        msg1="String_Node_Str";
        msg2="String_Node_Str";
      }
 else       if (isWrongTicket) {
        msg1="String_Node_Str";
        msg2="String_Node_Str";
      }
 else {
        msg1="String_Node_Str";
        msg2="String_Node_Str";
      }
      Element exception=createException(doc,msg1,msg1,msg2);
      element.appendChild(exception);
      Element systemOut=createExceptionJunit(docJunit,msg1,msg1,msg2);
      Junit.appendChild(systemOut);
    }
 else     if (ignored && ignoreReason) {
      element.setAttribute(STATUS,"String_Node_Str");
      Element exception=createException(doc,"String_Node_Str",exceptionmsg,"String_Node_Str");
      element.appendChild(exception);
      Element skippedElementJunit=docJunit.createElement("String_Node_Str");
      Junit.appendChild(skippedElementJunit);
      Element systemOut=systemOutPrintJunit(docJunit,exceptionmsg);
      Junit.appendChild(systemOut);
    }
 else {
      for (      Result result : results) {
        if ("String_Node_Str".equals(result.getStatus())) {
          failed=result;
        }
 else         if ("String_Node_Str".equals(result.getStatus()) || "String_Node_Str".equals(result.getStatus())) {
          skipped=result;
        }
      }
      for (      Result result : hooks) {
        if (failed == null && "String_Node_Str".equals(result.getStatus())) {
          failed=result;
        }
      }
      if (failed != null) {
        element.setAttribute(STATUS,"String_Node_Str");
        StringWriter stringWriter=new StringWriter();
        failed.getError().printStackTrace(new PrintWriter(stringWriter));
        Element exception=createException(doc,failed.getError().getClass().getName(),stringBuilder.toString(),stringWriter.toString());
        element.appendChild(exception);
        Element exceptionJunit=createExceptionJunit(docJunit,failed.getError().getClass().getName(),stringBuilder.toString(),stringWriter.toString());
        Junit.appendChild(exceptionJunit);
      }
 else       if (skipped != null) {
        if (treatSkippedAsFailure) {
          element.setAttribute(STATUS,"String_Node_Str");
          Element exception=createException(doc,"String_Node_Str",stringBuilder.toString(),"String_Node_Str");
          element.appendChild(exception);
          Element exceptionJunit=createExceptionJunit(docJunit,"String_Node_Str",stringBuilder.toString(),"String_Node_Str");
          Junit.appendChild(exceptionJunit);
        }
 else {
          element.setAttribute(STATUS,"String_Node_Str");
          Element skippedElementJunit=docJunit.createElement("String_Node_Str");
          Junit.appendChild(skippedElementJunit);
          Element systemOut=systemOutPrintJunit(docJunit,stringBuilder.toString());
          Junit.appendChild(systemOut);
        }
      }
 else {
        element.setAttribute(STATUS,"String_Node_Str");
        Element exception=createException(doc,"String_Node_Str",stringBuilder.toString(),"String_Node_Str");
        element.appendChild(exception);
        Element systemOut=systemOutPrintJunit(docJunit,stringBuilder.toString());
        Junit.appendChild(systemOut);
      }
    }
  }
}