nus-yam/ex-repair huggingface dataset:
Program: 88456
Project: 88456
Buggy source:
@SuppressWarnings("String_Node_Str") @Override public void visit(DBTable table){
  DBAlfrescoTableVisitor v=new DBAlfrescoTableVisitor(this.recurse);
  table.accept(v);
  curContains.peek().add(v.getObject());
  viewElements.peek().addAll(v.getTableElements());
  elementSet.addAll(v.getElementSet());
  if (!main) {
    return;
  }
  InstanceSpecification i=null;
  if (!currentTableInstances.peek().isEmpty()) {
    i=currentTableInstances.peek().remove(0);
    currentInstanceList.peek().remove(0);
  }
  PresentationElementInstance parentSec=currentSection.isEmpty() ? null : currentSection.peek();
  PresentationElementInstance ipe=new PresentationElementInstance(i,v.getObject(),PresentationElementEnum.TABLE,currentView.peek(),table.getTitle() != null ? table.getTitle() : "String_Node_Str",parentSec,null);
  newpe.peek().add(ipe);
}

Fixed version (ground truth):
@SuppressWarnings("String_Node_Str") @Override public void visit(DBTable table){
  DBAlfrescoTableVisitor v=new DBAlfrescoTableVisitor(this.recurse);
  table.accept(v);
  viewElements.peek().addAll(v.getTableElements());
  elementSet.addAll(v.getElementSet());
  if (!main) {
    return;
  }
  InstanceSpecification i=null;
  if (!currentTableInstances.peek().isEmpty()) {
    i=currentTableInstances.peek().remove(0);
    currentInstanceList.peek().remove(0);
  }
  PresentationElementInstance parentSec=currentSection.isEmpty() ? null : currentSection.peek();
  PresentationElementInstance ipe=new PresentationElementInstance(i,v.getObject(),PresentationElementEnum.TABLE,currentView.peek(),table.getTitle() != null ? table.getTitle() : "String_Node_Str",parentSec,null);
  newpe.peek().add(ipe);
}
Program: 88458
Project: 88458
Buggy source:
public static String getMmsOrg(Project project) throws IOException, URISyntaxException, ServerException {
  URIBuilder uriBuilder=getServiceProjectsUri(project);
  File responseFile=sendMMSRequest(project,buildRequest(HttpRequestType.GET,uriBuilder));
  try (JsonParser responseParser=JacksonUtils.getJsonFactory().createParser(responseFile)){
    ObjectNode response=JacksonUtils.parseJsonObject(responseParser);
    JsonNode arrayNode;
    if (((arrayNode=response.get("String_Node_Str")) != null) && arrayNode.isArray()) {
      JsonNode value;
      for (      JsonNode projectNode : arrayNode) {
        if (((value=projectNode.get(MDKConstants.ID_KEY)) != null) && value.isTextual() && value.asText().equals(Converters.getIProjectToIdConverter().apply(project.getPrimaryProject()))&& ((value=projectNode.get(MDKConstants.ORG_ID_KEY)) != null)&& value.isTextual()&& !value.asText().isEmpty()) {
          return value.asText();
        }
      }
    }
  }
   return null;
}

Fixed version (ground truth):
public static String getMmsOrg(Project project) throws IOException, URISyntaxException, ServerException {
  URIBuilder uriBuilder=getServiceProjectsUri(project);
  File responseFile=sendMMSRequest(project,buildRequest(HttpRequestType.GET,uriBuilder));
  try (JsonParser responseParser=JacksonUtils.getJsonFactory().createParser(responseFile)){
    ObjectNode response=JacksonUtils.parseJsonObject(responseParser);
    JsonNode arrayNode;
    if (((arrayNode=response.get("String_Node_Str")) != null) && arrayNode.isArray()) {
      JsonNode projectId, orgId;
      for (      JsonNode projectNode : arrayNode) {
        if (((projectId=projectNode.get(MDKConstants.ID_KEY)) != null) && projectId.isTextual() && projectId.asText().equals(Converters.getIProjectToIdConverter().apply(project.getPrimaryProject()))&& ((orgId=projectNode.get(MDKConstants.ORG_ID_KEY)) != null)&& orgId.isTextual()&& !orgId.asText().isEmpty()) {
          return orgId.asText();
        }
      }
    }
  }
   return null;
}
Program: 88460
Project: 88460
Buggy source:
public CommitProjectAction(Project project,boolean shouldCommitModel,boolean isDeveloperAction){
  super(shouldCommitModel ? COMMIT_MODEL_DEFAULT_ID : DEFAULT_ID,"String_Node_Str" + (shouldCommitModel ? "String_Node_Str" : "String_Node_Str") + (isDeveloperAction ? "String_Node_Str" : "String_Node_Str"),null,null);
  this.project=project;
  this.shouldCommitModel=shouldCommitModel;
}

Fixed version (ground truth):
public CommitProjectAction(Project project,boolean shouldCommitModel,boolean isDeveloperAction){
  super(shouldCommitModel ? COMMIT_MODEL_DEFAULT_ID : DEFAULT_ID,(isDeveloperAction ? "String_Node_Str" : "String_Node_Str") + "String_Node_Str" + (shouldCommitModel ? "String_Node_Str" : "String_Node_Str"),null,null);
  this.project=project;
  this.shouldCommitModel=shouldCommitModel;
}
Program: 88463
Project: 88463
Buggy source:
public static Collection<Element> getElementsById(Collection<String> elementIds,Project project,ProgressStatus progressStatus) throws IOException, ServerException, URISyntaxException {
  if (elementIds == null || elementIds.isEmpty()) {
    return null;
  }
  final ObjectNode requests=JacksonUtils.getObjectMapper().createObjectNode();
  File sendData=MMSUtils.createEntityFile(MDKHelper.class,ContentType.APPLICATION_JSON,elementIds,MMSUtils.JsonBlobType.ELEMENT_ID);
  URIBuilder requestUri=MMSUtils.getServiceProjectsRefsElementsUri(project);
  if (requestUri == null) {
    return null;
  }
  Utils.guilog("String_Node_Str" + elementIds.size() + "String_Node_Str");
  File responseFile;
  if (progressStatus != null) {
    responseFile=MMSUtils.sendCancellableMMSRequest(project,MMSUtils.buildRequest(MMSUtils.HttpRequestType.GET,requestUri,sendData,ContentType.APPLICATION_JSON),progressStatus);
  }
 else {
    responseFile=MMSUtils.sendMMSRequest(project,MMSUtils.buildRequest(MMSUtils.HttpRequestType.GET,requestUri,sendData,ContentType.APPLICATION_JSON));
  }
  LinkedList<Element> elementsList=new LinkedList<>();
  try (JsonParser jsonParser=JacksonUtils.getJsonFactory().createParser(responseFile)){
    for (    ObjectNode elementJson : JacksonUtils.parseJsonResponseToObjectList(jsonParser,null)) {
      JsonNode value;
      if ((value=elementJson.get(MDKConstants.ID_KEY)) != null && value.isTextual()) {
        elementsList.add(Converters.getIdToElementConverter().apply(value.asText(),project));
      }
    }
  }
   return elementsList;
}

Fixed version (ground truth):
public static Collection<Element> getElementsById(Collection<String> elementIds,Project project,ProgressStatus progressStatus) throws IOException, ServerException, URISyntaxException {
  if (elementIds == null || elementIds.isEmpty()) {
    return null;
  }
  final ObjectNode requests=JacksonUtils.getObjectMapper().createObjectNode();
  File sendData=MMSUtils.createEntityFile(MDKHelper.class,ContentType.APPLICATION_JSON,elementIds,MMSUtils.JsonBlobType.ELEMENT_ID);
  URIBuilder requestUri=MMSUtils.getServiceProjectsRefsElementsUri(project);
  if (requestUri == null) {
    return null;
  }
  Utils.guilog("String_Node_Str" + elementIds.size() + "String_Node_Str");
  File responseFile;
  if (progressStatus != null) {
    responseFile=MMSUtils.sendMMSRequest(project,MMSUtils.buildRequest(MMSUtils.HttpRequestType.GET,requestUri,sendData,ContentType.APPLICATION_JSON),progressStatus);
  }
 else {
    responseFile=MMSUtils.sendMMSRequest(project,MMSUtils.buildRequest(MMSUtils.HttpRequestType.GET,requestUri,sendData,ContentType.APPLICATION_JSON));
  }
  LinkedList<Element> elementsList=new LinkedList<>();
  try (JsonParser jsonParser=JacksonUtils.getJsonFactory().createParser(responseFile)){
    for (    ObjectNode elementJson : JacksonUtils.parseJsonResponseToObjectList(jsonParser,null)) {
      JsonNode value;
      if ((value=elementJson.get(MDKConstants.ID_KEY)) != null && value.isTextual()) {
        elementsList.add(Converters.getIdToElementConverter().apply(value.asText(),project));
      }
    }
  }
   return elementsList;
}
Program: 88464
Project: 88464
Buggy source:
public static String validateCredentials(Project project,String ticket) throws ServerException, IOException, URISyntaxException {
  URIBuilder requestUri=MMSUtils.getServiceUri(project);
  if (requestUri == null) {
    return "String_Node_Str";
  }
  requestUri.setPath(requestUri.getPath() + "String_Node_Str" + ticket);
  requestUri.clearParameters();
  URI requestDest=requestUri.build();
  HttpRequestBase request=new HttpGet(requestDest);
  System.out.println("String_Node_Str" + requestUri.toString());
  String responseBody;
  int responseCode;
  try (CloseableHttpClient httpclient=HttpClients.createDefault();CloseableHttpResponse response=httpclient.execute(request);InputStream inputStream=response.getEntity().getContent()){
    responseCode=response.getStatusLine().getStatusCode();
    System.out.println("String_Node_Str" + requestUri.toString() + "String_Node_Str"+ responseCode);
    responseBody=((inputStream != null) ? IOUtils.toString(inputStream) : "String_Node_Str");
  }
   try (ByteArrayInputStream byteArrayInputStream=new ByteArrayInputStream(responseBody.getBytes())){
    if (!processResponse(responseCode,byteArrayInputStream,project)) {
      throw new ServerException("String_Node_Str",responseCode);
    }
  }
   ObjectNode responseJson=JacksonUtils.getObjectMapper().readValue(responseBody,ObjectNode.class);
  JsonNode value;
  if (responseJson != null && (value=responseJson.get("String_Node_Str")) != null && value.isTextual() && !value.asText().isEmpty()) {
    return value.asText();
  }
  return "String_Node_Str";
}

Fixed version (ground truth):
public static String validateCredentials(Project project,String ticket,ProgressStatus progressStatus) throws ServerException, IOException, URISyntaxException {
  URIBuilder requestUri=MMSUtils.getServiceUri(project);
  if (requestUri == null) {
    return "String_Node_Str";
  }
  requestUri.setPath(requestUri.getPath() + "String_Node_Str" + ticket);
  requestUri.clearParameters();
  URI requestDest=requestUri.build();
  HttpRequestBase request=new HttpGet(requestDest);
  ObjectNode responseJson=JacksonUtils.getObjectMapper().createObjectNode();
  sendMMSRequest(project,request,progressStatus,responseJson);
  JsonNode value;
  if (responseJson != null && (value=responseJson.get("String_Node_Str")) != null && value.isTextual() && !value.asText().isEmpty()) {
    return value.asText();
  }
  return "String_Node_Str";
}
Program: 88465
Project: 88465
Buggy source:
/** 
 * @param elementIds     collection of elements to get mms data for
 * @param depth          depth to recurse through child elements. takes priority over recurse field
 * @param project        project to check
 * @param progressStatus progress status object, can be null
 * @return object node response
 * @throws ServerException
 * @throws IOException
 * @throws URISyntaxException
 */
public static File getElementsRecursively(Project project,Collection<String> elementIds,int depth,ProgressStatus progressStatus) throws ServerException, IOException, URISyntaxException {
  if (elementIds == null || elementIds.isEmpty()) {
    return null;
  }
  URIBuilder requestUri=getServiceProjectsRefsElementsUri(project);
  if (requestUri == null) {
    return null;
  }
  if (depth == -1 || depth > 0) {
    requestUri.setParameter("String_Node_Str",java.lang.Integer.toString(depth));
  }
  File sendData=createEntityFile(MMSUtils.class,ContentType.APPLICATION_JSON,elementIds,JsonBlobType.ELEMENT_ID);
  Utils.guilog("String_Node_Str" + elementIds.size() + "String_Node_Str");
  if (progressStatus != null) {
    return sendCancellableMMSRequest(project,MMSUtils.buildRequest(MMSUtils.HttpRequestType.PUT,requestUri,sendData,ContentType.APPLICATION_JSON),progressStatus);
  }
  return sendMMSRequest(project,MMSUtils.buildRequest(MMSUtils.HttpRequestType.PUT,requestUri,sendData,ContentType.APPLICATION_JSON));
}

Fixed version (ground truth):
/** 
 * @param elementIds     collection of elements to get mms data for
 * @param depth          depth to recurse through child elements. takes priority over recurse field
 * @param project        project to check
 * @param progressStatus progress status object, can be null
 * @return object node response
 * @throws ServerException
 * @throws IOException
 * @throws URISyntaxException
 */
public static File getElementsRecursively(Project project,Collection<String> elementIds,int depth,ProgressStatus progressStatus) throws ServerException, IOException, URISyntaxException {
  if (elementIds == null || elementIds.isEmpty()) {
    return null;
  }
  URIBuilder requestUri=getServiceProjectsRefsElementsUri(project);
  if (requestUri == null) {
    return null;
  }
  if (depth == -1 || depth > 0) {
    requestUri.setParameter("String_Node_Str",java.lang.Integer.toString(depth));
  }
  File sendData=createEntityFile(MMSUtils.class,ContentType.APPLICATION_JSON,elementIds,JsonBlobType.ELEMENT_ID);
  Utils.guilog("String_Node_Str" + elementIds.size() + "String_Node_Str");
  if (progressStatus != null) {
    return sendMMSRequest(project,MMSUtils.buildRequest(MMSUtils.HttpRequestType.PUT,requestUri,sendData,ContentType.APPLICATION_JSON),progressStatus);
  }
  return sendMMSRequest(project,MMSUtils.buildRequest(MMSUtils.HttpRequestType.PUT,requestUri,sendData,ContentType.APPLICATION_JSON));
}
Program: 88467
Project: 88467
Buggy source:
/** 
 * General purpose method for sending a constructed http request via http client.
 * @param request
 * @return
 * @throws IOException
 * @throws ServerException
 */
public static File sendMMSRequest(Project project,HttpRequestBase request) throws IOException, ServerException, URISyntaxException {
  File targetFile=File.createTempFile("String_Node_Str",null);
  targetFile.deleteOnExit();
  HttpEntityEnclosingRequest httpEntityEnclosingRequest=null;
  boolean logBody=MDKOptionsGroup.getMDKOptions().isLogJson();
  logBody=logBody && request instanceof HttpEntityEnclosingRequest;
  logBody=logBody && ((httpEntityEnclosingRequest=(HttpEntityEnclosingRequest)request).getEntity() != null);
  logBody=logBody && httpEntityEnclosingRequest.getEntity().isRepeatable();
  System.out.println("String_Node_Str" + request.getMethod() + "String_Node_Str"+ request.getURI().toString());
  int responseCode;
  try (CloseableHttpClient httpclient=HttpClients.createDefault();CloseableHttpResponse response=httpclient.execute(request);InputStream inputStream=response.getEntity().getContent();OutputStream outputStream=new FileOutputStream(targetFile)){
    responseCode=response.getStatusLine().getStatusCode();
    System.out.println("String_Node_Str" + request.getMethod() + "String_Node_Str"+ request.getURI().toString()+ "String_Node_Str"+ responseCode);
    System.out.println("String_Node_Str" + targetFile.getPath());
    if (inputStream != null) {
      byte[] buffer=new byte[8 * 1024];
      int bytesRead;
      while ((bytesRead=inputStream.read(buffer)) != -1) {
        outputStream.write(buffer,0,bytesRead);
      }
    }
  }
   try (FileInputStream fileInputStream=new FileInputStream(targetFile)){
    if (!processResponse(responseCode,fileInputStream,project)) {
      throw new ServerException(targetFile.getAbsolutePath(),responseCode);
    }
  }
   return targetFile;
}

Fixed version (ground truth):
public static File sendMMSRequest(Project project,HttpRequestBase request,ProgressStatus progressStatus) throws IOException, ServerException, URISyntaxException {
  return sendMMSRequest(project,request,progressStatus,null);
}
Program: 88469
Project: 88469
Buggy source:
@Override public void actionPerformed(ActionEvent e){
  Collection<Element> selectedElements=MDUtils.getSelection(e);
  if (selectedElements.isEmpty()) {
    return;
  }
  Project project=Project.getProject(selectedElements.iterator().next());
  OclEvaluator.resetEnvironment();
  constraintRule.constraintType=Type.STATIC;
  constraintRule.init(project,null);
  constraintRule.run(project,null,selectedElements);
  Utils.displayValidationWindow(project,validationOutput,"String_Node_Str");
}

Fixed version (ground truth):
@Override public void actionPerformed(ActionEvent e){
  Collection<Element> selectedElements=MDUtils.getSelection(e);
  if (selectedElements.isEmpty()) {
    return;
  }
  Project project=Project.getProject(selectedElements.iterator().next());
  constraintRule.constraintType=Type.STATIC;
  constraintRule.init(project,null);
  constraintRule.run(project,null,selectedElements);
  Utils.displayValidationWindow(project,validationOutput,"String_Node_Str");
}
Program: 88470
Project: 88470
Buggy source:
@Override public void init(Project paramProject,Constraint paramConstraint){
  Debug.outln("String_Node_Str" + paramProject + "String_Node_Str"+ paramConstraint+ "String_Node_Str");
  if (constraintElement == null) {
    constraintElement=paramConstraint;
  }
  OclEvaluator.resetEnvironment();
}

Fixed version (ground truth):
@Override public void init(Project paramProject,Constraint paramConstraint){
  Debug.outln("String_Node_Str" + paramProject + "String_Node_Str"+ paramConstraint+ "String_Node_Str");
  if (constraintElement == null) {
    constraintElement=paramConstraint;
  }
}
Program: 88471
Project: 88471
Buggy source:
@Override public Set<Annotation> run(Project paramProject,Constraint paramConstraint,Collection<? extends Element> paramCollection){
  Set<Annotation> result=new HashSet<Annotation>();
  System.out.println("String_Node_Str" + constraintType + "String_Node_Str");
  OclEvaluator.resetEnvironment();
  initConstraintMaps(paramProject,paramCollection);
  OclEvaluator.resetEnvironment();
  @SuppressWarnings("String_Node_Str") Collection<gov.nasa.jpl.mbee.mdk.constraint.Constraint> constraints=(Collection<gov.nasa.jpl.mbee.mdk.constraint.Constraint>)(Utils2.isNullOrEmpty(elementsWithConstraints) ? (constraintToElementMap == null ? Utils2.newList() : constraintToElementMap.keySet()) : getAffectedConstraints(elementsWithConstraints));
  for (  gov.nasa.jpl.mbee.mdk.constraint.Constraint constraint : constraints) {
    try {
      Boolean satisfied=DocumentValidator.evaluateConstraint(constraint,this,isLanguageOcl(constraint));
      if (loggingResults) {
        logResults(satisfied,constraint);
      }
    }
 catch (    Throwable e) {
      Debug.error(true,false,"String_Node_Str" + e.getLocalizedMessage());
      e.printStackTrace();
    }
  }
  Constraint cons=Utils.getWarningConstraint(paramProject);
  result=Utils.getAnnotations(this,paramProject,cons);
  annotations=result;
  System.out.println("String_Node_Str" + constraintType + "String_Node_Str");
  return result;
}

Fixed version (ground truth):
@Override public Set<Annotation> run(Project paramProject,Constraint paramConstraint,Collection<? extends Element> paramCollection){
  Set<Annotation> result=new HashSet<Annotation>();
  System.out.println("String_Node_Str" + constraintType + "String_Node_Str");
  initConstraintMaps(paramProject,paramCollection);
  @SuppressWarnings("String_Node_Str") Collection<gov.nasa.jpl.mbee.mdk.constraint.Constraint> constraints=(Collection<gov.nasa.jpl.mbee.mdk.constraint.Constraint>)(Utils2.isNullOrEmpty(elementsWithConstraints) ? (constraintToElementMap == null ? Utils2.newList() : constraintToElementMap.keySet()) : getAffectedConstraints(elementsWithConstraints));
  for (  gov.nasa.jpl.mbee.mdk.constraint.Constraint constraint : constraints) {
    try {
      Boolean satisfied=DocumentValidator.evaluateConstraint(constraint,this,isLanguageOcl(constraint));
      if (loggingResults) {
        logResults(satisfied,constraint);
      }
    }
 catch (    Throwable e) {
      Debug.error(true,false,"String_Node_Str" + e.getLocalizedMessage());
      e.printStackTrace();
    }
  }
  Constraint cons=Utils.getWarningConstraint(paramProject);
  result=Utils.getAnnotations(this,paramProject,cons);
  annotations=result;
  System.out.println("String_Node_Str" + constraintType + "String_Node_Str");
  return result;
}
Program: 88473
Project: 88473
Buggy source:
/** 
 * Evaluates the specified query given a particular context
 * @param context     EObject of the context that the query should be run against(e.g., self)
 * @param queryString Valid OCL string that to be evaluated in the context
 * @param verbose     Turns on OCL debugging if true, off if false
 * @return Object of the result whose type should be known by the caller
 * @throws ParserException
 */
public static Object evaluateQuery(Object context,String queryString,boolean verbose) throws ParserException {
  OclEvaluator ev=new OclEvaluator();
  instance=ev;
  resetEnvironment(false);
  ev.setupEnvironment();
  if (queryString == null) {
    return null;
  }
  ev.setOclTracingEnabled(verbose);
  ev.queryStatus=QueryStatus.VALID_OCL;
  if (context == null) {
    ev.getHelper().setContext(OCLStandardLibraryImpl.INSTANCE.getOclVoid());
  }
 else   if (context instanceof EObject) {
    ev.getHelper().setContext(((EObject)context).eClass());
  }
 else   if (context instanceof Collection) {
    ev.getHelper().setContext(OCLStandardLibraryImpl.INSTANCE.getSequence());
  }
  Object result=null;
  ev.basicDiagnostic=null;
  ev.problemHandler=null;
  result=ev.evaluateQueryNoSetup(context,queryString,verbose);
  Debug.outln("String_Node_Str" + DocGenUtils.fixString(context) + "String_Node_Str"+ queryString+ "String_Node_Str"+ verbose+ "String_Node_Str"+ DocGenUtils.fixString(result));
  return result;
}

Fixed version (ground truth):
/** 
 * Evaluates the specified query given a particular context
 * @param context     EObject of the context that the query should be run against(e.g., self)
 * @param queryString Valid OCL string that to be evaluated in the context
 * @param verbose     Turns on OCL debugging if true, off if false
 * @return Object of the result whose type should be known by the caller
 * @throws ParserException
 */
public static Object evaluateQuery(Object context,String queryString,boolean verbose) throws ParserException {
  OclEvaluator ev=new OclEvaluator();
  instance=ev;
  ev.setupEnvironment();
  if (queryString == null) {
    return null;
  }
  ev.setOclTracingEnabled(verbose);
  ev.queryStatus=QueryStatus.VALID_OCL;
  if (context == null) {
    ev.getHelper().setContext(OCLStandardLibraryImpl.INSTANCE.getOclVoid());
  }
 else   if (context instanceof EObject) {
    ev.getHelper().setContext(((EObject)context).eClass());
  }
 else   if (context instanceof Collection) {
    ev.getHelper().setContext(OCLStandardLibraryImpl.INSTANCE.getSequence());
  }
  Object result=null;
  ev.basicDiagnostic=null;
  ev.problemHandler=null;
  result=ev.evaluateQueryNoSetup(context,queryString,verbose);
  Debug.outln("String_Node_Str" + DocGenUtils.fixString(context) + "String_Node_Str"+ queryString+ "String_Node_Str"+ verbose+ "String_Node_Str"+ DocGenUtils.fixString(result));
  return result;
}
Program: 88474
Project: 88474
Buggy source:
protected DocGenEnvironmentFactory setupEnvironment(){
  resetEnvironment(false);
  addRegexMatchOperation(getEnvironmentFactory());
  addEvalOperation(getEnvironmentFactory(),"String_Node_Str");
  addEvalOperation(getEnvironmentFactory(),"String_Node_Str");
  addEvalOperation(getEnvironmentFactory(),"String_Node_Str");
  addRunOperation(getEnvironmentFactory(),OCLStandardLibraryImpl.INSTANCE.getOclAny());
  addRunOperation(getEnvironmentFactory(),OCLStandardLibraryImpl.INSTANCE.getSequence());
  addRunOperation(getEnvironmentFactory(),null);
  addGetOperation(getEnvironmentFactory());
  addLogOperation(getEnvironmentFactory(),true,false);
  addLogOperation(getEnvironmentFactory(),true,true);
  addLogOperation(getEnvironmentFactory(),false,false);
  addROperation(getEnvironmentFactory());
  addMOperation(getEnvironmentFactory());
  addTOperation(getEnvironmentFactory());
  addSOperation(getEnvironmentFactory());
  addNOperation(getEnvironmentFactory());
  addOOperation(getEnvironmentFactory());
  addVOperation(getEnvironmentFactory());
  addDefaultOperation(getEnvironmentFactory());
  addExpressionOperations(getEnvironmentFactory());
  return getEnvironmentFactory();
}

Fixed version (ground truth):
protected DocGenEnvironmentFactory setupEnvironment(){
  addRegexMatchOperation(getEnvironmentFactory());
  addEvalOperation(getEnvironmentFactory(),"String_Node_Str");
  addEvalOperation(getEnvironmentFactory(),"String_Node_Str");
  addEvalOperation(getEnvironmentFactory(),"String_Node_Str");
  addRunOperation(getEnvironmentFactory(),OCLStandardLibraryImpl.INSTANCE.getOclAny());
  addRunOperation(getEnvironmentFactory(),OCLStandardLibraryImpl.INSTANCE.getSequence());
  addRunOperation(getEnvironmentFactory(),null);
  addGetOperation(getEnvironmentFactory());
  addLogOperation(getEnvironmentFactory(),true,false);
  addLogOperation(getEnvironmentFactory(),true,true);
  addLogOperation(getEnvironmentFactory(),false,false);
  addROperation(getEnvironmentFactory());
  addMOperation(getEnvironmentFactory());
  addTOperation(getEnvironmentFactory());
  addSOperation(getEnvironmentFactory());
  addNOperation(getEnvironmentFactory());
  addOOperation(getEnvironmentFactory());
  addVOperation(getEnvironmentFactory());
  addDefaultOperation(getEnvironmentFactory());
  addExpressionOperations(getEnvironmentFactory());
  return getEnvironmentFactory();
}
Program: 88475
Project: 88475
Buggy source:
/** 
 * Find Expressions in ExpressionLibraries and add them as blackbox shortcuts.
 * @param envFactory
 */
protected static void addExpressionOperations(DocGenEnvironmentFactory envFactory){
  ArrayList<Element> exprs=new ArrayList<Element>(getExpressions());
  for (  Element expr : exprs) {
    String name=Utils.getName(expr);
    name=name.replaceAll("String_Node_Str","String_Node_Str");
    String exprString=queryElementToStringExpression(expr);
    String errorMsg=null;
    if (!Utils2.isNullOrEmpty(name) && errorMsg == null) {
      try {
        addExpressionOperation(name,exprString,envFactory);
      }
 catch (      Throwable e) {
        errorMsg=e.getLocalizedMessage();
      }
    }
    if (errorMsg != null) {
      Debug.error(true,false,"String_Node_Str" + name + "String_Node_Str"+ exprString+ "String_Node_Str"+ errorMsg);
    }
  }
}

Fixed version (ground truth):
/** 
 * Find Expressions in model and add them as blackbox shortcuts. ExpressionLibraries are retained
 * @param envFactory
 */
protected static void addExpressionOperations(DocGenEnvironmentFactory envFactory){
  List<Element> expressions=StereotypesHelper.getExtendedElements(Utils.getExpressionStereotype(Application.getInstance().getProject()));
  for (  Element expression : expressions) {
    String name=Utils.getName(expression);
    name=name.replaceAll("String_Node_Str","String_Node_Str");
    String exprString=queryElementToStringExpression(expression);
    if (!Utils2.isNullOrEmpty(name)) {
      try {
        addExpressionOperation(name,exprString,envFactory);
      }
 catch (      Throwable e) {
        Debug.error(true,false,"String_Node_Str" + name + "String_Node_Str"+ exprString+ "String_Node_Str"+ e.getLocalizedMessage());
      }
    }
  }
}
Program: 88476
Project: 88476
Buggy source:
@Override public void actionPerformed(ActionEvent e){
  OclEvaluator.resetEnvironment();
  Window owner=null;
  try {
    owner=Application.getInstance().getMainFrame();
  }
 catch (  Throwable t) {
    t.printStackTrace();
  }
  try {
    if (dialog == null) {
      dialog=new OclQueryDialog(owner,"String_Node_Str");
    }
    dialog.diagramCB.setSelected(true);
    dialog.browserCB.setSelected(true);
    dialog.getEditableListPanel().setResult("String_Node_Str");
    dialog.setVisible(true);
  }
 catch (  Throwable t) {
    t.printStackTrace();
  }
}

Fixed version (ground truth):
@Override public void actionPerformed(ActionEvent e){
  Window owner=null;
  try {
    owner=Application.getInstance().getMainFrame();
  }
 catch (  Throwable t) {
    t.printStackTrace();
  }
  try {
    if (dialog == null) {
      dialog=new OclQueryDialog(owner,"String_Node_Str");
    }
    dialog.diagramCB.setSelected(true);
    dialog.browserCB.setSelected(true);
    dialog.getEditableListPanel().setResult("String_Node_Str");
    dialog.setVisible(true);
  }
 catch (  Throwable t) {
    t.printStackTrace();
  }
}
Program: 88478
Project: 88478
Buggy source:
/** 
 * Executes "Validate Model" on model root
 */
public static void manualValidateModel(){
  manualValidateElement(ElementFinder.getModelRoot());
}

Fixed version (ground truth):
/** 
 * Executes "Validate Model" on model root
 */
public static void manualValidateModel(){
  manualValidateModel(ElementFinder.getModelRoot());
}
Program: 88479
Project: 88479
Buggy source:
/** 
 * Executes "Validate Model" on specified element
 * @param validateTarget element that the validation is to be performed upon
 */
public static void manualValidateElement(Element validateTarget){
  Collection<Element> sync=new ArrayList<>();
  sync.add(validateTarget);
  ManualSyncRunner manualSyncRunner=new ManualSyncRunner(sync,Application.getInstance().getProject(),-1);
  ProgressStatusRunner.runWithProgressStatus(manualSyncRunner,"String_Node_Str",true,0);
  Application.getInstance().getGUILog().log("String_Node_Str");
  validationWindow=new MDKValidationWindow(manualSyncRunner.getValidationSuite());
}

Fixed version (ground truth):
/** 
 * Executes "Validate Element" on specified element
 * @param validateTarget element that the validation is to be performed upon
 */
public static void manualValidateElement(Element validateTarget){
  Collection<Element> sync=new ArrayList<>();
  sync.add(validateTarget);
  ManualSyncRunner manualSyncRunner=new ManualSyncRunner(sync,Application.getInstance().getProject(),0);
  ProgressStatusRunner.runWithProgressStatus(manualSyncRunner,"String_Node_Str",true,0);
  Application.getInstance().getGUILog().log("String_Node_Str");
  validationWindow=new MDKValidationWindow(manualSyncRunner.getValidationSuite());
}
Program: 88483
Project: 88483
Buggy source:
public void update(){
  data.clear();
  final Iterator<Request> it=OutputQueue.getInstance().iterator();
  Request current=OutputQueue.getInstance().getCurrent();
  int counter=1;
  if (current != null) {
    final Vector<Object> row=new Vector<Object>();
    row.addElement(0);
    row.addElement(current.getRequest().getMethod());
    row.addElement(NumberFormat.getInstance().format(current.getCount()));
    row.addElement(current.getName());
    row.addElement(current.getRequest().getURI().toString());
    row.addElement("String_Node_Str");
    data.addElement(row);
  }
  while (it.hasNext()) {
    final Request r=it.next();
    if (r == null) {
      break;
    }
    final Vector<Object> row=new Vector<Object>();
    row.addElement(counter);
    row.addElement(r.getRequest().getMethod());
    row.addElement(NumberFormat.getInstance().format(r.getCount()));
    row.addElement(r.getName());
    row.addElement(r.getRequest().getURI().toString());
    row.addElement("String_Node_Str");
    data.addElement(row);
    counter++;
  }
  table.repaint();
  this.setAlwaysOnTop(true);
}

Fixed version (ground truth):
public void update(){
  data.clear();
  final Iterator<Request> it=OutputQueue.getInstance().iterator();
  Request current=OutputQueue.getInstance().getCurrent();
  int counter=1;
  if (current != null) {
    final Vector<Object> row=new Vector<Object>();
    row.addElement(0);
    row.addElement(current.getRequest().getMethod());
    row.addElement(NumberFormat.getInstance().format(current.getCount()));
    row.addElement(current.getName());
    row.addElement(current.getRequest().getURI().toString());
    row.addElement("String_Node_Str");
    data.addElement(row);
  }
  while (it.hasNext()) {
    final Request r=it.next();
    if (r == null) {
      break;
    }
    final Vector<Object> row=new Vector<Object>();
    row.addElement(counter);
    row.addElement(r.getRequest().getMethod());
    row.addElement(NumberFormat.getInstance().format(r.getCount()));
    row.addElement(r.getName());
    row.addElement(r.getRequest().getURI().toString());
    row.addElement("String_Node_Str");
    data.addElement(row);
    counter++;
  }
  table.repaint();
}
Program: 88484
Project: 88484
Buggy source:
@Override public void actionPerformed(@CheckForNull ActionEvent actionEvent){
  getSyncStatusFrame().setVisible(!getSyncStatusFrame().isVisible());
  if (getSyncStatusFrame().isVisible()) {
    update();
  }
}

Fixed version (ground truth):
@Override public void actionPerformed(@CheckForNull ActionEvent actionEvent){
  if (!getSyncStatusFrame().isVisible()) {
    getSyncStatusFrame().setVisible(true);
  }
 else {
    update();
    getSyncStatusFrame().toFront();
  }
}
Program: 88485
Project: 88485
Buggy source:
public SyncStatusFrame(){
  super("String_Node_Str");
  setContentPane(rootPanel);
  setLocationRelativeTo(Application.getInstance().getMainFrame());
  pack();
  setMinimumSize(getSize());
  setDefaultCloseOperation(JFrame.HIDE_ON_CLOSE);
  setAlwaysOnTop(true);
  detailsButton.addActionListener(new ActionListener(){
    @Override public void actionPerformed(    ActionEvent e){
      new DetailedSyncStatusAction().actionPerformed(null);
    }
  }
);
}

Fixed version (ground truth):
public SyncStatusFrame(){
  super("String_Node_Str");
  setContentPane(rootPanel);
  setLocationRelativeTo(Application.getInstance().getMainFrame());
  pack();
  setMinimumSize(getSize());
  setDefaultCloseOperation(JFrame.HIDE_ON_CLOSE);
  detailsButton.addActionListener(new ActionListener(){
    @Override public void actionPerformed(    ActionEvent e){
      new DetailedSyncStatusAction().actionPerformed(null);
    }
  }
);
}
Program: 88486
Project: 88486
Buggy source:
public ViewEditorLinkForm(String label,List<JButton> buttons){
  super(label);
  buttonPanel.setLayout(new GridLayout(0,1,0,2));
  for (  JButton button : buttons) {
    buttonPanel.add(button);
  }
  buttonPanel.setPreferredSize(new Dimension(320,buttons.size() * 25));
  scrollPane.setPreferredSize(new Dimension(340,Math.min(DISPLAYED_LINKS,buttons.size()) * 25 + 4));
  rootPanel.setPreferredSize(new Dimension(360,scrollPane.getPreferredSize().height + 12));
  setContentPane(rootPanel);
  setLocationRelativeTo(Application.getInstance().getMainFrame());
  pack();
  setMinimumSize(getSize());
  setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
  setResizable(false);
  setAlwaysOnTop(true);
}

Fixed version (ground truth):
public ViewEditorLinkForm(String label,List<JButton> buttons){
  super(label);
  buttonPanel.setLayout(new GridLayout(0,1,0,2));
  for (  JButton button : buttons) {
    buttonPanel.add(button);
  }
  buttonPanel.setPreferredSize(new Dimension(320,buttons.size() * 25));
  scrollPane.setPreferredSize(new Dimension(340,Math.min(DISPLAYED_LINKS,buttons.size()) * 25 + 4));
  rootPanel.setPreferredSize(new Dimension(360,scrollPane.getPreferredSize().height + 12));
  setContentPane(rootPanel);
  setLocationRelativeTo(Application.getInstance().getMainFrame());
  pack();
  setMinimumSize(getSize());
  setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
  setResizable(false);
}
Program: 88487
Project: 88487
Buggy source:
public static boolean isTicketValid(Project project) throws ServerException, IOException, URISyntaxException {
  if (!isTicketSet(project)) {
    return false;
  }
  return MMSUtils.validateCredentials(project,ticketMappings.get(project).getTicket()).equals(username);
}

Fixed version (ground truth):
public static boolean isTicketValid(Project project) throws ServerException, IOException, URISyntaxException {
  if (!isTicketSet(project)) {
    return false;
  }
  String ticket=ticketMappings.get(project).getTicket();
  return MMSUtils.validateCredentials(project,ticket).equals(username);
}
Program: 88489
Project: 88489
Buggy source:
public static String validateCredentials(Project project,String ticket) throws ServerException, IOException, URISyntaxException {
  URIBuilder requestUri=MMSUtils.getServiceUri(project);
  if (requestUri == null) {
    return "String_Node_Str";
  }
  requestUri.setPath(requestUri.getPath() + "String_Node_Str" + ticket);
  requestUri.clearParameters();
  URI requestDest=requestUri.build();
  HttpRequestBase request=new HttpGet(requestDest);
  System.out.println("String_Node_Str" + requestUri.toString());
  String responseBody;
  int responseCode;
  try (CloseableHttpClient httpclient=HttpClients.createDefault();CloseableHttpResponse response=httpclient.execute(request);InputStream inputStream=response.getEntity().getContent()){
    responseCode=response.getStatusLine().getStatusCode();
    System.out.println("String_Node_Str" + requestUri.toString() + "String_Node_Str"+ responseCode);
    responseBody=((inputStream != null) ? IOUtils.toString(inputStream) : "String_Node_Str");
  }
   if (!processResponse(responseCode,new ByteArrayInputStream(responseBody.getBytes()),project)) {
    throw new ServerException("String_Node_Str",responseCode);
  }
  ObjectNode responseJson=JacksonUtils.getObjectMapper().readValue(responseBody,ObjectNode.class);
  JsonNode value;
  if (responseJson != null && (value=responseJson.get("String_Node_Str")) != null && value.isTextual() && !value.asText().isEmpty()) {
    return value.asText();
  }
  return "String_Node_Str";
}

Fixed version (ground truth):
public static String validateCredentials(Project project,String ticket) throws ServerException, IOException, URISyntaxException {
  URIBuilder requestUri=MMSUtils.getServiceUri(project);
  if (requestUri == null) {
    return "String_Node_Str";
  }
  requestUri.setPath(requestUri.getPath() + "String_Node_Str" + ticket);
  requestUri.clearParameters();
  URI requestDest=requestUri.build();
  HttpRequestBase request=new HttpGet(requestDest);
  System.out.println("String_Node_Str" + requestUri.toString());
  String responseBody;
  int responseCode;
  try (CloseableHttpClient httpclient=HttpClients.createDefault();CloseableHttpResponse response=httpclient.execute(request);InputStream inputStream=response.getEntity().getContent()){
    responseCode=response.getStatusLine().getStatusCode();
    System.out.println("String_Node_Str" + requestUri.toString() + "String_Node_Str"+ responseCode);
    responseBody=((inputStream != null) ? IOUtils.toString(inputStream) : "String_Node_Str");
  }
   try (ByteArrayInputStream byteArrayInputStream=new ByteArrayInputStream(responseBody.getBytes())){
    if (!processResponse(responseCode,byteArrayInputStream,project)) {
      throw new ServerException("String_Node_Str",responseCode);
    }
  }
   ObjectNode responseJson=JacksonUtils.getObjectMapper().readValue(responseBody,ObjectNode.class);
  JsonNode value;
  if (responseJson != null && (value=responseJson.get("String_Node_Str")) != null && value.isTextual() && !value.asText().isEmpty()) {
    return value.asText();
  }
  return "String_Node_Str";
}
Program: 88491
Project: 88491
Buggy source:
private static boolean processResponse(int responseCode,InputStream responseStream,Project project){
  boolean throwServerException=false;
  JsonFactory jsonFactory=JacksonUtils.getJsonFactory();
  try (JsonParser jsonParser=jsonFactory.createParser(responseStream)){
    while (jsonParser.nextFieldName() != null && !jsonParser.nextFieldName().equals("String_Node_Str")) {
    }
    if (jsonParser.getCurrentToken() == JsonToken.FIELD_NAME) {
      jsonParser.nextToken();
      Application.getInstance().getGUILog().log("String_Node_Str" + jsonParser.getText());
    }
  }
 catch (  IOException e) {
    Application.getInstance().getGUILog().log("String_Node_Str");
    throwServerException=true;
  }
  if (responseCode == HttpURLConnection.HTTP_UNAUTHORIZED) {
    Application.getInstance().getGUILog().log("String_Node_Str");
    MMSLogoutAction.logoutAction(project);
    throwServerException=true;
  }
 else   if (responseCode != HttpURLConnection.HTTP_OK && responseCode != HttpURLConnection.HTTP_NOT_FOUND) {
    throwServerException=true;
  }
  if (throwServerException) {
    Application.getInstance().getGUILog().log("String_Node_Str" + responseCode + "String_Node_Str"+ "String_Node_Str");
  }
  return throwServerException;
}

Fixed version (ground truth):
private static boolean processResponse(int responseCode,InputStream responseStream,Project project){
  boolean throwServerException=false;
  JsonFactory jsonFactory=JacksonUtils.getJsonFactory();
  try (JsonParser jsonParser=jsonFactory.createParser(responseStream)){
    while (jsonParser.nextFieldName() != null && !jsonParser.nextFieldName().equals("String_Node_Str")) {
    }
    if (jsonParser.getCurrentToken() == JsonToken.FIELD_NAME) {
      jsonParser.nextToken();
      Application.getInstance().getGUILog().log("String_Node_Str" + jsonParser.getText());
    }
  }
 catch (  IOException e) {
    Application.getInstance().getGUILog().log("String_Node_Str");
    throwServerException=true;
  }
  if (responseCode == HttpURLConnection.HTTP_UNAUTHORIZED) {
    Application.getInstance().getGUILog().log("String_Node_Str");
    MMSLogoutAction.logoutAction(project);
    throwServerException=true;
  }
 else   if (responseCode != HttpURLConnection.HTTP_OK && responseCode != HttpURLConnection.HTTP_NOT_FOUND) {
    throwServerException=true;
  }
  if (throwServerException) {
    Application.getInstance().getGUILog().log("String_Node_Str" + responseCode + "String_Node_Str"+ "String_Node_Str");
  }
  return !throwServerException;
}
Program: 88492
Project: 88492
Buggy source:
public static boolean isTicketValid(Project project) throws ServerException, IOException, URISyntaxException {
  if (!isTicketSet(project)) {
    return false;
  }
  return MMSUtils.validateCredentials(project,ticketMappings.get(project).getTicket()).equals(username);
}

Fixed version (ground truth):
public static boolean isTicketValid(Project project) throws ServerException, IOException, URISyntaxException {
  if (!isTicketSet(project)) {
    return false;
  }
  String ticket=ticketMappings.get(project).getTicket();
  return MMSUtils.validateCredentials(project,ticket).equals(username);
}
Program: 88494
Project: 88494
Buggy source:
public void setup(URI u){
  uri=u;
  setToolTipText(uri.toString());
  addMouseListener(new MouseAdapter(){
    public void mouseClicked(    MouseEvent e){
      open(uri);
    }
  }
);
}

Fixed version (ground truth):
void setup(URI u){
  uri=u;
  setToolTipText(uri.toString());
  addMouseListener(new MouseAdapter(){
    public void mouseClicked(    MouseEvent e){
      open(uri);
    }
  }
);
}
Program: 88495
Project: 88495
Buggy source:
private static void collectRecursiveAssociatedElements(Classifier e,List<Element> all,int depth,int current,AggregationKind kind){
  if (depth != 0 && current > depth) {
    return;
  }
  Collection<Property> owned=e.getAttribute();
  for (  Property o : owned) {
    if (o.getAggregation() != kind) {
      continue;
    }
    if (o.getType() == null) {
      continue;
    }
    all.add(o.getType());
    if (o.getType() instanceof Classifier) {
      collectRecursiveAssociatedElements((Classifier)o.getType(),all,depth,current + 1,kind);
    }
  }
}

Fixed version (ground truth):
private static void collectRecursiveAssociatedElements(Classifier e,List<Element> all,int depth,int current,AggregationKind kind){
  if (depth != 0 && current > depth) {
    return;
  }
  Collection<Property> owned=e.getAttribute();
  for (  Property o : owned) {
    if (all.contains(o)) {
      continue;
    }
    if (o.getAggregation() != kind) {
      continue;
    }
    Type type=o.getType();
    if (type == null) {
      continue;
    }
    if (all.contains(type)) {
      continue;
    }
    all.add(type);
    if (type instanceof Classifier) {
      collectRecursiveAssociatedElements((Classifier)type,all,depth,current + 1,kind);
    }
  }
}
Program: 88497
Project: 88497
Buggy source:
@Override public void configure(ActionsManager manager){
  NMAction category=manager.getActionFor("String_Node_Str");
  if (category == null) {
    category=new MDActionsCategory("String_Node_Str","String_Node_Str");
  }
  ((ActionsCategory)category).setNested(true);
  manager.addCategory((ActionsCategory)category);
  MMSLoginAction mmsLoginAction=new MMSLoginAction();
  category.addAction(mmsLoginAction);
  MMSLogoutAction mmsLogoutAction=new MMSLogoutAction();
  category.addAction(mmsLogoutAction);
  GenerateAllDocumentsAction generateAllDocumentsAction=new GenerateAllDocumentsAction();
  category.addAction(generateAllDocumentsAction);
  if (MDKOptionsGroup.getMDKOptions() != null && MDKOptionsGroup.getMDKOptions().isMDKAdvancedOptions()) {
    MDActionsCategory validateCategory=new MDActionsCategory("String_Node_Str","String_Node_Str");
    validateCategory.setNested(true);
    category.addAction(validateCategory);
    ValidateBranchesAction validateBranchesAction=new ValidateBranchesAction();
    validateCategory.addAction(validateBranchesAction);
  }
}

Fixed version (ground truth):
@Override public void configure(ActionsManager manager){
  NMAction category=manager.getActionFor("String_Node_Str");
  if (category == null) {
    category=new MDActionsCategory("String_Node_Str","String_Node_Str");
  }
  ((ActionsCategory)category).setNested(true);
  manager.addCategory((ActionsCategory)category);
  MMSLoginAction mmsLoginAction=new MMSLoginAction();
  category.addAction(mmsLoginAction);
  MMSLogoutAction mmsLogoutAction=new MMSLogoutAction();
  category.addAction(mmsLogoutAction);
  GenerateAllViewsAction generateAllViewsAction=new GenerateAllViewsAction();
  category.addAction(generateAllViewsAction);
  if (MDKOptionsGroup.getMDKOptions() != null && MDKOptionsGroup.getMDKOptions().isMDKAdvancedOptions()) {
    MDActionsCategory validateCategory=new MDActionsCategory("String_Node_Str","String_Node_Str");
    validateCategory.setNested(true);
    category.addAction(validateCategory);
    ValidateBranchesAction validateBranchesAction=new ValidateBranchesAction();
    validateCategory.addAction(validateBranchesAction);
  }
}
Program: 88498
Project: 88498
Buggy source:
public static void generateAllDocuments(Project project){
  GenerateAllDocumentsAction uad=new GenerateAllDocumentsAction();
  validationWindow=new MDKValidationWindow(uad.updateAction(project));
}

Fixed version (ground truth):
public static void generateAllDocuments(Project project){
  GenerateAllViewsAction uad=new GenerateAllViewsAction();
  validationWindow=new MDKValidationWindow(uad.updateAction(project));
}
Program: 88499
Project: 88499
Buggy source:
/** 
 * Sends a POST request to MMS with the element JSON, creating or updating the element as appropriate.
 * @param elementsToPost Collection of elements you want to directly post on the MMS
 * @throws IllegalStateException
 */
public static ObjectNode postMmsElements(Collection<Element> elementsToPost,Project project) throws IOException, URISyntaxException, ServerException {
  URIBuilder requestUri=MMSUtils.getServiceProjectsRefsElementsUri(project);
  if (requestUri == null) {
    return null;
  }
  LinkedList<ObjectNode> elementJson=new LinkedList<>();
  for (  Element target : elementsToPost) {
    ObjectNode elemJson=Converters.getElementToJsonConverter().apply(target,project);
    elementJson.add(elemJson);
  }
  File sendData=MMSUtils.createEntityFile(MDKHelper.class,ContentType.APPLICATION_JSON,elementJson,MMSUtils.JsonBlobType.ELEMENT_JSON);
  return JacksonUtils.parseJsonObject(MMSUtils.sendMMSRequest(project,MMSUtils.buildRequest(MMSUtils.HttpRequestType.POST,requestUri,sendData,ContentType.APPLICATION_JSON)));
}

Fixed version (ground truth):
/** 
 * Sends a POST request to MMS with the element JSON, creating or updating the element as appropriate.
 * @param elementsToPost Collection of elements you want to directly post on the MMS
 * @throws IllegalStateException
 */
public static ObjectNode postMmsElements(Collection<Element> elementsToPost,Project project) throws IOException, URISyntaxException, ServerException {
  URIBuilder requestUri=MMSUtils.getServiceProjectsRefsElementsUri(project);
  if (requestUri == null) {
    return null;
  }
  LinkedList<ObjectNode> elementJson=new LinkedList<>();
  for (  Element target : elementsToPost) {
    ObjectNode elemJson=Converters.getElementToJsonConverter().apply(target,project);
    elementJson.add(elemJson);
  }
  File sendData=MMSUtils.createEntityFile(MDKHelper.class,ContentType.APPLICATION_JSON,elementJson,MMSUtils.JsonBlobType.ELEMENT_JSON);
  File responseFile=MMSUtils.sendMMSRequest(project,MMSUtils.buildRequest(MMSUtils.HttpRequestType.POST,requestUri,sendData,ContentType.APPLICATION_JSON));
  try (JsonParser jsonParser=JacksonUtils.getJsonFactory().createParser(responseFile)){
    return JacksonUtils.parseJsonObject(jsonParser);
  }
 }