nus-yam/ex-repair huggingface dataset:
Program: 88623
Project: 88623
Buggy source:
public ModelValidator(Collection<Element> starts,JSONObject result,boolean checkExist,Set<Element> elementSet,boolean crippled){
  this.starts=starts;
  suite.addValidationRule(nameDiff);
  suite.addValidationRule(docDiff);
  suite.addValidationRule(valueDiff);
  suite.addValidationRule(ownership);
  suite.addValidationRule(exist);
  suite.addValidationRule(relDiff);
  suite.addValidationRule(commentDiff);
  suite.addValidationRule(projectExist);
  suite.addValidationRule(baselineTag);
  suite.addValidationRule(metaclassDiff);
  suite.addValidationRule(propertyTypeDiff);
  suite.addValidationRule(connectorDiff);
  suite.addValidationRule(constraintDiff);
  suite.addValidationRule(associationDiff);
  suite.addValidationRule(siteDiff);
  suite.addValidationRule(productView);
  suite.addValidationRule(instanceSpec);
  suite.addValidationRule(viewConstraint);
  this.checkExist=checkExist;
  this.result=result;
  prj=Application.getInstance().getProject();
  this.elementSet=elementSet;
  this.crippled=crippled;
}

Fixed version (ground truth):
public ModelValidator(Collection<Element> starts,JSONObject result,boolean checkExist,Set<Element> elementSet,boolean crippled){
  this.starts=starts;
  suite.addValidationRule(nameDiff);
  suite.addValidationRule(docDiff);
  suite.addValidationRule(valueDiff);
  suite.addValidationRule(ownership);
  suite.addValidationRule(exist);
  suite.addValidationRule(relDiff);
  suite.addValidationRule(commentDiff);
  suite.addValidationRule(projectExist);
  suite.addValidationRule(baselineTag);
  suite.addValidationRule(metaclassDiff);
  suite.addValidationRule(propertyTypeDiff);
  suite.addValidationRule(connectorDiff);
  suite.addValidationRule(constraintDiff);
  suite.addValidationRule(associationDiff);
  suite.addValidationRule(siteDiff);
  suite.addValidationRule(productView);
  suite.addValidationRule(instanceSpec);
  suite.addValidationRule(viewConstraint);
  suite.addValidationRule(metatypes);
  this.checkExist=checkExist;
  this.result=result;
  prj=Application.getInstance().getProject();
  this.elementSet=elementSet;
  this.crippled=crippled;
}
Program: 88624
Project: 88624
Buggy source:
protected void startSection(DBSection section){
  JSONObject newSection=new JSONObject();
  newSection.put("String_Node_Str","String_Node_Str");
  newSection.put("String_Node_Str",section.getTitle());
  JSONArray secArray=new JSONArray();
  newSection.put("String_Node_Str",secArray);
  this.curContains.peek().add(newSection);
  this.curContains.push(secArray);
  InstanceSpecification sec=null;
  Element loopElement=null;
  if (section.getDgElement() instanceof Section) {
    if (((Section)section.getDgElement()).getLoopElement() != null) {
      loopElement=((Section)section.getDgElement()).getLoopElement();
      sec=findInstanceForSection(loopElement);
    }
 else     sec=findInstanceForSection(null);
  }
  if (sec != null) {
    currentInstanceList.remove(sec);
    currentSectionInstances.remove(sec);
  }
  if (sec != null && !sec.isEditable())   notEditable.add(sec);
  PresentationElement parentSec=currentSection.isEmpty() ? null : currentSection.peek();
  List<PresentationElement> secChildren=new ArrayList<PresentationElement>();
  PresentationElement pe=new PresentationElement(sec,newSection,PEType.SECTION,currentView.peek(),section.getTitle(),parentSec,secChildren);
  pe.setLoopElement(loopElement);
  newpe.peek().add(pe);
  currentSection.push(pe);
  newpe.push(secChildren);
  Expression e=null;
  if (sec != null && sec.getSpecification() instanceof Expression)   e=(Expression)sec.getSpecification();
  processCurrentInstances(e,currentView.peek());
  addManualInstances(false);
}

Fixed version (ground truth):
protected void startSection(DBSection section){
  JSONObject newSection=new JSONObject();
  newSection.put("String_Node_Str","String_Node_Str");
  newSection.put("String_Node_Str",section.getTitle());
  JSONArray secArray=new JSONArray();
  newSection.put("String_Node_Str",secArray);
  this.curContains.peek().add(newSection);
  this.curContains.push(secArray);
  InstanceSpecification sec=null;
  Element loopElement=null;
  if (section.getDgElement() instanceof Section) {
    if (((Section)section.getDgElement()).getLoopElement() != null) {
      loopElement=((Section)section.getDgElement()).getLoopElement();
      sec=findInstanceForSection(loopElement);
    }
 else     sec=findInstanceForSection(null);
  }
  if (sec != null) {
    currentInstanceList.peek().remove(sec);
    currentSectionInstances.peek().remove(sec);
  }
  if (sec != null && !sec.isEditable())   notEditable.add(sec);
  PresentationElement parentSec=currentSection.isEmpty() ? null : currentSection.peek();
  List<PresentationElement> secChildren=new ArrayList<PresentationElement>();
  PresentationElement pe=new PresentationElement(sec,newSection,PEType.SECTION,currentView.peek(),section.getTitle(),parentSec,secChildren);
  pe.setLoopElement(loopElement);
  newpe.peek().add(pe);
  currentSection.push(pe);
  newpe.push(secChildren);
  Expression e=null;
  if (sec != null && sec.getSpecification() instanceof Expression)   e=(Expression)sec.getSpecification();
  processCurrentInstances(e,currentView.peek());
  addManualInstances(false);
}
Program: 88625
Project: 88625
Buggy source:
@SuppressWarnings("String_Node_Str") @Override public void actionPerformed(ActionEvent e){
  if (!ExportUtility.okToExport(element))   return;
  JSONObject info=new JSONObject();
  JSONArray elements=new JSONArray();
  JSONObject send=new JSONObject();
  info.put("String_Node_Str",ExportUtility.fillDirectedRelationshipSpecialization((DirectedRelationship)element,null));
  info.put("String_Node_Str",e.getID());
  elements.add(info);
  send.put("String_Node_Str",elements);
  send.put("String_Node_Str","String_Node_Str");
  String url=ExportUtility.getPostElementsUrl();
  if (url == null) {
    return;
  }
  Application.getInstance().getGUILog().log("String_Node_Str");
  OutputQueue.getInstance().offer(new Request(url,send.toJSONString()));
}

Fixed version (ground truth):
@SuppressWarnings("String_Node_Str") @Override public void actionPerformed(ActionEvent e){
  if (!ExportUtility.okToExport(element))   return;
  JSONObject info=new JSONObject();
  JSONArray elements=new JSONArray();
  JSONObject send=new JSONObject();
  info.put("String_Node_Str",ExportUtility.fillDirectedRelationshipSpecialization((DirectedRelationship)element,null));
  info.put("String_Node_Str",element.getID());
  elements.add(info);
  send.put("String_Node_Str",elements);
  send.put("String_Node_Str","String_Node_Str");
  String url=ExportUtility.getPostElementsUrl();
  if (url == null) {
    return;
  }
  Application.getInstance().getGUILog().log("String_Node_Str");
  OutputQueue.getInstance().offer(new Request(url,send.toJSONString()));
}
Program: 88628
Project: 88628
Buggy source:
@Override public void actionPerformed(ActionEvent e){
  if (exportHierarchy(view)) {
    this.removeViolationAndUpdateWindow();
  }
}

Fixed version (ground truth):
@Override public void actionPerformed(ActionEvent e){
  if (exportHierarchy(view)) {
  }
}
Program: 88630
Project: 88630
Buggy source:
@Override public void execute(Collection<Annotation> annos){
  Collection<Annotation> toremove=new ArrayList<Annotation>();
  for (  Annotation anno : annos) {
    Element e=(Element)anno.getTarget();
    if (exportHierarchy(e)) {
      toremove.add(anno);
    }
  }
  if (!toremove.isEmpty()) {
    this.removeViolationsAndUpdateWindow(toremove);
  }
}

Fixed version (ground truth):
@Override public void execute(Collection<Annotation> annos){
  Collection<Annotation> toremove=new ArrayList<Annotation>();
  for (  Annotation anno : annos) {
    Element e=(Element)anno.getTarget();
    if (exportHierarchy(e)) {
      toremove.add(anno);
    }
  }
}
Program: 88632
Project: 88632
Buggy source:
@SuppressWarnings("String_Node_Str") public static List<Request> sendChanges(Map<String,Object> results){
  Set<Element> added=(Set<Element>)results.get("String_Node_Str");
  Set<Property> moved=(Set<Property>)results.get("String_Node_Str");
  Set<Element> deleted=(Set<Element>)results.get("String_Node_Str");
  Set<Property> ptyped=(Set<Property>)results.get("String_Node_Str");
  Set<String> deletedIds=(Set<String>)results.get("String_Node_Str");
  List<Request> returns=new ArrayList<Request>();
  JSONArray changes=new JSONArray();
  for (  Element e : added) {
    changes.add(ExportUtility.fillElement(e,null));
  }
  for (  Property p : moved) {
    changes.add(ExportUtility.fillOwner(p,null));
  }
  for (  Property p : ptyped) {
    changes.add(ExportUtility.fillElement(p,null));
  }
  JSONObject tosend=new JSONObject();
  tosend.put("String_Node_Str",changes);
  String url=ExportUtility.getPostElementsUrl();
  Request r=new Request();
  r.setUrl(url);
  r.setJson(tosend.toJSONString());
  OutputQueue.getInstance().offer(r);
  url=ExportUtility.getUrlWithWorkspace();
  for (  String e : deletedIds) {
    String durl=url + "String_Node_Str" + e;
    Request rr=new Request();
    r.setUrl(durl);
    r.setMethod("String_Node_Str");
    OutputQueue.getInstance().offer(rr);
  }
  return returns;
}

Fixed version (ground truth):
@SuppressWarnings("String_Node_Str") public static List<Request> sendChanges(Map<String,Object> results){
  Set<Element> added=(Set<Element>)results.get("String_Node_Str");
  Set<Property> moved=(Set<Property>)results.get("String_Node_Str");
  Set<Element> deleted=(Set<Element>)results.get("String_Node_Str");
  Set<Property> ptyped=(Set<Property>)results.get("String_Node_Str");
  Set<String> deletedIds=(Set<String>)results.get("String_Node_Str");
  List<Request> returns=new ArrayList<Request>();
  JSONArray changes=new JSONArray();
  for (  Element e : added) {
    changes.add(ExportUtility.fillElement(e,null));
  }
  for (  Property p : moved) {
    changes.add(ExportUtility.fillOwner(p,null));
  }
  for (  Property p : ptyped) {
    changes.add(ExportUtility.fillElement(p,null));
  }
  JSONObject tosend=new JSONObject();
  tosend.put("String_Node_Str",changes);
  String url=ExportUtility.getPostElementsUrl();
  Request r=new Request();
  r.setUrl(url);
  r.setJson(tosend.toJSONString());
  OutputQueue.getInstance().offer(r);
  url=ExportUtility.getUrlWithWorkspace();
  for (  String e : deletedIds) {
    String durl=url + "String_Node_Str" + e;
    Request rr=new Request();
    rr.setUrl(durl);
    rr.setMethod("String_Node_Str");
    OutputQueue.getInstance().offer(rr);
  }
  return returns;
}
Program: 88636
Project: 88636
Buggy source:
@Override public void run(){
  if (disabled && auto)   return;
  for (  PropertyChangeEvent event : events) {
    String strTmp="String_Node_Str";
    if (event != null) {
      strTmp=event.toString();
    }
    Object source=event.getSource();
    if (source instanceof Element) {
      String changedPropertyName=event.getPropertyName();
      if (changedPropertyName == null) {
        continue;
      }
 else {
        if (event.getNewValue() == null && event.getOldValue() == null)         continue;
        if ((event.getNewValue() == null && event.getOldValue() != null) || (event.getNewValue() != null && event.getOldValue() == null) || (!event.getNewValue().equals(event.getOldValue())))         handleChangedProperty((Element)source,changedPropertyName,event.getNewValue(),event.getOldValue());
      }
    }
  }
  for (  String id : toRemove) {
    elements.remove(id);
  }
  if ((!elements.isEmpty() || !deletes.isEmpty()) && auto)   sendChanges();
}

Fixed version (ground truth):
@Override public void run(){
  if (disabled)   return;
  for (  PropertyChangeEvent event : events) {
    String strTmp="String_Node_Str";
    if (event != null) {
      strTmp=event.toString();
    }
    Object source=event.getSource();
    if (source instanceof Element) {
      String changedPropertyName=event.getPropertyName();
      if (changedPropertyName == null) {
        continue;
      }
 else {
        if (event.getNewValue() == null && event.getOldValue() == null)         continue;
        if ((event.getNewValue() == null && event.getOldValue() != null) || (event.getNewValue() != null && event.getOldValue() == null) || (!event.getNewValue().equals(event.getOldValue())))         handleChangedProperty((Element)source,changedPropertyName,event.getNewValue(),event.getOldValue());
      }
    }
  }
  for (  String id : toRemove) {
    elements.remove(id);
  }
  if ((!elements.isEmpty() || !deletes.isEmpty()) && auto)   sendChanges();
}
Program: 88637
Project: 88637
Buggy source:
@SuppressWarnings("String_Node_Str") private JSONObject getElementObject(Element e,boolean added){
  JSONObject elementOb=null;
  String elementID=ExportUtility.getElementID(e);
  if (elements.containsKey(elementID)) {
    elementOb=elements.get(elementID);
  }
 else {
    elementOb=new JSONObject();
    elementOb.put("String_Node_Str",elementID);
    elements.put(elementID,elementOb);
  }
  if (deletedElements.containsKey(elementID))   deletedElements.remove(elementID);
  if (added)   addedElements.put(elementID,e);
  changedElements.put(elementID,e);
  return elementOb;
}

Fixed version (ground truth):
@SuppressWarnings("String_Node_Str") private JSONObject getElementObject(Element e,boolean added){
  JSONObject elementOb=null;
  String elementID=ExportUtility.getElementID(e);
  if (elements.containsKey(elementID)) {
    elementOb=elements.get(elementID);
  }
 else {
    elementOb=new JSONObject();
    elementOb.put("String_Node_Str",elementID);
    elements.put(elementID,elementOb);
  }
  if (deletedElements.containsKey(elementID) && !auto)   deletedElements.remove(elementID);
  if (added && !auto)   addedElements.put(elementID,e);
  if (!auto)   changedElements.put(elementID,e);
  return elementOb;
}
Program: 88639
Project: 88639
Buggy source:
public static void close(Project project,boolean keepDelayedSync){
  Map<String,Object> projectInstances=ProjectListenerMapping.getInstance().get(project);
  if (projectInstances == null)   return;
  AutoSyncCommitListener listener=(AutoSyncCommitListener)projectInstances.remove(LISTENER);
  if (listener != null) {
    if (keepDelayedSync)     listener.setAuto(false);
 else     project.getRepository().getTransactionManager().removeTransactionCommitListener(listener);
  }
  Connection connection=(Connection)projectInstances.remove(CONNECTION);
  Session session=(Session)projectInstances.remove(SESSION);
  MessageConsumer consumer=(MessageConsumer)projectInstances.remove(CONSUMER);
  try {
    if (consumer != null)     consumer.close();
    if (session != null)     session.close();
    if (connection != null)     connection.close();
  }
 catch (  Exception e) {
  }
  Application.getInstance().getGUILog().log("String_Node_Str");
}

Fixed version (ground truth):
public static void close(Project project,boolean keepDelayedSync){
  Map<String,Object> projectInstances=ProjectListenerMapping.getInstance().get(project);
  if (projectInstances == null)   return;
  AutoSyncCommitListener listener=(AutoSyncCommitListener)projectInstances.get(LISTENER);
  if (listener != null) {
    if (keepDelayedSync)     listener.setAuto(false);
 else     project.getRepository().getTransactionManager().removeTransactionCommitListener(listener);
  }
  Connection connection=(Connection)projectInstances.remove(CONNECTION);
  Session session=(Session)projectInstances.remove(SESSION);
  MessageConsumer consumer=(MessageConsumer)projectInstances.remove(CONSUMER);
  try {
    if (consumer != null)     consumer.close();
    if (session != null)     session.close();
    if (connection != null)     connection.close();
  }
 catch (  Exception e) {
  }
  Application.getInstance().getGUILog().log("String_Node_Str");
}
Program: 88640
Project: 88640
Buggy source:
@SuppressWarnings("String_Node_Str") public static JSONObject fillOwner(Element e,JSONObject einfo){
  JSONObject info=einfo;
  if (info == null) {
    info=new JSONObject();
    info.put("String_Node_Str",getElementID(e));
  }
  if (e.getOwner() == null)   info.put("String_Node_Str","String_Node_Str");
 else   info.put("String_Node_Str","String_Node_Str" + getElementID(e.getOwner()));
  return info;
}

Fixed version (ground truth):
@SuppressWarnings("String_Node_Str") public static JSONObject fillOwner(Element e,JSONObject einfo){
  JSONObject info=einfo;
  if (info == null) {
    info=new JSONObject();
    info.put("String_Node_Str",getElementID(e));
  }
  if (e.getOwner() == null)   info.put("String_Node_Str",null);
 else   info.put("String_Node_Str","String_Node_Str" + getElementID(e.getOwner()));
  return info;
}
Program: 88641
Project: 88641
Buggy source:
private ValidationRuleViolation connectorDiff(Connector e,JSONObject info){
  JSONObject webspec=(JSONObject)info.get("String_Node_Str");
  Boolean editable=(Boolean)info.get("String_Node_Str");
  JSONArray webSourcePropPath=(JSONArray)webspec.get("String_Node_Str");
  JSONArray webTargetPropPath=(JSONArray)webspec.get("String_Node_Str");
  String webtype=(String)webspec.get("String_Node_Str");
  JSONObject modelspec=ExportUtility.fillConnectorSpecialization(e,null);
  JSONArray modelSourcePropPath=(JSONArray)modelspec.get("String_Node_Str");
  JSONArray modelTargetPropPath=(JSONArray)modelspec.get("String_Node_Str");
  String modeltype=(String)modelspec.get("String_Node_Str");
  if (!webSourcePropPath.equals(modelSourcePropPath) || !webTargetPropPath.equals(modelTargetPropPath) || (modeltype != null && !modeltype.equals(webtype) || webtype != null && !webtype.equals(modeltype))) {
    ValidationRuleViolation v=new ValidationRuleViolation(e,"String_Node_Str");
    if (editable)     v.addAction(new ExportConnector(e));
    v.addAction(new ImportConnector(e,webspec,result));
    return v;
  }
  return null;
}

Fixed version (ground truth):
private ValidationRuleViolation connectorDiff(Connector e,JSONObject info){
  JSONObject webspec=(JSONObject)info.get("String_Node_Str");
  Boolean editable=(Boolean)info.get("String_Node_Str");
  JSONArray webSourcePropPath=(JSONArray)webspec.get("String_Node_Str");
  JSONArray webTargetPropPath=(JSONArray)webspec.get("String_Node_Str");
  String webtype=(String)webspec.get("String_Node_Str");
  JSONObject modelspec=ExportUtility.fillConnectorSpecialization(e,null);
  JSONArray modelSourcePropPath=(JSONArray)modelspec.get("String_Node_Str");
  JSONArray modelTargetPropPath=(JSONArray)modelspec.get("String_Node_Str");
  String modeltype=(String)modelspec.get("String_Node_Str");
  if (!modelSourcePropPath.equals(webSourcePropPath) || !modelTargetPropPath.equals(webTargetPropPath) || (modeltype != null && !modeltype.equals(webtype) || webtype != null && !webtype.equals(modeltype))) {
    ValidationRuleViolation v=new ValidationRuleViolation(e,"String_Node_Str");
    if (editable)     v.addAction(new ExportConnector(e));
    v.addAction(new ImportConnector(e,webspec,result));
    return v;
  }
  return null;
}
Program: 88642
Project: 88642
Buggy source:
private JSONObject getManyAlfrescoElements(Set<Element> es){
  if (es.isEmpty())   return null;
  JSONArray elements=new JSONArray();
  for (  Element e : es) {
    JSONObject ob=new JSONObject();
    ob.put("String_Node_Str",ExportUtility.getElementID(e));
    elements.add(ob);
  }
  JSONObject tosend=new JSONObject();
  tosend.put("String_Node_Str",elements);
  String url=ExportUtility.getUrlWithWorkspace();
  url+="String_Node_Str";
  String response=ExportUtility.getWithBody(url,tosend.toJSONString());
  return (JSONObject)JSONValue.parse(response);
}

Fixed version (ground truth):
private JSONObject getManyAlfrescoElements(Set<Element> es){
  if (es.isEmpty())   return null;
  JSONArray elements=new JSONArray();
  for (  Element e : es) {
    JSONObject ob=new JSONObject();
    ob.put("String_Node_Str",ExportUtility.getElementID(e));
    elements.add(ob);
  }
  JSONObject tosend=new JSONObject();
  tosend.put("String_Node_Str",elements);
  String url=ExportUtility.getUrlWithWorkspace();
  url+="String_Node_Str";
  String response=ExportUtility.getWithBody(url,tosend.toJSONString());
  if (response == null) {
    JSONObject res=new JSONObject();
    res.put("String_Node_Str",new JSONArray());
    return res;
  }
  return (JSONObject)JSONValue.parse(response);
}
Program: 88644
Project: 88644
Buggy source:
private ValidationRuleViolation siteDiff(Package e,JSONObject elementInfo){
  JSONObject model=ExportUtility.fillPackage(e,null);
  Boolean serversite=(Boolean)((JSONObject)elementInfo.get("String_Node_Str")).get("String_Node_Str");
  Boolean modelsite=(Boolean)model.get("String_Node_Str");
  if (!serversite && modelsite || serversite && !modelsite) {
    ValidationRuleViolation v=new ValidationRuleViolation(e,"String_Node_Str" + modelsite + "String_Node_Str"+ serversite);
    v.addAction(new ExportSite(e));
    return v;
  }
  return null;
}

Fixed version (ground truth):
private ValidationRuleViolation siteDiff(Package e,JSONObject elementInfo){
  JSONObject model=ExportUtility.fillPackage(e,null);
  Boolean serverSite=(Boolean)((JSONObject)elementInfo.get("String_Node_Str")).get("String_Node_Str");
  boolean serversite=false;
  if (serverSite != null && serverSite)   serversite=true;
  boolean modelsite=(Boolean)model.get("String_Node_Str");
  if (!serversite && modelsite || serversite && !modelsite) {
    ValidationRuleViolation v=new ValidationRuleViolation(e,"String_Node_Str" + modelsite + "String_Node_Str"+ serversite);
    v.addAction(new ExportSite(e));
    return v;
  }
  return null;
}
Program: 88647
Project: 88647
Buggy source:
/** 
 * Get the element's matching Slot.
 * @param elem the source Element
 * @param prop the Stereotype tag that the Slot instantiates
 * @return a Slot with zero or more values or null if no such Slot exists
 */
public static Slot getSlot(Element elem,Property prop){
  if (prop == null)   return null;
  Element myOwner=prop.getOwner();
  if (myOwner instanceof Stereotype && StereotypesHelper.hasStereotypeOrDerived(elem,(Stereotype)myOwner)) {
    Slot slot=StereotypesHelper.getSlot(elem,prop,false);
    if (slot != null) {
      return slot;
    }
  }
  return null;
}

Fixed version (ground truth):
/** 
 * Get the element's matching Slot.
 * @param elem the source Element
 * @param prop the Stereotype tag that the Slot instantiates
 * @return a Slot with zero or more values or null if no such Slot exists
 */
public static Slot getSlot(Element elem,Property prop){
  if (prop == null || elem == null)   return null;
  Element myOwner=prop.getOwner();
  if (myOwner instanceof Stereotype && StereotypesHelper.hasStereotypeOrDerived(elem,(Stereotype)myOwner)) {
    Slot slot=StereotypesHelper.getSlot(elem,prop,false);
    if (slot != null) {
      return slot;
    }
  }
  return null;
}
Program: 88648
Project: 88648
Buggy source:
public static Map<String,JSONObject> getReferencedElements(Element e){
  Stereotype view=Utils.getViewStereotype();
  Stereotype viewpoint=Utils.getViewpointStereotype();
  Map<String,JSONObject> result=new HashMap<String,JSONObject>();
  HashSet<Element> values=new HashSet<Element>();
  getNestedValueElements(values);
  for (  Element value : values) {
    if (value != null) {
      JSONObject j=new JSONObject();
      fillElement(value,j,view,viewpoint);
      result.put(value.getID(),j);
    }
  }
  return result;
}

Fixed version (ground truth):
public static Map<String,JSONObject> getReferencedElements(Element e){
  Stereotype view=Utils.getViewStereotype();
  Stereotype viewpoint=Utils.getViewpointStereotype();
  Map<String,JSONObject> result=new HashMap<String,JSONObject>();
  HashSet<Element> values=new HashSet<Element>();
  values.add(e);
  getNestedValueElements(values);
  for (  Element value : values) {
    if (value != null) {
      JSONObject j=new JSONObject();
      fillElement(value,j,view,viewpoint);
      result.put(value.getID(),j);
    }
  }
  values.remove(e);
  return result;
}
Program: 88649
Project: 88649
Buggy source:
public static String getUrl(){
  String url=null;
  Element model=Application.getInstance().getProject().getModel();
  if (StereotypesHelper.hasStereotype(model,"String_Node_Str")) {
    url=(String)StereotypesHelper.getStereotypePropertyFirst(model,"String_Node_Str","String_Node_Str");
    if (url == null || url.equals("String_Node_Str")) {
      JOptionPane.showMessageDialog(null,"String_Node_Str");
      url=null;
    }
  }
 else {
    JOptionPane.showMessageDialog(null,"String_Node_Str");
    url=null;
  }
  if (url == null && MDUtils.isDeveloperMode()) {
    url=JOptionPane.showInputDialog("String_Node_Str",developerUrl);
  }
  if (url == null || url.equals("String_Node_Str"))   return null;
  developerUrl=url;
  url+="String_Node_Str";
  return url;
}

Fixed version (ground truth):
public static String getUrl(){
  if (false) {
    return "String_Node_Str";
  }
  String url=null;
  Element model=Application.getInstance().getProject().getModel();
  if (StereotypesHelper.hasStereotype(model,"String_Node_Str")) {
    url=(String)StereotypesHelper.getStereotypePropertyFirst(model,"String_Node_Str","String_Node_Str");
    if (url == null || url.equals("String_Node_Str")) {
      JOptionPane.showMessageDialog(null,"String_Node_Str");
      url=null;
    }
  }
 else {
    JOptionPane.showMessageDialog(null,"String_Node_Str");
    url=null;
  }
  if (url == null && MDUtils.isDeveloperMode()) {
    url=JOptionPane.showInputDialog("String_Node_Str",developerUrl);
  }
  if (url == null || url.equals("String_Node_Str"))   return null;
  developerUrl=url;
  url+="String_Node_Str";
  return url;
}
Program: 88651
Project: 88651
Buggy source:
public static Map<String,JSONObject> getReferencedElements(Element e){
  Stereotype view=Utils.getViewStereotype();
  Stereotype viewpoint=Utils.getViewpointStereotype();
  Map<String,JSONObject> result=new HashMap<String,JSONObject>();
  if (e instanceof Property) {
    Element value=null;
    if (((Property)e).getDefaultValue() instanceof ElementValue) {
      value=((ElementValue)((Property)e).getDefaultValue()).getElement();
    }
 else     if (((Property)e).getDefaultValue() instanceof InstanceValue) {
      value=((InstanceValue)((Property)e).getDefaultValue()).getInstance();
    }
    if (value != null) {
      JSONObject j=new JSONObject();
      fillElement(value,j,view,viewpoint);
      result.put(value.getID(),j);
    }
  }
 else   if (e instanceof Slot) {
    for (    ValueSpecification vs : ((Slot)e).getValue()) {
      Element value=null;
      if (vs instanceof ElementValue) {
        value=((ElementValue)vs).getElement();
      }
 else       if (vs instanceof InstanceValue) {
        value=((InstanceValue)vs).getInstance();
      }
      if (value != null) {
        JSONObject j=new JSONObject();
        fillElement(value,j,view,viewpoint);
        result.put(value.getID(),j);
      }
    }
  }
  return result;
}

Fixed version (ground truth):
public static Map<String,JSONObject> getReferencedElements(Element e){
  Stereotype view=Utils.getViewStereotype();
  Stereotype viewpoint=Utils.getViewpointStereotype();
  Map<String,JSONObject> result=new HashMap<String,JSONObject>();
  HashSet<Element> values=new HashSet<Element>();
  getNestedValueElements(values);
  for (  Element value : values) {
    if (value != null) {
      JSONObject j=new JSONObject();
      fillElement(value,j,view,viewpoint);
      result.put(value.getID(),j);
    }
  }
  return result;
}
Program: 88654
Project: 88654
Buggy source:
public static void logWithColor(String msg,Color color){
  JDialog log=gl.getLog();
  StyledDocument doc=getComponentOfType(log,StyledDocument.class);
  if (doc == null) {
    JEditorPane jep=getComponentOfType(log,JEditorPane.class);
    if (jep != null) {
      doc=(StyledDocument)jep.getDocument();
    }
 else {
      System.out.println("String_Node_Str");
      System.err.println("String_Node_Str");
      return;
    }
  }
  SimpleAttributeSet set=new SimpleAttributeSet();
  StyleConstants.setForeground(set,color);
  int i=doc.getLength();
  try {
    doc.insertString(i,msg,set);
  }
 catch (  BadLocationException e) {
    e.printStackTrace();
  }
}

Fixed version (ground truth):
public static void logWithColor(String msg,Color color){
  if (color == null)   color=Color.black;
  if (gl == null)   gl=getGuiLog();
  JDialog log=gl.getLog();
  StyledDocument doc=getComponentOfType(log,StyledDocument.class);
  if (doc == null) {
    JEditorPane jep=getComponentOfType(log,JEditorPane.class);
    if (jep != null) {
      doc=(StyledDocument)jep.getDocument();
    }
 else {
      System.out.println("String_Node_Str");
      System.err.println("String_Node_Str");
      return;
    }
  }
  SimpleAttributeSet set=new SimpleAttributeSet();
  StyleConstants.setForeground(set,color);
  int i=doc.getLength();
  try {
    doc.insertString(i,msg,set);
  }
 catch (  BadLocationException e) {
    e.printStackTrace();
  }
}
Program: 88655
Project: 88655
Buggy source:
/** 
 */
public static void log(Object o){
  GUILog log=Application.getInstance().getGUILog();
  log.log(o.toString());
}

Fixed version (ground truth):
public static void log(Object o,Object color){
  if (color == null || color instanceof Color) {
    log(o,(Color)color);
  }
 else {
    log(o,color.toString());
  }
}
Program: 88656
Project: 88656
Buggy source:
@Override protected Method getJavaMethodFor(EOperation operation,Object receiver){
  Method result=null;
  try {
    result=super.getJavaMethodFor(operation,receiver);
  }
 catch (  Throwable e) {
    if (operation != null && operation.getEContainingClass() != null) {
      EClass container=operation.getEContainingClass();
      Class<?> containerClass=container.getInstanceClass();
      if (containerClass == null) {
        if (container.getName().startsWith("String_Node_Str")) {
          container.setInstanceClass(String.class);
        }
        return getJavaMethodFor(operation,receiver);
      }
    }
    Debug.error(true,true,"String_Node_Str" + operation);
  }
  return result;
}

Fixed version (ground truth):
protected Method getJavaMethodFor(EOperation operation,Object receiver,boolean recursing){
  Method result=null;
  try {
    result=super.getJavaMethodFor(operation,receiver);
  }
 catch (  Throwable e) {
    if (!recursing && operation != null && operation.getEContainingClass() != null) {
      EClass container=operation.getEContainingClass();
      Class<?> containerClass=container.getInstanceClass();
      if (containerClass == null) {
        if (container.getName().startsWith("String_Node_Str")) {
          container.setInstanceClass(String.class);
        }
        return getJavaMethodFor(operation,receiver,true);
      }
    }
    Debug.error(true,true,"String_Node_Str" + operation);
  }
  return result;
}
Program: 88657
Project: 88657
Buggy source:
public static DgOperationInstance addOperation(String name,String annotationName,DgEnvironmentFactory envFactory,EClassifier callerType,EClassifier returnType,CallOperation operation,EParameter... parameters){
  return new DgOperationInstance(name,annotationName,envFactory,callerType,returnType,operation,parameters);
}

Fixed version (ground truth):
public static DgOperationInstance addOperation(String name,String annotationName,DgEnvironmentFactory envFactory,EClassifier callerType,EClassifier returnType,CallOperation operation,EParameter... parameters){
  System.out.println("String_Node_Str" + name + "String_Node_Str"+ "String_Node_Str"+ callerType.getName()+ "String_Node_Str"+ returnType.getName()+ "String_Node_Str"+ "String_Node_Str"+ MoreToString.Helper.toString(parameters)+ "String_Node_Str");
  return new DgOperationInstance(name,annotationName,envFactory,callerType,returnType,operation,parameters);
}
Program: 88659
Project: 88659
Buggy source:
protected DgEnvironmentFactory 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);
  addLogOperation(getEnvironmentFactory(),false);
  addROperation(getEnvironmentFactory());
  addMOperation(getEnvironmentFactory());
  addTOperation(getEnvironmentFactory());
  addSOperation(getEnvironmentFactory());
  addNOperation(getEnvironmentFactory());
  addOOperation(getEnvironmentFactory());
  addVOperation(getEnvironmentFactory());
  addExpressionOperations(getEnvironmentFactory());
  return getEnvironmentFactory();
}

Fixed version (ground truth):
protected DgEnvironmentFactory 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());
  addExpressionOperations(getEnvironmentFactory());
  return getEnvironmentFactory();
}
Program: 88660
Project: 88660
Buggy source:
protected static void addLogOperation(DgEnvironmentFactory envFactory,boolean addArg){
  DgOperationInstance doi=new DgOperationInstance();
  doi.setName("String_Node_Str");
  doi.setAnnotationName("String_Node_Str");
  if (addArg) {
    EParameter parm=EcoreFactory.eINSTANCE.createEParameter();
    parm.setName("String_Node_Str");
    doi.addParameter(parm,OCLStandardLibraryImpl.INSTANCE.getOclAny());
  }
  doi.setCallerType(OCLStandardLibraryImpl.INSTANCE.getOclAny());
  doi.setReturnType(OCLStandardLibraryImpl.INSTANCE.getOclAny());
  doi.setOperation(new CallOperation(){
    @Override public Object callOperation(    Object source,    Object[] args){
      if (args != null && args.length > 0) {
        if (args.length == 1) {
          Utils.log(MoreToString.Helper.toString(args[0]));
        }
 else {
          Utils.log(MoreToString.Helper.toString(args));
        }
      }
 else       if (source != null) {
        Utils.log(source);
      }
      return source;
    }
  }
);
  envFactory.getDgEnvironment().addDgOperation(doi);
  envFactory.getDgEvaluationEnvironment().addDgOperation(doi);
}

Fixed version (ground truth):
protected static void addLogOperation(DgEnvironmentFactory envFactory,boolean addArg,boolean addColorArg,boolean asSequence,boolean fromSequence){
  DgOperationInstance doi=new DgOperationInstance();
  doi.setName("String_Node_Str");
  doi.setAnnotationName("String_Node_Str");
  if (addArg) {
    EParameter parm=EcoreFactory.eINSTANCE.createEParameter();
    parm.setName("String_Node_Str");
    if (asSequence) {
      doi.addParameter(parm,OCLStandardLibraryImpl.INSTANCE.getSequence());
    }
 else {
      doi.addParameter(parm,OCLStandardLibraryImpl.INSTANCE.getOclAny());
    }
    if (addColorArg) {
      parm=EcoreFactory.eINSTANCE.createEParameter();
      parm.setName("String_Node_Str");
      doi.addParameter(parm,OCLStandardLibraryImpl.INSTANCE.getOclAny());
    }
  }
  if (fromSequence)   doi.setCallerType(OCLStandardLibraryImpl.INSTANCE.getOclAny());
 else   doi.setCallerType(OCLStandardLibraryImpl.INSTANCE.getSequence());
  doi.setReturnType(OCLStandardLibraryImpl.INSTANCE.getOclAny());
  doi.setOperation(new CallOperation(){
    @Override public Object callOperation(    Object source,    Object[] args){
      if (args != null && args.length > 0) {
        Object o=args[0];
        Object colorObj=null;
        if (args.length >= 2) {
          colorObj=args[1];
        }
 else         if (source != null && Utils.isColor(o)) {
          colorObj=args[0];
          o=source;
        }
        Utils.log(o,colorObj);
      }
 else       if (source != null) {
        Utils.log(source);
      }
      return source;
    }
  }
);
  envFactory.getDgEnvironment().addDgOperation(doi);
  envFactory.getDgEvaluationEnvironment().addDgOperation(doi);
}
Program: 88661
Project: 88661
Buggy source:
private void getHierarchyConsolidated(Class e,int curdepth,Map<Class,Integer> typeUnits,Map<Class,Map<Class,Integer>> consolidated,List<List<DocumentElement>> body,List<String> colspecs){
  List<DocumentElement> row=new ArrayList<DocumentElement>();
  body.add(row);
  String name=DocGenUtils.getIndented(e.getName(),curdepth);
  if (curdepth == 1)   name+="String_Node_Str" + name + "String_Node_Str";
  row.add(new DBText(name));
  Integer numunit=typeUnits.get(e);
  if (numunit == null)   numunit=1;
  getDocAndProps(e,numunit,row,colspecs);
  getStereotypeProps(e,row);
  body.add(row);
  for (  Element ee : Utils.sortByName(new HashSet<Element>(consolidated.get(e).keySet()))) {
    getHierarchyConsolidated((Class)ee,curdepth + 1,consolidated.get(e),consolidated,body,colspecs);
  }
}

Fixed version (ground truth):
private void getHierarchyConsolidated(Class e,int curdepth,Map<Class,Integer> typeUnits,Map<Class,Map<Class,Integer>> consolidated,List<List<DocumentElement>> body,List<String> colspecs){
  List<DocumentElement> row=new ArrayList<DocumentElement>();
  body.add(row);
  String name=DocGenUtils.getIndented(e.getName(),curdepth);
  if (curdepth == 1)   name+="String_Node_Str" + name + "String_Node_Str";
  row.add(new DBText(name));
  Integer numunit=typeUnits.get(e);
  if (numunit == null)   numunit=1;
  getDocAndProps(e,numunit,row,colspecs);
  getStereotypeProps(e,row);
  body.add(row);
  Set<Class> set=consolidated.get(e).keySet();
  List<Element> list=Utils.sortByName(Utils2.asList(set,Element.class));
  for (  Element ee : list) {
    getHierarchyConsolidated((Class)ee,curdepth + 1,consolidated.get(e),consolidated,body,colspecs);
  }
}
Program: 88662
Project: 88662
Buggy source:
private void getHierarchy(NamedElement e,int curdepth,Map<Class,Map<Property,Class>> childMap,List<List<DocumentElement>> body,List<String> colspecs){
  List<DocumentElement> row=new ArrayList<DocumentElement>();
  Class type=null;
  if (e instanceof Property)   type=(Class)((Property)e).getType();
 else   type=(Class)e;
  String name=DocGenUtils.getIndented(e.getName(),curdepth);
  if (this.showType && e instanceof Property && ((Property)e).getType() != null)   name+="String_Node_Str" + ((Property)e).getType().getName() + "String_Node_Str";
  if (curdepth == 1)   name="String_Node_Str" + name + "String_Node_Str";
  row.add(new DBText(name));
  Integer numunit=1;
  if (e instanceof Property)   numunit=Utils.getMultiplicity((Property)e);
  getDocAndProps(type,numunit,row,colspecs);
  getStereotypeProps(type,row);
  body.add(row);
  for (  Element ee : Utils.sortByName(new HashSet<Element>(childMap.get(type).keySet()))) {
    getHierarchy((NamedElement)ee,curdepth + 1,childMap,body,colspecs);
  }
}

Fixed version (ground truth):
private void getHierarchy(NamedElement e,int curdepth,Map<Class,Map<Property,Class>> childMap,List<List<DocumentElement>> body,List<String> colspecs){
  List<DocumentElement> row=new ArrayList<DocumentElement>();
  Class type=null;
  if (e instanceof Property)   type=(Class)((Property)e).getType();
 else   type=(Class)e;
  String name=DocGenUtils.getIndented(e.getName(),curdepth);
  if (this.showType && e instanceof Property && ((Property)e).getType() != null)   name+="String_Node_Str" + ((Property)e).getType().getName() + "String_Node_Str";
  if (curdepth == 1)   name="String_Node_Str" + name + "String_Node_Str";
  row.add(new DBText(name));
  Integer numunit=1;
  if (e instanceof Property)   numunit=Utils.getMultiplicity((Property)e);
  getDocAndProps(type,numunit,row,colspecs);
  getStereotypeProps(type,row);
  body.add(row);
  Set<Property> set=childMap.get(type).keySet();
  List<Element> list=Utils.sortByName(Utils2.asList(set,Element.class));
  for (  Element ee : list) {
    getHierarchy((NamedElement)ee,curdepth + 1,childMap,body,colspecs);
  }
}
Program: 88665
Project: 88665
Buggy source:
@SuppressWarnings("String_Node_Str") private JSONObject getInfo(Element e){
  JSONObject elementInfo=new JSONObject();
  JSONArray value=new JSONArray();
  if (e instanceof Property) {
    ValueSpecification vs=((Property)e).getDefaultValue();
    if (vs != null) {
      addValues(e,value,elementInfo,vs);
    }
  }
 else   if (e instanceof Slot) {
    List<ValueSpecification> vsl=((Slot)e).getValue();
    if (vsl != null && vsl.size() > 0) {
      for (      ValueSpecification vs : vsl) {
        addValues(e,value,elementInfo,vs);
      }
    }
  }
  elementInfo.put("String_Node_Str",ExportUtility.getElementID(e));
  return elementInfo;
}

Fixed version (ground truth):
@SuppressWarnings("String_Node_Str") private JSONObject getInfo(Element e){
  JSONObject elementInfo=new JSONObject();
  JSONArray value=new JSONArray();
  if (e instanceof Property) {
    ValueSpecification vs=((Property)e).getDefaultValue();
    if (vs != null) {
      ExportUtility.addValues(e,value,elementInfo,vs);
    }
  }
 else   if (e instanceof Slot) {
    List<ValueSpecification> vsl=((Slot)e).getValue();
    if (vsl != null && vsl.size() > 0) {
      for (      ValueSpecification vs : vsl) {
        ExportUtility.addValues(e,value,elementInfo,vs);
      }
    }
  }
  elementInfo.put("String_Node_Str",ExportUtility.getElementID(e));
  return elementInfo;
}
Program: 88666
Project: 88666
Buggy source:
@Override public void execute(Collection<Annotation> annos){
  SessionManager.getInstance().createSession("String_Node_Str");
  Project prj=Application.getInstance().getProject();
  Collection<Annotation> toremove=new HashSet<Annotation>();
  try {
    for (    Annotation anno : annos) {
      Element e=(Element)anno.getTarget();
      if (!e.isEditable()) {
        continue;
      }
      String ownerID=(String)((JSONObject)((JSONObject)result.get("String_Node_Str")).get(e.getID())).get("String_Node_Str");
      if (ownerID == null)       continue;
      Element own=(Element)prj.getElementByID(ownerID);
      if (own != null)       e.setOwner(own);
      toremove.add(anno);
    }
    SessionManager.getInstance().closeSession();
    saySuccess();
    this.removeViolationsAndUpdateWindow(toremove);
  }
 catch (  Exception ex) {
    SessionManager.getInstance().cancelSession();
    Utils.printException(ex);
  }
}

Fixed version (ground truth):
@Override public void execute(Collection<Annotation> annos){
  SessionManager.getInstance().createSession("String_Node_Str");
  Project prj=Application.getInstance().getProject();
  Collection<Annotation> toremove=new HashSet<Annotation>();
  try {
    for (    Annotation anno : annos) {
      Element e=(Element)anno.getTarget();
      if (!e.isEditable()) {
        continue;
      }
      String ownerID=(String)((Map<String,JSONObject>)result.get("String_Node_Str")).get(e.getID()).get("String_Node_Str");
      if (ownerID == null)       continue;
      Element own=(Element)prj.getElementByID(ownerID);
      if (own != null)       e.setOwner(own);
      toremove.add(anno);
    }
    SessionManager.getInstance().closeSession();
    saySuccess();
    this.removeViolationsAndUpdateWindow(toremove);
  }
 catch (  Exception ex) {
    SessionManager.getInstance().cancelSession();
    Utils.printException(ex);
  }
}
Program: 88667
Project: 88667
Buggy source:
@SuppressWarnings("String_Node_Str") @Override public void actionPerformed(ActionEvent e){
  if (!element.isEditable()) {
    Application.getInstance().getGUILog().log("String_Node_Str");
    return;
  }
  SessionManager.getInstance().createSession("String_Node_Str");
  try {
    element.setBody(Utils.addHtmlWrapper(doc));
    element.getAnnotatedElement().clear();
    JSONArray annotatedElements=(JSONArray)((JSONObject)((JSONObject)result.get("String_Node_Str")).get(element.getID())).get("String_Node_Str");
    if (annotatedElements != null) {
      for (      String eid : (List<String>)annotatedElements) {
        Element aelement=(Element)Application.getInstance().getProject().getElementByID(eid);
        if (aelement != null)         element.getAnnotatedElement().add(aelement);
      }
    }
    SessionManager.getInstance().closeSession();
    saySuccess();
    this.removeViolationAndUpdateWindow();
  }
 catch (  Exception ex) {
    SessionManager.getInstance().cancelSession();
    Utils.printException(ex);
  }
}

Fixed version (ground truth):
@SuppressWarnings("String_Node_Str") @Override public void actionPerformed(ActionEvent e){
  if (!element.isEditable()) {
    Application.getInstance().getGUILog().log("String_Node_Str");
    return;
  }
  SessionManager.getInstance().createSession("String_Node_Str");
  try {
    element.setBody(Utils.addHtmlWrapper(doc));
    element.getAnnotatedElement().clear();
    JSONArray annotatedElements=(JSONArray)((Map<String,JSONObject>)result.get("String_Node_Str")).get(element.getID()).get("String_Node_Str");
    if (annotatedElements != null) {
      for (      String eid : (List<String>)annotatedElements) {
        Element aelement=(Element)Application.getInstance().getProject().getElementByID(eid);
        if (aelement != null)         element.getAnnotatedElement().add(aelement);
      }
    }
    SessionManager.getInstance().closeSession();
    saySuccess();
    this.removeViolationAndUpdateWindow();
  }
 catch (  Exception ex) {
    SessionManager.getInstance().cancelSession();
    Utils.printException(ex);
  }
}