Program: 88405
Project: 88405
Buggy source:
@Override public void run(ProgressStatus progressStatus){
  BranchInfoImpl branchInfoImpl=toBranchInfoImpl(branchInfo);
  if (branchInfoImpl == null) {
    Application.getInstance().getGUILog().log("String_Node_Str");
    return;
  }
  ProjectDescriptor projectDescriptor=ProjectDescriptorsFactory.createAnyRemoteProjectDescriptor(project);
  ProjectDescriptor branchDescriptor=EsiUtils.getDescriptorByBranchID(projectDescriptor,branchInfoImpl.getID());
  List<CommitInfoImpl> branchCommits=toCommitInfoImpls(EsiUtils.getVersions(branchDescriptor));
  long startRevisionCommitId=branchInfoImpl.getStartRevision();
  CommitInfoImpl startRevisionCommitInfo=branchCommits.stream().filter(version -> startRevisionCommitId == version.getID()).findAny().orElse(null);
  if (startRevisionCommitInfo == null) {
    Application.getInstance().getGUILog().log("String_Node_Str");
    return;
  }
  UUID parentBranchUuid=startRevisionCommitInfo.getBranchID();
  EsiUtils.EsiBranchInfo parentBranchInfo=EsiUtils.getBranches(projectDescriptor).stream().filter(branch -> branch.getID().equals(parentBranchUuid)).findAny().orElse(null);
  if (parentBranchInfo == null) {
    Application.getInstance().getGUILog().log("String_Node_Str");
    return;
  }
  String parentBranchId=parentBranchUuid.toString();
  String parentBranchName=parentBranchInfo.getName();
  if (parentBranchInfo.getName().equals("String_Node_Str")) {
    parentBranchId="String_Node_Str";
    parentBranchName="String_Node_Str";
  }
  int parentCommitsBehind=0;
  long latestRevisionCommitId=branchInfoImpl.getLatestRevision();
  CommitInfoImpl latestRevisionCommitInfo=branchCommits.stream().filter(version -> latestRevisionCommitId == version.getID()).findAny().orElse(null);
  if (latestRevisionCommitInfo == null) {
    Application.getInstance().getGUILog().log("String_Node_Str");
    return;
  }
  CommitInfoImpl commit=latestRevisionCommitInfo;
  while (commit != null && commit.getID() != startRevisionCommitId) {
    parentCommitsBehind++;
    long directParent=commit.getDirectParent();
    commit=branchCommits.stream().filter(version -> directParent == version.getID()).findAny().orElse(null);
  }
  parentCommitsBehind--;
  int parentCommitsAhead=0;
  ProjectDescriptor parentBranchDescriptor=EsiUtils.getDescriptorByBranchID(projectDescriptor,parentBranchUuid);
  List<CommitInfoImpl> parentBranchCommits=toCommitInfoImpls(EsiUtils.getVersions(parentBranchDescriptor));
  BranchInfoImpl parentBranchInfoImpl=toBranchInfoImpl(parentBranchInfo);
  if (parentBranchInfoImpl == null) {
    Application.getInstance().getGUILog().log("String_Node_Str");
  }
  long parentLatestRevisionCommitId=parentBranchInfoImpl.getLatestRevision();
  CommitInfoImpl parentLatestRevisionCommitInfo=parentBranchCommits.stream().filter(version -> parentLatestRevisionCommitId == version.getID()).findAny().orElse(null);
  if (parentLatestRevisionCommitInfo == null) {
    Application.getInstance().getGUILog().log("String_Node_Str");
    return;
  }
  commit=parentLatestRevisionCommitInfo;
  while (commit != null && commit.getID() != startRevisionCommitId) {
    parentCommitsAhead++;
    long directParent=commit.getDirectParent();
    commit=parentBranchCommits.stream().filter(version -> directParent == version.getID()).findAny().orElse(null);
  }
  JsonNode parentBranchJsonNode=null;
  URIBuilder requestUri=MMSUtils.getServiceProjectsRefsUri(project);
  if (requestUri == null) {
    Application.getInstance().getGUILog().log("String_Node_Str");
    return;
  }
  requestUri.setPath(requestUri.getPath() + "String_Node_Str" + parentBranchId);
  try {
    HttpRequestBase request=MMSUtils.buildRequest(MMSUtils.HttpRequestType.GET,requestUri);
    File responseFile=MMSUtils.sendMMSRequest(project,request);
    ObjectNode response;
    try (JsonParser jsonParser=JacksonUtils.getJsonFactory().createParser(responseFile)){
      response=JacksonUtils.parseJsonObject(jsonParser);
    }
     JsonNode refsArray, value;
    if ((refsArray=response.get("String_Node_Str")) != null && refsArray.isArray()) {
      for (      JsonNode refJson : refsArray) {
        if (refJson.isObject()) {
          ObjectNode refObjectNode=(ObjectNode)refJson;
          refObjectNode.remove(MDKConstants.PARENT_REF_ID_KEY);
          String entryKey;
          if ((value=refObjectNode.get(MDKConstants.ID_KEY)) != null && value.isTextual()) {
            entryKey=refObjectNode.get(MDKConstants.ID_KEY).asText();
            if (entryKey.equals(parentBranchId)) {
              parentBranchJsonNode=refObjectNode;
            }
          }
        }
      }
    }
  }
 catch (  IOException|URISyntaxException|ServerException e) {
    e.printStackTrace();
    Application.getInstance().getGUILog().log("String_Node_Str" + e.getMessage());
    return;
  }
  if (parentBranchJsonNode == null) {
    Application.getInstance().getGUILog().log("String_Node_Str" + parentBranchName + "String_Node_Str");
    return;
  }
  requestUri=MMSUtils.getServiceProjectsRefsUri(project);
  if (requestUri == null) {
    Application.getInstance().getGUILog().log("String_Node_Str");
    return;
  }
  Collection<ObjectNode> refsNodes=new LinkedList<>();
  ObjectNode branchNode=BranchValidator.getRefObjectNode(project,branchInfo,parentBranchId);
  refsNodes.add(branchNode);
  if (parentCommitsBehind > 0 || parentCommitsAhead > 0) {
    Application.getInstance().getGUILog().log("String_Node_Str" + parentBranchName + "String_Node_Str"+ (parentCommitsBehind > 0 ? NumberFormat.getInstance().format(parentCommitsBehind) + "String_Node_Str" + (parentCommitsBehind != 1 ? "String_Node_Str" : "String_Node_Str")+ "String_Node_Str" : "String_Node_Str")+ (parentCommitsBehind > 0 && parentCommitsAhead > 0 ? "String_Node_Str" : "String_Node_Str")+ (parentCommitsAhead > 0 ? NumberFormat.getInstance().format(parentCommitsAhead) + "String_Node_Str" + (parentCommitsAhead != 1 ? "String_Node_Str" : "String_Node_Str")+ "String_Node_Str" : "String_Node_Str")+ "String_Node_Str"+ branchInfo.getName()+ "String_Node_Str"+ "String_Node_Str");
  }
  try {
    File sendFile=MMSUtils.createEntityFile(this.getClass(),ContentType.APPLICATION_JSON,refsNodes,MMSUtils.JsonBlobType.REF);
    HttpRequestBase request=MMSUtils.buildRequest(MMSUtils.HttpRequestType.POST,requestUri,sendFile,ContentType.APPLICATION_JSON);
    MMSUtils.sendMMSRequest(project,request);
  }
 catch (  IOException|URISyntaxException|ServerException e) {
    Application.getInstance().getGUILog().log("String_Node_Str" + e.getMessage());
    e.printStackTrace();
    return;
  }
  Application.getInstance().getGUILog().log("String_Node_Str" + branchInfo.getName() + "String_Node_Str");
  if (validateModel) {
    RunnableWithProgress temp=new ManualSyncRunner(Collections.singletonList(project.getPrimaryModel()),project,-1);
    ProgressStatusRunner.runWithProgressStatus(temp,"String_Node_Str",true,0);
  }
}

Fixed version (ground truth):
@Override public void run(ProgressStatus progressStatus){
  BranchInfoImpl branchInfoImpl=toBranchInfoImpl(branchInfo);
  if (branchInfoImpl == null) {
    Application.getInstance().getGUILog().log("String_Node_Str");
    return;
  }
  ProjectDescriptor projectDescriptor=ProjectDescriptorsFactory.createAnyRemoteProjectDescriptor(project);
  ProjectDescriptor branchDescriptor=EsiUtils.getDescriptorByBranchID(projectDescriptor,branchInfoImpl.getID());
  List<CommitInfoImpl> branchCommits=toCommitInfoImpls(EsiUtils.getVersions(branchDescriptor));
  long startRevisionCommitId=branchInfoImpl.getStartRevision();
  CommitInfoImpl startRevisionCommitInfo=branchCommits.stream().filter(version -> startRevisionCommitId == version.getID()).findAny().orElse(null);
  if (startRevisionCommitInfo == null) {
    Application.getInstance().getGUILog().log("String_Node_Str");
    return;
  }
  UUID parentBranchUuid=startRevisionCommitInfo.getBranchID();
  EsiUtils.EsiBranchInfo parentBranchInfo=EsiUtils.getBranches(projectDescriptor).stream().filter(branch -> branch.getID().equals(parentBranchUuid)).findAny().orElse(null);
  if (parentBranchInfo == null) {
    Application.getInstance().getGUILog().log("String_Node_Str");
    return;
  }
  String parentBranchId=parentBranchUuid.toString();
  String parentBranchName=parentBranchInfo.getName();
  if (parentBranchInfo.getName().equals("String_Node_Str")) {
    parentBranchId="String_Node_Str";
    parentBranchName="String_Node_Str";
  }
  int parentCommitsBehind=0;
  long latestRevisionCommitId=branchInfoImpl.getLatestRevision();
  CommitInfoImpl latestRevisionCommitInfo=branchCommits.stream().filter(version -> latestRevisionCommitId == version.getID()).findAny().orElse(null);
  if (latestRevisionCommitInfo == null) {
    Application.getInstance().getGUILog().log("String_Node_Str");
    return;
  }
  CommitInfoImpl commit=latestRevisionCommitInfo;
  while (commit != null && commit.getID() != startRevisionCommitId) {
    parentCommitsBehind++;
    long directParent=commit.getDirectParent();
    commit=branchCommits.stream().filter(version -> directParent == version.getID()).findAny().orElse(null);
  }
  parentCommitsBehind--;
  int parentCommitsAhead=0;
  ProjectDescriptor parentBranchDescriptor=EsiUtils.getDescriptorByBranchID(projectDescriptor,parentBranchUuid);
  List<CommitInfoImpl> parentBranchCommits=toCommitInfoImpls(EsiUtils.getVersions(parentBranchDescriptor));
  BranchInfoImpl parentBranchInfoImpl=toBranchInfoImpl(parentBranchInfo);
  if (parentBranchInfoImpl == null) {
    Application.getInstance().getGUILog().log("String_Node_Str");
  }
  long parentLatestRevisionCommitId=parentBranchInfoImpl.getLatestRevision();
  CommitInfoImpl parentLatestRevisionCommitInfo=parentBranchCommits.stream().filter(version -> parentLatestRevisionCommitId == version.getID()).findAny().orElse(null);
  if (parentLatestRevisionCommitInfo == null) {
    Application.getInstance().getGUILog().log("String_Node_Str");
    return;
  }
  commit=parentLatestRevisionCommitInfo;
  while (commit != null && commit.getID() != startRevisionCommitId) {
    parentCommitsAhead++;
    long directParent=commit.getDirectParent();
    commit=parentBranchCommits.stream().filter(version -> directParent == version.getID()).findAny().orElse(null);
  }
  JsonNode parentBranchJsonNode=null;
  URIBuilder requestUri=MMSUtils.getServiceProjectsRefsUri(project);
  if (requestUri == null) {
    Application.getInstance().getGUILog().log("String_Node_Str");
    return;
  }
  requestUri.setPath(requestUri.getPath() + "String_Node_Str" + parentBranchId);
  try {
    HttpRequestBase request=MMSUtils.buildRequest(MMSUtils.HttpRequestType.GET,requestUri);
    File responseFile=MMSUtils.sendMMSRequest(project,request);
    ObjectNode response;
    try (JsonParser jsonParser=JacksonUtils.getJsonFactory().createParser(responseFile)){
      response=JacksonUtils.parseJsonObject(jsonParser);
    }
     JsonNode refsArray, value;
    if ((refsArray=response.get("String_Node_Str")) != null && refsArray.isArray()) {
      for (      JsonNode refJson : refsArray) {
        if (refJson.isObject()) {
          ObjectNode refObjectNode=(ObjectNode)refJson;
          refObjectNode.remove(MDKConstants.PARENT_REF_ID_KEY);
          String entryKey;
          if ((value=refObjectNode.get(MDKConstants.ID_KEY)) != null && value.isTextual()) {
            entryKey=refObjectNode.get(MDKConstants.ID_KEY).asText();
            if (entryKey.equals(parentBranchId)) {
              parentBranchJsonNode=refObjectNode;
            }
          }
        }
      }
    }
  }
 catch (  IOException|URISyntaxException|ServerException e) {
    e.printStackTrace();
    Application.getInstance().getGUILog().log("String_Node_Str" + e.getMessage());
    return;
  }
  if (parentBranchJsonNode == null) {
    Application.getInstance().getGUILog().log("String_Node_Str" + parentBranchName + "String_Node_Str");
    return;
  }
  requestUri=MMSUtils.getServiceProjectsRefsUri(project);
  if (requestUri == null) {
    Application.getInstance().getGUILog().log("String_Node_Str");
    return;
  }
  Collection<ObjectNode> refsNodes=new LinkedList<>();
  ObjectNode branchNode=BranchValidator.generateRefObjectNode(project,branchInfo,parentBranchId);
  refsNodes.add(branchNode);
  if (parentCommitsBehind > 0 || parentCommitsAhead > 0) {
    Application.getInstance().getGUILog().log("String_Node_Str" + parentBranchName + "String_Node_Str"+ (parentCommitsBehind > 0 ? NumberFormat.getInstance().format(parentCommitsBehind) + "String_Node_Str" + (parentCommitsBehind != 1 ? "String_Node_Str" : "String_Node_Str")+ "String_Node_Str" : "String_Node_Str")+ (parentCommitsBehind > 0 && parentCommitsAhead > 0 ? "String_Node_Str" : "String_Node_Str")+ (parentCommitsAhead > 0 ? NumberFormat.getInstance().format(parentCommitsAhead) + "String_Node_Str" + (parentCommitsAhead != 1 ? "String_Node_Str" : "String_Node_Str")+ "String_Node_Str" : "String_Node_Str")+ "String_Node_Str"+ branchInfo.getName()+ "String_Node_Str"+ "String_Node_Str");
  }
  try {
    File sendFile=MMSUtils.createEntityFile(this.getClass(),ContentType.APPLICATION_JSON,refsNodes,MMSUtils.JsonBlobType.REF);
    HttpRequestBase request=MMSUtils.buildRequest(MMSUtils.HttpRequestType.POST,requestUri,sendFile,ContentType.APPLICATION_JSON);
    MMSUtils.sendMMSRequest(project,request);
  }
 catch (  IOException|URISyntaxException|ServerException e) {
    Application.getInstance().getGUILog().log("String_Node_Str" + e.getMessage());
    e.printStackTrace();
    return;
  }
  Application.getInstance().getGUILog().log("String_Node_Str" + branchInfo.getName() + "String_Node_Str");
  if (validateModel) {
    RunnableWithProgress temp=new ManualSyncRunner(Collections.singletonList(project.getPrimaryModel()),project,-1);
    ProgressStatusRunner.runWithProgressStatus(temp,"String_Node_Str",true,0);
  }
}