Program: 88407
Project: 88407
Buggy source:
@Override public void run(ProgressStatus progressStatus){
  validationSuite.getValidationRules().forEach(validationRule -> validationRule.getViolations().clear());
  LocalSyncTransactionCommitListener localSyncTransactionCommitListener=LocalSyncProjectEventListenerAdapter.getProjectMapping(project).getLocalSyncTransactionCommitListener();
  elementsToUpdate=(elementsToUpdate == null ? Collections.emptyList() : elementsToUpdate);
  elementsToDelete=(elementsToDelete == null ? Collections.emptyList() : elementsToDelete);
  if (elementsToUpdate.isEmpty() && elementsToDelete.isEmpty()) {
    Application.getInstance().getGUILog().log("String_Node_Str");
    return;
  }
  Collection<ObjectNode> elementsToNotUpdate=new ArrayList<>();
  for (  ObjectNode currentObjectNode : elementsToUpdate) {
    Element currentElement=null;
    JsonNode idValue;
    String currentId=null;
    if ((idValue=currentObjectNode.get(MDKConstants.ID_KEY)) != null && idValue.isTextual() && !(currentId=idValue.asText()).isEmpty()) {
      currentElement=Converters.getIdToElementConverter().apply(currentId,project);
    }
    if (currentElement == null && currentId == null) {
      elementsToNotUpdate.add(currentObjectNode);
      continue;
    }
    ValidationRuleViolation validationRuleViolation=getEditableValidationRuleViolation(currentElement,currentObjectNode,currentId);
    if (validationRuleViolation != null) {
      if (element != null && !element.isEditable()) {
        validationRuleViolation.addAction(new LockAction(element,false));
        validationRuleViolation.addAction(new LockAction(element,true));
      }
      addUpdateElementActions(validationRuleViolation,currentElement,currentId,currentObjectNode);
      editableValidationRule.addViolation(validationRuleViolation);
      failedChangelog.addChange(currentId,currentObjectNode,(currentElement != null && !project.isDisposed(currentElement) ? Changelog.ChangeType.UPDATED : Changelog.ChangeType.CREATED));
      elementsToNotUpdate.add(currentObjectNode);
    }
  }
  elementsToUpdate.removeAll(elementsToNotUpdate);
  boolean initialAutoNumbering=Application.getInstance().getProject().getOptions().isAutoNumbering();
  Application.getInstance().getProject().getOptions().setAutoNumbering(false);
  if (localSyncTransactionCommitListener != null) {
    localSyncTransactionCommitListener.setDisabled(true);
  }
  try {
    if (!elementsToUpdate.isEmpty()) {
      Application.getInstance().getGUILog().log("String_Node_Str" + NumberFormat.getInstance().format(elementsToUpdate.size()) + "String_Node_Str"+ (elementsToUpdate.size() != 1 ? "String_Node_Str" : "String_Node_Str")+ "String_Node_Str");
    }
    EMFBulkImporter emfBulkImporter=new EMFBulkImporter(NAME){
      @Override public void onSuccess(){
        if (!elementsToDelete.isEmpty()) {
          Application.getInstance().getGUILog().log("String_Node_Str" + NumberFormat.getInstance().format(elementsToDelete.size()) + "String_Node_Str"+ (elementsToDelete.size() != 1 ? "String_Node_Str" : "String_Node_Str")+ "String_Node_Str");
        }
        if (!SessionManager.getInstance().isSessionCreated(project)) {
          SessionManager.getInstance().createSession(project,UpdateClientElementAction.class.getName() + "String_Node_Str");
        }
        for (        String id : elementsToDelete) {
          Exception exception=null;
          Element element=Converters.getIdToElementConverter().apply(id,project);
          if (element == null) {
            continue;
          }
          ValidationRuleViolation validationRuleViolation=getEditableValidationRuleViolation(element,null,id);
          if (validationRuleViolation != null) {
            addUpdateElementActions(validationRuleViolation,element,id,null);
            editableValidationRule.addViolation(validationRuleViolation);
            failedChangelog.addChange(id,null,Changelog.ChangeType.DELETED);
            continue;
          }
          try {
            Command command=RemoveCommandCreator.getCommand(element);
            command.execute();
            MacroCommand macroCommand=CommandHistory.getCommandForAppend(element);
            macroCommand.add(command);
          }
 catch (          RuntimeException e) {
            exception=e;
          }
          if (exception == null) {
            successfulChangeValidationRule.addViolation(project.getPrimaryModel(),"String_Node_Str" + Changelog.ChangeType.DELETED.name() + "String_Node_Str"+ element.getHumanName());
          }
 else {
            validationRuleViolation=new ValidationRuleViolation(element,"String_Node_Str" + exception.getMessage());
            addUpdateElementActions(validationRuleViolation,element,id,null);
            failedChangeValidationRule.addViolation(validationRuleViolation);
            failedChangelog.addChange(id,null,Changelog.ChangeType.DELETED);
          }
        }
        if (SessionManager.getInstance().isSessionCreated(project)) {
          SessionManager.getInstance().closeSession(project);
        }
      }
      @Override public void onFailure(){
        onSuccess();
      }
    }
;
    Changelog<String,Pair<Element,ObjectNode>> changelog=emfBulkImporter.apply(elementsToUpdate,project,progressStatus);
    for (    Map.Entry<Pair<Element,ObjectNode>,Exception> entry : emfBulkImporter.getFailedElementMap().entrySet()) {
      Element element=entry.getKey().getKey();
      ObjectNode objectNode=entry.getKey().getValue();
      Exception exception=entry.getValue();
      JsonNode sysmlIdJsonNode=objectNode.get(MDKConstants.ID_KEY);
      if (sysmlIdJsonNode == null || !sysmlIdJsonNode.isTextual()) {
        continue;
      }
      String sysmlId=sysmlIdJsonNode.asText();
      String name=null;
      if (element == null || Project.isElementDisposed(element)) {
        JsonNode nameJsonNode=objectNode.get(MDKConstants.NAME_KEY);
        if (nameJsonNode != null && nameJsonNode.isTextual()) {
          name=nameJsonNode.asText("String_Node_Str");
        }
        if (name == null || name.isEmpty()) {
          name="String_Node_Str";
        }
      }
      ValidationRuleViolation validationRuleViolation=new ValidationRuleViolation(element != null && !Project.isElementDisposed(element) ? element : project.getPrimaryModel(),"String_Node_Str" + (element != null && !Project.isElementDisposed(element) ? "String_Node_Str" : "String_Node_Str") + "String_Node_Str"+ (element == null || Project.isElementDisposed(element) ? "String_Node_Str" + objectNode.get(MDKConstants.TYPE_KEY).asText("String_Node_Str") + "String_Node_Str"+ name+ "String_Node_Str"+ sysmlId : "String_Node_Str")+ ((element == null || Project.isElementDisposed(element)) && exception != null ? "String_Node_Str" : "String_Node_Str")+ (exception != null ? "String_Node_Str" + (exception instanceof ReadOnlyElementException ? "String_Node_Str" : exception.getMessage()) : "String_Node_Str"));
      ActionsCategory copyActionsCategory=new ActionsCategory("String_Node_Str","String_Node_Str");
      addUpdateElementActions(validationRuleViolation,element,sysmlId,objectNode);
      (exception instanceof ReadOnlyElementException ? editableValidationRule : failedChangeValidationRule).addViolation(validationRuleViolation);
      failedChangelog.addChange(sysmlId,objectNode,element != null && !Project.isElementDisposed(element) ? Changelog.ChangeType.UPDATED : Changelog.ChangeType.CREATED);
    }
    for (    Map.Entry<Element,ObjectNode> entry : emfBulkImporter.getNonEquivalentElements().entrySet()) {
      Element element=entry.getKey();
      String sysmlId=element.getLocalID();
      ObjectNode clientElementObjectNode=Converters.getElementToJsonConverter().apply(element,project);
      ObjectNode serverElementObjectNode=entry.getValue();
      JsonNode diff=JsonPatchFunction.getInstance().apply(clientElementObjectNode,serverElementObjectNode);
      ValidationRuleViolation validationRuleViolation=new ValidationRuleViolation(entry.getKey(),"String_Node_Str");
      ActionsCategory copyActionsCategory=new ActionsCategory("String_Node_Str","String_Node_Str");
      copyActionsCategory.setNested(true);
      validationRuleViolation.addAction(copyActionsCategory);
      copyActionsCategory.addAction(new ClipboardAction("String_Node_Str",sysmlId));
      copyActionsCategory.addAction(new ClipboardAction("String_Node_Str","String_Node_Str" + element.getLocalID()));
      try {
        copyActionsCategory.addAction(new ClipboardAction("String_Node_Str",JacksonUtils.getObjectMapper().writerWithDefaultPrettyPrinter().writeValueAsString(clientElementObjectNode)));
      }
 catch (      JsonProcessingException ignored) {
      }
      try {
        copyActionsCategory.addAction(new ClipboardAction("String_Node_Str",JacksonUtils.getObjectMapper().writerWithDefaultPrettyPrinter().writeValueAsString(serverElementObjectNode)));
      }
 catch (      JsonProcessingException ignored) {
      }
      try {
        copyActionsCategory.addAction(new ClipboardAction("String_Node_Str",JacksonUtils.getObjectMapper().writerWithDefaultPrettyPrinter().writeValueAsString(diff)));
      }
 catch (      JsonProcessingException ignored) {
      }
      equivalentElementValidationRule.addViolation(validationRuleViolation);
    }
    for (    Changelog.ChangeType changeType : Changelog.ChangeType.values()) {
      for (      Map.Entry<String,Pair<Element,ObjectNode>> entry : changelog.get(changeType).entrySet()) {
        Element successElement=entry.getValue().getKey();
        successfulChangeValidationRule.addViolation(new ValidationRuleViolation(successElement,"String_Node_Str" + SyncElement.Type.MMS.name() + "String_Node_Str"+ changeType.name()+ "String_Node_Str"+ SyncElement.Type.LOCAL.name()+ "String_Node_Str"));
        successfulChangelog.addChange(successElement.getLocalID(),null,changeType);
      }
    }
  }
  finally {
    Application.getInstance().getProject().getOptions().setAutoNumbering(initialAutoNumbering);
    if (localSyncTransactionCommitListener != null) {
      localSyncTransactionCommitListener.setDisabled(false);
    }
  }
  if (validationSuite.hasErrors()) {
    Utils.displayValidationWindow(project,validationSuite,validationSuite.getName());
  }
}

Fixed version (ground truth):
@Override public void run(ProgressStatus progressStatus){
  validationSuite.getValidationRules().forEach(validationRule -> validationRule.getViolations().clear());
  LocalSyncTransactionCommitListener localSyncTransactionCommitListener=LocalSyncProjectEventListenerAdapter.getProjectMapping(project).getLocalSyncTransactionCommitListener();
  elementsToUpdate=(elementsToUpdate == null ? Collections.emptyList() : elementsToUpdate);
  elementsToDelete=(elementsToDelete == null ? Collections.emptyList() : elementsToDelete);
  if (elementsToUpdate.isEmpty() && elementsToDelete.isEmpty()) {
    Application.getInstance().getGUILog().log("String_Node_Str");
    return;
  }
  Collection<ObjectNode> elementsToNotUpdate=new ArrayList<>();
  for (  ObjectNode currentObjectNode : elementsToUpdate) {
    Element currentElement=null;
    JsonNode idValue;
    String currentId=null;
    if ((idValue=currentObjectNode.get(MDKConstants.ID_KEY)) != null && idValue.isTextual() && !(currentId=idValue.asText()).isEmpty()) {
      currentElement=Converters.getIdToElementConverter().apply(currentId,project);
    }
    if (currentElement == null && currentId == null) {
      elementsToNotUpdate.add(currentObjectNode);
      continue;
    }
    ValidationRuleViolation validationRuleViolation=getEditableValidationRuleViolation(currentElement,currentObjectNode,currentId);
    if (validationRuleViolation != null) {
      if (element != null && !element.isEditable()) {
        validationRuleViolation.addAction(new LockAction(element,false));
        validationRuleViolation.addAction(new LockAction(element,true));
      }
      addUpdateElementActions(validationRuleViolation,currentElement,currentId,currentObjectNode);
      editableValidationRule.addViolation(validationRuleViolation);
      failedChangelog.addChange(currentId,currentObjectNode,(currentElement != null && !project.isDisposed(currentElement) ? Changelog.ChangeType.UPDATED : Changelog.ChangeType.CREATED));
      elementsToNotUpdate.add(currentObjectNode);
    }
  }
  elementsToUpdate.removeAll(elementsToNotUpdate);
  boolean initialAutoNumbering=Application.getInstance().getProject().getOptions().isAutoNumbering();
  Application.getInstance().getProject().getOptions().setAutoNumbering(false);
  if (localSyncTransactionCommitListener != null) {
    localSyncTransactionCommitListener.setDisabled(true);
  }
  try {
    if (!elementsToUpdate.isEmpty()) {
      Application.getInstance().getGUILog().log("String_Node_Str" + NumberFormat.getInstance().format(elementsToUpdate.size()) + "String_Node_Str"+ (elementsToUpdate.size() != 1 ? "String_Node_Str" : "String_Node_Str")+ "String_Node_Str");
    }
    EMFBulkImporter emfBulkImporter=new EMFBulkImporter(NAME){
      @Override public void onSuccess(){
        if (!elementsToDelete.isEmpty()) {
          Application.getInstance().getGUILog().log("String_Node_Str" + NumberFormat.getInstance().format(elementsToDelete.size()) + "String_Node_Str"+ (elementsToDelete.size() != 1 ? "String_Node_Str" : "String_Node_Str")+ "String_Node_Str");
        }
        if (!SessionManager.getInstance().isSessionCreated(project)) {
          SessionManager.getInstance().createSession(project,UpdateClientElementAction.class.getName() + "String_Node_Str");
        }
        for (        String id : elementsToDelete) {
          Exception exception=null;
          Element element=Converters.getIdToElementConverter().apply(id,project);
          if (element == null) {
            continue;
          }
          ValidationRuleViolation validationRuleViolation=getEditableValidationRuleViolation(element,null,id);
          if (validationRuleViolation != null) {
            addUpdateElementActions(validationRuleViolation,element,id,null);
            editableValidationRule.addViolation(validationRuleViolation);
            failedChangelog.addChange(id,null,Changelog.ChangeType.DELETED);
            continue;
          }
          try {
            Command command=RemoveCommandCreator.getCommand(element);
            command.execute();
            MacroCommand macroCommand=CommandHistory.getCommandForAppend(element);
            macroCommand.add(command);
          }
 catch (          RuntimeException e) {
            exception=e;
          }
          if (exception == null) {
            successfulChangeValidationRule.addViolation(project.getPrimaryModel(),"String_Node_Str" + Changelog.ChangeType.DELETED.name() + "String_Node_Str"+ element.getHumanName());
          }
 else {
            validationRuleViolation=new ValidationRuleViolation(element,"String_Node_Str" + exception.getMessage());
            addUpdateElementActions(validationRuleViolation,element,id,null);
            failedChangeValidationRule.addViolation(validationRuleViolation);
            failedChangelog.addChange(id,null,Changelog.ChangeType.DELETED);
          }
        }
        if (SessionManager.getInstance().isSessionCreated(project)) {
          SessionManager.getInstance().closeSession(project);
        }
      }
      @Override public void onFailure(){
        onSuccess();
      }
    }
;
    Changelog<String,Pair<Element,ObjectNode>> changelog=emfBulkImporter.apply(elementsToUpdate,project,progressStatus);
    for (    Map.Entry<Pair<Element,ObjectNode>,Exception> entry : emfBulkImporter.getFailedElementMap().entrySet()) {
      Element entryElement=entry.getKey().getKey();
      ObjectNode entryObjectNode=entry.getKey().getValue();
      Exception entryException=entry.getValue();
      JsonNode sysmlIdJsonNode=entryObjectNode.get(MDKConstants.ID_KEY);
      if (sysmlIdJsonNode == null || !sysmlIdJsonNode.isTextual()) {
        continue;
      }
      String entryId=sysmlIdJsonNode.asText();
      String name=null;
      if (entryElement == null || Project.isElementDisposed(entryElement)) {
        JsonNode nameJsonNode=entryObjectNode.get(MDKConstants.NAME_KEY);
        if (nameJsonNode != null && nameJsonNode.isTextual()) {
          name=nameJsonNode.asText("String_Node_Str");
        }
        if (name == null || name.isEmpty()) {
          name="String_Node_Str";
        }
      }
      ValidationRuleViolation validationRuleViolation=new ValidationRuleViolation(entryElement != null && !Project.isElementDisposed(entryElement) ? entryElement : project.getPrimaryModel(),"String_Node_Str" + (entryElement != null && !Project.isElementDisposed(entryElement) ? "String_Node_Str" : "String_Node_Str") + "String_Node_Str"+ (entryElement == null || Project.isElementDisposed(entryElement) ? "String_Node_Str" + entryObjectNode.get(MDKConstants.TYPE_KEY).asText("String_Node_Str") + "String_Node_Str"+ name+ "String_Node_Str"+ entryId : "String_Node_Str")+ ((entryElement == null || Project.isElementDisposed(entryElement)) && entryException != null ? "String_Node_Str" : "String_Node_Str")+ (entryException != null ? "String_Node_Str" + (entryException instanceof ReadOnlyElementException ? "String_Node_Str" : entryException.getMessage()) : "String_Node_Str"));
      addUpdateElementActions(validationRuleViolation,entryElement,entryId,entryObjectNode);
      (entryException instanceof ReadOnlyElementException ? editableValidationRule : failedChangeValidationRule).addViolation(validationRuleViolation);
      failedChangelog.addChange(entryId,entryObjectNode,entryElement != null && !Project.isElementDisposed(entryElement) ? Changelog.ChangeType.UPDATED : Changelog.ChangeType.CREATED);
    }
    for (    Map.Entry<Element,ObjectNode> entry : emfBulkImporter.getNonEquivalentElements().entrySet()) {
      Element entryElement=entry.getKey();
      String entryId=entryElement.getLocalID();
      ObjectNode entryClientElementObjectNode=Converters.getElementToJsonConverter().apply(entryElement,project);
      ObjectNode entryServerElementObjectNode=entry.getValue();
      JsonNode diff=JsonPatchFunction.getInstance().apply(entryClientElementObjectNode,entryServerElementObjectNode);
      ValidationRuleViolation validationRuleViolation=new ValidationRuleViolation(entry.getKey(),"String_Node_Str");
      ActionsCategory copyActionsCategory=new ActionsCategory("String_Node_Str","String_Node_Str");
      copyActionsCategory.setNested(true);
      validationRuleViolation.addAction(copyActionsCategory);
      copyActionsCategory.addAction(new ClipboardAction("String_Node_Str",entryId));
      copyActionsCategory.addAction(new ClipboardAction("String_Node_Str","String_Node_Str" + entryElement.getLocalID()));
      try {
        copyActionsCategory.addAction(new ClipboardAction("String_Node_Str",JacksonUtils.getObjectMapper().writerWithDefaultPrettyPrinter().writeValueAsString(entryClientElementObjectNode)));
      }
 catch (      JsonProcessingException ignored) {
      }
      try {
        copyActionsCategory.addAction(new ClipboardAction("String_Node_Str",JacksonUtils.getObjectMapper().writerWithDefaultPrettyPrinter().writeValueAsString(entryServerElementObjectNode)));
      }
 catch (      JsonProcessingException ignored) {
      }
      try {
        copyActionsCategory.addAction(new ClipboardAction("String_Node_Str",JacksonUtils.getObjectMapper().writerWithDefaultPrettyPrinter().writeValueAsString(diff)));
      }
 catch (      JsonProcessingException ignored) {
      }
      equivalentElementValidationRule.addViolation(validationRuleViolation);
    }
    for (    Changelog.ChangeType changeType : Changelog.ChangeType.values()) {
      for (      Map.Entry<String,Pair<Element,ObjectNode>> entry : changelog.get(changeType).entrySet()) {
        Element successElement=entry.getValue().getKey();
        successfulChangeValidationRule.addViolation(new ValidationRuleViolation(successElement,"String_Node_Str" + SyncElement.Type.MMS.name() + "String_Node_Str"+ changeType.name()+ "String_Node_Str"+ SyncElement.Type.LOCAL.name()+ "String_Node_Str"));
        successfulChangelog.addChange(successElement.getLocalID(),null,changeType);
      }
    }
  }
  finally {
    Application.getInstance().getProject().getOptions().setAutoNumbering(initialAutoNumbering);
    if (localSyncTransactionCommitListener != null) {
      localSyncTransactionCommitListener.setDisabled(false);
    }
  }
  if (validationSuite.hasErrors()) {
    Utils.displayValidationWindow(project,validationSuite,validationSuite.getName());
  }
}