Program: 7233
Project: 7233
Buggy source:
/** 
 * Executes the actual Integrity Update Item operation
 */
public boolean perform(AbstractBuild<?,?> build,Launcher launcher,BuildListener listener) throws InterruptedException, IOException {
  boolean success=true;
  AbstractProject<?,?> rootProject=getRootProject(build.getProject());
  if (!(rootProject.getScm() instanceof IntegritySCM)) {
    listener.getLogger().println("String_Node_Str" + rootProject.getScm() + "String_Node_Str");
    return true;
  }
  APISession api=APISession.create(getProjectSettings(build));
  if (null != api) {
    try {
      int intBuildItemID=0;
      int intTestSessionID=0;
      String buildItemID=build.getEnvironment(listener).get("String_Node_Str","String_Node_Str");
      try {
        intBuildItemID=Integer.parseInt(buildItemID);
      }
 catch (      NumberFormatException nfe) {
        intBuildItemID=0;
      }
      String testSessionID=build.getEnvironment(listener).get("String_Node_Str","String_Node_Str");
      try {
        intTestSessionID=Integer.parseInt(testSessionID);
      }
 catch (      NumberFormatException nfe) {
        intTestSessionID=0;
      }
      if (intBuildItemID <= 0) {
        if (queryDefinition.length() > 0) {
          Command issues=new Command(Command.IM,"String_Node_Str");
          issues.addOption(new Option("String_Node_Str","String_Node_Str"));
          issues.addOption(new Option("String_Node_Str",queryDefinition));
          Response issuesResponse=api.runCommand(issues);
          if (null != issuesResponse) {
            WorkItemIterator wit=issuesResponse.getWorkItems();
            if (wit.hasNext()) {
              buildItemID=wit.next().getField("String_Node_Str").getValueAsString();
              try {
                intBuildItemID=Integer.parseInt(buildItemID);
              }
 catch (              NumberFormatException nfe) {
                intBuildItemID=0;
              }
            }
 else {
              listener.getLogger().println("String_Node_Str");
              return false;
            }
          }
 else {
            listener.getLogger().println("String_Node_Str");
            return false;
          }
        }
 else {
          listener.getLogger().println("String_Node_Str");
        }
      }
      AbstractTestResultAction<?> testResult=build.getAction(AbstractTestResultAction.class);
      if (null != testResult && testResult.getTotalCount() > 0) {
        if (intTestSessionID <= 0 && testSessionField.length() > 0 && intBuildItemID > 0) {
          Command walk=new Command(Command.IM,"String_Node_Str");
          walk.addOption(new Option("String_Node_Str",testSessionStateField));
          walk.addOption(new Option("String_Node_Str",testSessionField));
          walk.addSelection(buildItemID);
          Response walkResponse=api.runCommand(walk);
          if (null != walkResponse) {
            Field testSessionFld=walkResponse.getWorkItem(buildItemID).getField(testSessionField);
            if (null != testSessionFld && null != testSessionFld.getList()) {
              @SuppressWarnings("String_Node_Str") List<Item> sessionList=testSessionFld.getList();
              for (              Item session : sessionList) {
                Field stateField=null;
                try {
                  stateField=session.getField(testSessionStateField);
                }
 catch (                NoSuchElementException nsee) {
                  stateField=walkResponse.getWorkItem(session.getId()).getField(testSessionStateField);
                }
                if (null != stateField && testSessionActiveState.equals(stateField.getValueAsString())) {
                  testSessionID=session.getId();
                  try {
                    intTestSessionID=Integer.parseInt(testSessionID);
                  }
 catch (                  NumberFormatException nfe) {
                    intTestSessionID=0;
                  }
                  break;
                }
              }
            }
          }
        }
        if (intTestSessionID > 0) {
          listener.getLogger().println("String_Node_Str" + testSessionID + "String_Node_Str");
          success=collectTestResults(build.getAction(AggregatedTestResultAction.class),listener,api,testSessionID);
          listener.getLogger().println("String_Node_Str" + testSessionID + "String_Node_Str");
        }
      }
      if (intBuildItemID > 0) {
        listener.getLogger().println("String_Node_Str" + buildItemID + "String_Node_Str");
        success=editBuildItem(build,listener,api,buildItemID);
      }
    }
 catch (    APIException aex) {
      LOGGER.severe("String_Node_Str");
      ExceptionHandler eh=new ExceptionHandler(aex);
      aex.printStackTrace(listener.fatalError(aex.getMessage()));
      LOGGER.severe(eh.getMessage());
      LOGGER.fine(eh.getCommand() + "String_Node_Str" + eh.getExitCode());
      return false;
    }
 finally {
      api.Terminate();
    }
  }
 else {
    LOGGER.severe("String_Node_Str");
    listener.getLogger().println("String_Node_Str");
    return false;
  }
  return success;
}

Fixed version (ground truth):
/** 
 * Executes the actual Integrity Update Item operation
 */
public boolean perform(AbstractBuild<?,?> build,Launcher launcher,BuildListener listener) throws InterruptedException, IOException {
  boolean success=true;
  AbstractProject<?,?> rootProject=build.getProject().getRootProject();
  if (!(rootProject.getScm() instanceof IntegritySCM)) {
    listener.getLogger().println("String_Node_Str" + rootProject.getScm() + "String_Node_Str");
    return true;
  }
  APISession api=APISession.create(getProjectSettings(build));
  if (null != api) {
    try {
      int intBuildItemID=0;
      int intTestSessionID=0;
      String buildItemID=build.getEnvironment(listener).get("String_Node_Str","String_Node_Str");
      try {
        intBuildItemID=Integer.parseInt(buildItemID);
      }
 catch (      NumberFormatException nfe) {
        intBuildItemID=0;
      }
      String testSessionID=build.getEnvironment(listener).get("String_Node_Str","String_Node_Str");
      try {
        intTestSessionID=Integer.parseInt(testSessionID);
      }
 catch (      NumberFormatException nfe) {
        intTestSessionID=0;
      }
      if (intBuildItemID <= 0) {
        if (queryDefinition.length() > 0) {
          Command issues=new Command(Command.IM,"String_Node_Str");
          issues.addOption(new Option("String_Node_Str","String_Node_Str"));
          issues.addOption(new Option("String_Node_Str",queryDefinition));
          Response issuesResponse=api.runCommand(issues);
          if (null != issuesResponse) {
            WorkItemIterator wit=issuesResponse.getWorkItems();
            if (wit.hasNext()) {
              buildItemID=wit.next().getField("String_Node_Str").getValueAsString();
              try {
                intBuildItemID=Integer.parseInt(buildItemID);
              }
 catch (              NumberFormatException nfe) {
                intBuildItemID=0;
              }
            }
 else {
              listener.getLogger().println("String_Node_Str");
              return false;
            }
          }
 else {
            listener.getLogger().println("String_Node_Str");
            return false;
          }
        }
 else {
          listener.getLogger().println("String_Node_Str");
        }
      }
      AbstractTestResultAction<?> testResult=build.getAction(AbstractTestResultAction.class);
      if (null != testResult && testResult.getTotalCount() > 0) {
        if (intTestSessionID <= 0 && testSessionField.length() > 0 && intBuildItemID > 0) {
          Command walk=new Command(Command.IM,"String_Node_Str");
          walk.addOption(new Option("String_Node_Str",testSessionStateField));
          walk.addOption(new Option("String_Node_Str",testSessionField));
          walk.addSelection(buildItemID);
          Response walkResponse=api.runCommand(walk);
          if (null != walkResponse) {
            Field testSessionFld=walkResponse.getWorkItem(buildItemID).getField(testSessionField);
            if (null != testSessionFld && null != testSessionFld.getList()) {
              @SuppressWarnings("String_Node_Str") List<Item> sessionList=testSessionFld.getList();
              for (              Item session : sessionList) {
                Field stateField=null;
                try {
                  stateField=session.getField(testSessionStateField);
                }
 catch (                NoSuchElementException nsee) {
                  stateField=walkResponse.getWorkItem(session.getId()).getField(testSessionStateField);
                }
                if (null != stateField && testSessionActiveState.equals(stateField.getValueAsString())) {
                  testSessionID=session.getId();
                  try {
                    intTestSessionID=Integer.parseInt(testSessionID);
                  }
 catch (                  NumberFormatException nfe) {
                    intTestSessionID=0;
                  }
                  break;
                }
              }
            }
          }
        }
        if (intTestSessionID > 0) {
          listener.getLogger().println("String_Node_Str" + testSessionID + "String_Node_Str");
          success=collectTestResults(build.getAction(AggregatedTestResultAction.class),listener,api,testSessionID);
          listener.getLogger().println("String_Node_Str" + testSessionID + "String_Node_Str");
        }
      }
      if (intBuildItemID > 0) {
        listener.getLogger().println("String_Node_Str" + buildItemID + "String_Node_Str");
        success=editBuildItem(build,listener,api,buildItemID);
      }
    }
 catch (    APIException aex) {
      LOGGER.severe("String_Node_Str");
      ExceptionHandler eh=new ExceptionHandler(aex);
      aex.printStackTrace(listener.fatalError(aex.getMessage()));
      LOGGER.severe(eh.getMessage());
      LOGGER.fine(eh.getCommand() + "String_Node_Str" + eh.getExitCode());
      return false;
    }
 finally {
      api.Terminate();
    }
  }
 else {
    LOGGER.severe("String_Node_Str");
    listener.getLogger().println("String_Node_Str");
    return false;
  }
  return success;
}