nus-yam/ex-repair huggingface dataset:
Program: 88668
Project: 88668
Buggy source:
@SuppressWarnings("String_Node_Str") @Override public void execute(Collection<Annotation> annos){
  SessionManager.getInstance().createSession("String_Node_Str");
  Collection<Annotation> toremove=new HashSet<Annotation>();
  try {
    for (    Annotation anno : annos) {
      Element e=(Element)anno.getTarget();
      if (!e.isEditable()) {
        continue;
      }
      String resultDoc=(String)((JSONObject)((JSONObject)result.get("String_Node_Str")).get(e.getID())).get("String_Node_Str");
      if (resultDoc == null)       continue;
      ((Comment)e).setBody(Utils.addHtmlWrapper(resultDoc));
      ((Comment)e).getAnnotatedElement().clear();
      JSONArray annotatedElements=(JSONArray)((JSONObject)((JSONObject)result.get("String_Node_Str")).get(e.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)           ((Comment)e).getAnnotatedElement().add(aelement);
        }
      }
      toremove.add(anno);
    }
    SessionManager.getInstance().closeSession();
    saySuccess();
    this.removeViolationsAndUpdateWindow(toremove);
  }
 catch (  Exception ex) {
    SessionManager.getInstance().cancelSession();
    Utils.printException(ex);
  }
}

Fixed version (ground truth):
@SuppressWarnings("String_Node_Str") @Override public void execute(Collection<Annotation> annos){
  SessionManager.getInstance().createSession("String_Node_Str");
  Collection<Annotation> toremove=new HashSet<Annotation>();
  try {
    for (    Annotation anno : annos) {
      Element e=(Element)anno.getTarget();
      if (!e.isEditable()) {
        continue;
      }
      String resultDoc=(String)((Map<String,JSONObject>)result.get("String_Node_Str")).get(e.getID()).get("String_Node_Str");
      if (resultDoc == null)       continue;
      ((Comment)e).setBody(Utils.addHtmlWrapper(resultDoc));
      ((Comment)e).getAnnotatedElement().clear();
      JSONArray annotatedElements=(JSONArray)((JSONObject)((JSONObject)result.get("String_Node_Str")).get(e.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)           ((Comment)e).getAnnotatedElement().add(aelement);
        }
      }
      toremove.add(anno);
    }
    SessionManager.getInstance().closeSession();
    saySuccess();
    this.removeViolationsAndUpdateWindow(toremove);
  }
 catch (  Exception ex) {
    SessionManager.getInstance().cancelSession();
    Utils.printException(ex);
  }
}
Program: 88669
Project: 88669
Buggy source:
@Override public void execute(Collection<Annotation> annos){
  SessionManager.getInstance().createSession("String_Node_Str");
  Collection<Annotation> toremove=new HashSet<Annotation>();
  try {
    for (    Annotation anno : annos) {
      Element e=(Element)anno.getTarget();
      if (!e.isEditable()) {
        continue;
      }
      String resultDoc=(String)((JSONObject)((JSONObject)result.get("String_Node_Str")).get(e.getID())).get("String_Node_Str");
      if (resultDoc == null)       continue;
      ModelHelper.setComment(e,Utils.addHtmlWrapper(resultDoc));
      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");
  Collection<Annotation> toremove=new HashSet<Annotation>();
  try {
    for (    Annotation anno : annos) {
      Element e=(Element)anno.getTarget();
      if (!e.isEditable()) {
        continue;
      }
      String resultDoc=(String)((Map<String,JSONObject>)result.get("String_Node_Str")).get(e.getID()).get("String_Node_Str");
      if (resultDoc == null)       continue;
      ModelHelper.setComment(e,Utils.addHtmlWrapper(resultDoc));
      toremove.add(anno);
    }
    SessionManager.getInstance().closeSession();
    saySuccess();
    this.removeViolationsAndUpdateWindow(toremove);
  }
 catch (  Exception ex) {
    SessionManager.getInstance().cancelSession();
    Utils.printException(ex);
  }
}
Program: 88670
Project: 88670
Buggy source:
@Override public void execute(Collection<Annotation> annos){
  SessionManager.getInstance().createSession("String_Node_Str");
  Collection<Annotation> toremove=new HashSet<Annotation>();
  try {
    for (    Annotation anno : annos) {
      Element e=(Element)anno.getTarget();
      if (!e.isEditable()) {
        continue;
      }
      String resultName=ExportUtility.unescapeHtml((String)((JSONObject)((JSONObject)result.get("String_Node_Str")).get(e.getID())).get("String_Node_Str"));
      if (resultName == null)       continue;
      ((NamedElement)e).setName(resultName);
      toremove.add(anno);
    }
    SessionManager.getInstance().closeSession();
    saySuccess();
    this.removeViolationsAndUpdateWindow(toremove);
  }
 catch (  Exception ex) {
    SessionManager.getInstance().cancelSession();
  }
}

Fixed version (ground truth):
@Override public void execute(Collection<Annotation> annos){
  SessionManager.getInstance().createSession("String_Node_Str");
  Collection<Annotation> toremove=new HashSet<Annotation>();
  try {
    for (    Annotation anno : annos) {
      Element e=(Element)anno.getTarget();
      if (!e.isEditable()) {
        continue;
      }
      String resultName=ExportUtility.unescapeHtml((String)((Map<String,JSONObject>)result.get("String_Node_Str")).get(e.getID()).get("String_Node_Str"));
      if (resultName == null)       continue;
      ((NamedElement)e).setName(resultName);
      toremove.add(anno);
    }
    SessionManager.getInstance().closeSession();
    saySuccess();
    this.removeViolationsAndUpdateWindow(toremove);
  }
 catch (  Exception ex) {
    SessionManager.getInstance().cancelSession();
  }
}
Program: 88671
Project: 88671
Buggy source:
@Override public void actionPerformed(ActionEvent e){
  if (!element.isEditable()) {
    Application.getInstance().getGUILog().log("String_Node_Str" + element.getHumanName() + "String_Node_Str");
    return;
  }
  SessionManager.getInstance().createSession("String_Node_Str");
  try {
    String sourceId=(String)((JSONObject)((JSONObject)result.get("String_Node_Str")).get(element.getID())).get("String_Node_Str");
    String targetId=(String)((JSONObject)((JSONObject)result.get("String_Node_Str")).get(element.getID())).get("String_Node_Str");
    Element source=(Element)Application.getInstance().getProject().getElementByID(sourceId);
    Element target=(Element)Application.getInstance().getProject().getElementByID(targetId);
    ModelHelper.setClientElement(element,source);
    ModelHelper.setSupplierElement(element,target);
    SessionManager.getInstance().closeSession();
    saySuccess();
    this.removeViolationAndUpdateWindow();
  }
 catch (  Exception ex) {
    SessionManager.getInstance().cancelSession();
    Utils.printException(ex);
  }
}

Fixed version (ground truth):
@Override public void actionPerformed(ActionEvent e){
  if (!element.isEditable()) {
    Application.getInstance().getGUILog().log("String_Node_Str" + element.getHumanName() + "String_Node_Str");
    return;
  }
  SessionManager.getInstance().createSession("String_Node_Str");
  try {
    String sourceId=(String)((Map<String,JSONObject>)result.get("String_Node_Str")).get(element.getID()).get("String_Node_Str");
    String targetId=(String)((Map<String,JSONObject>)result.get("String_Node_Str")).get(element.getID()).get("String_Node_Str");
    Element source=(Element)Application.getInstance().getProject().getElementByID(sourceId);
    Element target=(Element)Application.getInstance().getProject().getElementByID(targetId);
    ModelHelper.setClientElement(element,source);
    ModelHelper.setSupplierElement(element,target);
    SessionManager.getInstance().closeSession();
    saySuccess();
    this.removeViolationAndUpdateWindow();
  }
 catch (  Exception ex) {
    SessionManager.getInstance().cancelSession();
    Utils.printException(ex);
  }
}
Program: 88672
Project: 88672
Buggy source:
@Override public void execute(Collection<Annotation> annos){
  SessionManager.getInstance().createSession("String_Node_Str");
  Collection<Annotation> toremove=new HashSet<Annotation>();
  try {
    for (    Annotation anno : annos) {
      Element e=(Element)anno.getTarget();
      if (!e.isEditable()) {
        continue;
      }
      String sourceId=(String)((JSONObject)((JSONObject)result.get("String_Node_Str")).get(e.getID())).get("String_Node_Str");
      String targetId=(String)((JSONObject)((JSONObject)result.get("String_Node_Str")).get(e.getID())).get("String_Node_Str");
      Element source=(Element)Application.getInstance().getProject().getElementByID(sourceId);
      Element target=(Element)Application.getInstance().getProject().getElementByID(targetId);
      ModelHelper.setClientElement(e,source);
      ModelHelper.setSupplierElement(e,target);
      toremove.add(anno);
    }
    SessionManager.getInstance().closeSession();
    saySuccess();
    this.removeViolationsAndUpdateWindow(toremove);
  }
 catch (  Exception ex) {
    SessionManager.getInstance().cancelSession();
  }
}

Fixed version (ground truth):
@Override public void execute(Collection<Annotation> annos){
  SessionManager.getInstance().createSession("String_Node_Str");
  Collection<Annotation> toremove=new HashSet<Annotation>();
  try {
    for (    Annotation anno : annos) {
      Element e=(Element)anno.getTarget();
      if (!e.isEditable()) {
        continue;
      }
      String sourceId=(String)((Map<String,JSONObject>)result.get("String_Node_Str")).get(e.getID()).get("String_Node_Str");
      String targetId=(String)((Map<String,JSONObject>)result.get("String_Node_Str")).get(e.getID()).get("String_Node_Str");
      Element source=(Element)Application.getInstance().getProject().getElementByID(sourceId);
      Element target=(Element)Application.getInstance().getProject().getElementByID(targetId);
      ModelHelper.setClientElement(e,source);
      ModelHelper.setSupplierElement(e,target);
      toremove.add(anno);
    }
    SessionManager.getInstance().closeSession();
    saySuccess();
    this.removeViolationsAndUpdateWindow(toremove);
  }
 catch (  Exception ex) {
    SessionManager.getInstance().cancelSession();
  }
}
Program: 88673
Project: 88673
Buggy source:
@Override public void execute(Collection<Annotation> annos){
  SessionManager.getInstance().createSession("String_Node_Str");
  Collection<Annotation> toremove=new HashSet<Annotation>();
  try {
    for (    Annotation anno : annos) {
      Element e=(Element)anno.getTarget();
      if (!e.isEditable()) {
        Application.getInstance().getGUILog().log("String_Node_Str" + element.getHumanName() + "String_Node_Str");
        continue;
      }
      PropertyValueType valueType=PropertyValueType.valueOf((String)((JSONObject)((JSONObject)result.get("String_Node_Str")).get(e.getID())).get("String_Node_Str"));
      JSONArray vals=(JSONArray)((JSONObject)((JSONObject)result.get("String_Node_Str")).get(e.getID())).get("String_Node_Str");
      if (e instanceof Property) {
        if (vals == null || vals.isEmpty()) {
          ((Property)e).setDefaultValue(null);
        }
 else {
          update((Property)e,valueType,vals.get(0));
        }
      }
 else       if (e instanceof Slot) {
        if (values == null || values.isEmpty()) {
          ((Slot)element).getValue().clear();
        }
 else {
          update((Slot)e,type,values);
        }
      }
      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");
  Collection<Annotation> toremove=new HashSet<Annotation>();
  try {
    for (    Annotation anno : annos) {
      Element e=(Element)anno.getTarget();
      if (!e.isEditable()) {
        Application.getInstance().getGUILog().log("String_Node_Str" + element.getHumanName() + "String_Node_Str");
        continue;
      }
      PropertyValueType valueType=PropertyValueType.valueOf((String)((Map<String,JSONObject>)result.get("String_Node_Str")).get(e.getID()).get("String_Node_Str"));
      JSONArray vals=(JSONArray)((Map<String,JSONObject>)result.get("String_Node_Str")).get(e.getID()).get("String_Node_Str");
      if (e instanceof Property) {
        if (vals == null || vals.isEmpty()) {
          ((Property)e).setDefaultValue(null);
        }
 else {
          update((Property)e,valueType,vals.get(0));
        }
      }
 else       if (e instanceof Slot) {
        if (values == null || values.isEmpty()) {
          ((Slot)element).getValue().clear();
        }
 else {
          update((Slot)e,type,values);
        }
      }
      toremove.add(anno);
    }
    SessionManager.getInstance().closeSession();
    saySuccess();
    this.removeViolationsAndUpdateWindow(toremove);
  }
 catch (  Exception ex) {
    SessionManager.getInstance().cancelSession();
    Utils.printException(ex);
  }
}
Program: 88674
Project: 88674
Buggy source:
@Override public List<DocumentElement> visit(boolean forViewEditor,String outputDir){
  List<DocumentElement> res=new ArrayList<DocumentElement>();
  if (!init())   return res;
  DBTable table=new DBTable();
  Node<String,MissionComponent> root=getRoot();
  List<Element> chars=Utils.sortByName(getLibraryCharacterizations());
  List<List<DocumentElement>> grid=new ArrayList<List<DocumentElement>>();
  List<List<DocumentElement>> headers=new ArrayList<List<DocumentElement>>();
  addMissionRows(root,chars,grid,1);
  table.setBody(grid);
  List<DocumentElement> headerrow=new ArrayList<DocumentElement>();
  headerrow.add(new DBText("String_Node_Str"));
  headerrow.add(new DBText("String_Node_Str"));
  for (  Element charr : chars) {
    headerrow.add(new DBText(((NamedElement)charr).getName()));
  }
  headers.add(headerrow);
  table.setHeaders(headers);
  table.setCols(headerrow.size());
  table.setTitle("String_Node_Str");
  res.add(table);
  return res;
}

Fixed version (ground truth):
@Override public List<DocumentElement> visit(boolean forViewEditor,String outputDir){
  List<DocumentElement> res=new ArrayList<DocumentElement>();
  if (!init())   return res;
  DBTable table=new DBTable();
  Node<String,MissionComponent> root=getRoot();
  List<Element> chars=Utils.sortByName(Utils2.asList(getLibraryCharacterizations(),Element.class));
  List<List<DocumentElement>> grid=new ArrayList<List<DocumentElement>>();
  List<List<DocumentElement>> headers=new ArrayList<List<DocumentElement>>();
  addMissionRows(root,chars,grid,1);
  table.setBody(grid);
  List<DocumentElement> headerrow=new ArrayList<DocumentElement>();
  headerrow.add(new DBText("String_Node_Str"));
  headerrow.add(new DBText("String_Node_Str"));
  for (  Element charr : chars) {
    headerrow.add(new DBText(((NamedElement)charr).getName()));
  }
  headers.add(headerrow);
  table.setHeaders(headers);
  table.setCols(headerrow.size());
  table.setTitle("String_Node_Str");
  res.add(table);
  return res;
}
Program: 88675
Project: 88675
Buggy source:
public EditableListPanel(String msg,Object[] items){
  super(new SpringLayout());
  SpringLayout layout=(SpringLayout)getLayout();
  setItems(items);
  JLabel label=new JLabel(msg);
  resultPane=createEditorPane("String_Node_Str");
  resultScrollPane=new JScrollPane(resultPane,ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED,ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED);
  add(label);
  add(jcb);
  add(resultScrollPane);
  layout.putConstraint(SpringLayout.WEST,label,5,SpringLayout.WEST,this);
  layout.putConstraint(SpringLayout.NORTH,jcb,5,SpringLayout.SOUTH,label);
  layout.putConstraint(SpringLayout.WEST,jcb,5,SpringLayout.WEST,this);
  layout.putConstraint(SpringLayout.EAST,jcb,5,SpringLayout.EAST,this);
  layout.putConstraint(SpringLayout.NORTH,resultScrollPane,5,SpringLayout.SOUTH,jcb);
  layout.putConstraint(SpringLayout.WEST,resultScrollPane,5,SpringLayout.WEST,this);
  layout.putConstraint(SpringLayout.EAST,resultScrollPane,5,SpringLayout.EAST,this);
  layout.putConstraint(SpringLayout.SOUTH,resultScrollPane,5,SpringLayout.SOUTH,this);
  addAncestorListener(new RequestFocusListener());
}

Fixed version (ground truth):
public EditableListPanel(String msg,Object[] items){
  super(new SpringLayout());
  SpringLayout layout=(SpringLayout)getLayout();
  setItems(items);
  JLabel label=new JLabel(msg);
  resultPane=createEditorPane("String_Node_Str");
  resultScrollPane=new JScrollPane(resultPane,ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED,ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED);
  add(label);
  add(jcb);
  add(resultScrollPane);
  layout.putConstraint(SpringLayout.NORTH,label,5,SpringLayout.NORTH,this);
  layout.putConstraint(SpringLayout.WEST,label,5,SpringLayout.WEST,this);
  layout.putConstraint(SpringLayout.NORTH,jcb,5,SpringLayout.SOUTH,label);
  layout.putConstraint(SpringLayout.WEST,jcb,5,SpringLayout.WEST,this);
  layout.putConstraint(SpringLayout.EAST,jcb,-5,SpringLayout.EAST,this);
  layout.putConstraint(SpringLayout.NORTH,resultScrollPane,5,SpringLayout.SOUTH,jcb);
  layout.putConstraint(SpringLayout.WEST,resultScrollPane,5,SpringLayout.WEST,this);
  layout.putConstraint(SpringLayout.EAST,resultScrollPane,-5,SpringLayout.EAST,this);
  layout.putConstraint(SpringLayout.SOUTH,resultScrollPane,-5,SpringLayout.SOUTH,this);
  addAncestorListener(new RequestFocusListener());
}
Program: 88678
Project: 88678
Buggy source:
/** 
 * Create a BasicConstraint on one of two Elements or Collections.
 * @param constraintElement the model element representing the constraint
 * @param constrained1 the first candidate to be constrained
 * @param constrained2 the second candidate to be constrained
 * @return a BasicConstraint on the first candidate if the evaluation worksor the evaluation does not work with the second candidate; otherwise return a BasicConstraint on the second candidate.
 */
public static BasicConstraint makeConstraint(Object constraintElement,Object... candidateContexts){
  BasicConstraint c=null;
  if (!Utils2.isNullOrEmpty(candidateContexts)) {
    BasicConstraint firstNull=null;
    Boolean result=null;
    for (    Object constrained : candidateContexts) {
      c=new BasicConstraint(constraintElement,constrained);
      result=c.evaluate(false);
      if (result != null) {
        break;
      }
 else       if (firstNull == null || (Utils2.isNullOrEmpty(firstNull.getConstrainedObjects()) && !Utils2.isNullOrEmpty(c.getConstrainedObjects()))) {
        firstNull=c;
      }
    }
    if (result == null)     c=firstNull;
  }
  if (c == null) {
    Object constrained=Utils2.isNullOrEmpty(candidateContexts) ? null : candidateContexts[0];
    c=new BasicConstraint(constraintElement,constrained);
  }
  return c;
}

Fixed version (ground truth):
public static BasicConstraint makeConstraint(Element constraintElement){
  if (!elementIsConstraint(constraintElement))   return null;
  List<Object> constrained=getConstrainedObjectsFromConstraintElement(constraintElement);
  BasicConstraint c=new BasicConstraint(constraintElement,constrained);
  return c;
}
Program: 88679
Project: 88679
Buggy source:
@Override public Set<Element> getConstrainingElements(){
  if (constrainingElements == null) {
    constrainingElements=new LinkedHashSet<Element>();
  }
  return constrainingElements;
}

Fixed version (ground truth):
public Set<Element> getConstrainingElements(Type type){
  if (constrainingElements == null) {
    constrainingElements=new LinkedHashSet<Element>();
  }
  if (type == Type.ANY)   return constrainingElements;
  Set<Element> filtered=new LinkedHashSet<Element>();
  for (  Element c : constrainingElements) {
    if (constraintIsType(c,type)) {
      filtered.add(c);
    }
  }
  return filtered;
}
Program: 88680
Project: 88680
Buggy source:
public static List<Constraint> getConstraints(Object constrainedObject){
  List<Constraint> constraints=new ArrayList<Constraint>();
  List<Element> constraintElements=getConstraintElements(constrainedObject);
  for (  Element constraint : constraintElements) {
    Constraint c=BasicConstraint.makeConstraint(constraint,constrainedObject);
    constraints.add(c);
  }
  return constraints;
}

Fixed version (ground truth):
public static List<Constraint> getConstraints(Object constrainedObject,Type type){
  List<Constraint> constraints=new ArrayList<Constraint>();
  List<Element> constraintElements=getConstraintElements(constrainedObject,type);
  for (  Element constraint : constraintElements) {
    Constraint c=BasicConstraint.makeConstraint(constraint);
    if (c != null)     constraints.add(c);
  }
  return constraints;
}
Program: 88681
Project: 88681
Buggy source:
public static String getExpression(Object constraint){
  if (constraint instanceof Constraint)   return ((Constraint)constraint).getExpression();
  String expr=null;
  if (constraint instanceof Element) {
    Element e=(Element)constraint;
    if (e instanceof com.nomagic.uml2.ext.magicdraw.classes.mdkernel.Constraint) {
      com.nomagic.uml2.ext.magicdraw.classes.mdkernel.Constraint c=(com.nomagic.uml2.ext.magicdraw.classes.mdkernel.Constraint)e;
      expr=DocGenUtils.fixString(c.getSpecification());
    }
 else     if (GeneratorUtils.hasStereotypeByString(e,DocGen3Profile.constraintStereotype,true)) {
      Object v=GeneratorUtils.getObjectProperty(e,DocGen3Profile.constraintStereotype,"String_Node_Str",null);
      expr=v.toString();
    }
  }
  if (Utils2.isNullOrEmpty(expr)) {
    expr=OclEvaluator.queryObjectToStringExpression(constraint);
  }
  return expr;
}

Fixed version (ground truth):
public static String getExpression(Object constraint){
  if (constraint instanceof Constraint)   return ((Constraint)constraint).getExpression();
  String expr=null;
  if (constraint instanceof Element) {
    Element e=(Element)constraint;
    if (elementIsUmlConstraint(e)) {
      expr=DocGenUtils.fixString(asUmlConstraint(e).getSpecification());
    }
 else     if (GeneratorUtils.hasStereotypeByString(e,DocGen3Profile.constraintStereotype,true)) {
      Object v=GeneratorUtils.getObjectProperty(e,DocGen3Profile.constraintStereotype,"String_Node_Str",null);
      expr=v.toString();
    }
  }
  if (Utils2.isNullOrEmpty(expr)) {
    expr=OclEvaluator.queryObjectToStringExpression(constraint);
  }
  return expr;
}
Program: 88682
Project: 88682
Buggy source:
public String toShortString(){
  StringBuffer sb=new StringBuffer();
  sb.append("String_Node_Str" + this.getExpression() + "String_Node_Str"+ EmfUtils.toString(this.constrainedObjects));
  return sb.toString();
}

Fixed version (ground truth):
public String toShortString(){
  StringBuffer sb=new StringBuffer();
  sb.append("String_Node_Str" + this.getExpression() + "String_Node_Str"+ Utils.toStringNameAndType(this.constrainedObjects,false,true));
  return sb.toString();
}
Program: 88683
Project: 88683
Buggy source:
/** 
 * @param constrainingElement
 * @param constrainedElement
 */
public BasicConstraint(Object constraint,Object constrained){
  addConstrainingObject(constraint);
  addConstrainedObject(constrained);
}

Fixed version (ground truth):
/** 
 * @param constrainingElement
 * @param constrainedElement
 */
public BasicConstraint(Object constraint,Collection<Object> constrained){
  addConstrainingObject(constraint);
  addConstrainedObjects((Collection<Object>)constrained);
}
Program: 88684
Project: 88684
Buggy source:
protected Boolean evaluate(Object constrainedObject,boolean complainIfFails){
  boolean gotNull=false;
  isConsistent=true;
  errorMessage=null;
  for (  Element constraint : getConstrainingElements()) {
    Object res=null;
    try {
      res=OclEvaluator.evaluateQuery(constrainedObject,constraint);
      OclEvaluator evaluator=OclEvaluator.instance;
      if (isConsistent)       isConsistent=evaluator.isValid();
    }
 catch (    Exception e) {
      this.errorMessage=e.getLocalizedMessage() + "String_Node_Str" + getExpression(constraint)+ "String_Node_Str"+ EmfUtils.toString(constrainedObject);
      try {
        Debug.error(complainIfFails,false,this.errorMessage);
      }
 catch (      Exception ex) {
        System.err.println(this.errorMessage);
      }
      isConsistent=false;
    }
    if (res == null) {
      gotNull=true;
    }
 else     if (!Utils.isTrue(res,false)) {
      violatedConstraintElement=constraint;
      if (constrainedObject instanceof Element) {
        violatedConstrainedElement=(Element)constrainedObject;
      }
      return false;
    }
  }
  return gotNull ? null : true;
}

Fixed version (ground truth):
protected Boolean evaluate(Object constrainedObject,boolean complainIfFails){
  boolean gotNull=false;
  isConsistent=true;
  errorMessage=null;
  for (  Element constraint : getConstrainingElements()) {
    Object res=null;
    try {
      res=OclEvaluator.evaluateQuery(constrainedObject,constraint);
      OclEvaluator evaluator=OclEvaluator.instance;
      if (isConsistent)       isConsistent=evaluator.isValid();
    }
 catch (    Exception e) {
      this.errorMessage=e.getLocalizedMessage() + "String_Node_Str" + getExpression(constraint)+ "String_Node_Str"+ Utils.toStringNameAndType(constrainedObject,true,true);
      try {
        Debug.error(complainIfFails,false,this.errorMessage);
      }
 catch (      Exception ex) {
        System.err.println(this.errorMessage);
      }
      isConsistent=false;
    }
    if (res == null) {
      gotNull=true;
    }
 else     if (!Utils.isTrue(res,false)) {
      violatedConstraintElement=constraint;
      if (constrainedObject instanceof Element) {
        violatedConstrainedElement=(Element)constrainedObject;
      }
      return false;
    }
  }
  return gotNull ? null : true;
}
Program: 88685
Project: 88685
Buggy source:
public static Boolean evaluateAgainst(Object constraint,Object constrained,List<Object> targets){
  BasicConstraint c=makeConstraint(constraint,targets,constrained);
  Boolean result=c.evaluate();
  return result;
}

Fixed version (ground truth):
public static Boolean evaluateAgainst(Object constraint,Object constrained,List<Object> targets){
  BasicConstraint c=makeConstraintFromAlternativeContexts(constraint,targets,constrained);
  Boolean result=c.evaluate();
  return result;
}
Program: 88687
Project: 88687
Buggy source:
public static void log(final String s,final boolean addNewLine,final boolean isErr,final Color color){
  if (!Debug.on)   return;
  if (isGuiThread()) {
    logUnsafe(s,addNewLine,isErr,color);
    return;
  }
  try {
    SwingUtilities.invokeLater(new Runnable(){
      @Override public void run(){
        logUnsafe(s,addNewLine,isErr,color);
      }
    }
);
  }
 catch (  Exception e) {
    System.err.println(e.getLocalizedMessage());
  }
}

Fixed version (ground truth):
public static void log(final String s,final boolean addNewLine,final boolean isErr,final Color color){
  if (!Debug.on)   return;
  logForce(s,addNewLine,isErr,color);
}
Program: 88688
Project: 88688
Buggy source:
public static void logUnsafe(final String s,final boolean addNewLine,final boolean isErr,final Color color){
  if (!Debug.isOn())   return;
  String ss=s;
  Color newColor=color;
  StringBuffer sb=(isErr ? glErrBuf : glBuf);
  if (addNewLine) {
    ss=sb.toString() + ss + "String_Node_Str";
  }
  if (isErr && addNewLine) {
    if (newColor == null) {
      newColor=Color.RED;
    }
    ss="String_Node_Str" + ss;
  }
 else {
    if (newColor == null) {
      newColor=Color.BLACK;
    }
  }
  if (!addNewLine) {
    sb.append(ss);
  }
 else   if (gl != null) {
    if (newColor != Color.BLACK) {
      logWithColor(ss,newColor);
    }
 else {
      gl.log(ss);
    }
    if (isErr)     glErrBuf=new StringBuffer();
 else     glBuf=new StringBuffer();
  }
  PrintStream stream=(isErr ? System.err : System.out);
  stream.print(ss);
  stream.flush();
}

Fixed version (ground truth):
public static void logUnsafe(final String s,final boolean addNewLine,final boolean isErr,final Color color){
  if (!Debug.isOn())   return;
}
Program: 88689
Project: 88689
Buggy source:
@Override public void run(){
  logUnsafe(s,addNewLine,isErr,color);
}

Fixed version (ground truth):
@Override public void run(){
  logUnsafeForce(s,addNewLine,isErr,color);
}
Program: 88690
Project: 88690
Buggy source:
/** 
 * @param obj
 * @return a name associated with this object whether a NameElement, anElement with a humanName, an EObject with a name property, or a Java Object with a name member.
 */
public static String getName(Object obj){
  if (obj instanceof NamedElement) {
    return ((NamedElement)obj).getName();
  }
  if (obj instanceof Element) {
    String humanName=((Element)obj).getHumanName();
    String[] arr=humanName.trim().split("String_Node_Str");
    if (arr != null) {
      if (arr.length == 2) {
        if (!Utils2.isNullOrEmpty(arr[0]) && !Utils2.isNullOrEmpty(arr[1])) {
          return arr[1];
        }
      }
    }
  }
  return EmfUtils.getName(obj);
}

Fixed version (ground truth):
/** 
 * @param obj
 * @return a name associated with this object whether a NameElement, anElement with a humanName, an EObject with a name property, or a Java Object with a name member.
 */
public static String getName(Object obj){
  if (obj instanceof NamedElement) {
    return ((NamedElement)obj).getName();
  }
  if (obj instanceof BaseElement) {
    String humanName=((BaseElement)obj).getHumanName();
    String[] arr=humanName.trim().split("String_Node_Str");
    if (arr != null) {
      if (arr.length == 2) {
        if (!Utils2.isNullOrEmpty(arr[0]) && !Utils2.isNullOrEmpty(arr[1])) {
          return arr[1];
        }
      }
    }
  }
  return EmfUtils.getName(obj);
}
Program: 88691
Project: 88691
Buggy source:
public static String toStringNoHash(Object o){
  return o.toString().replace(Integer.toHexString(o.hashCode()),"String_Node_Str");
}

Fixed version (ground truth):
public static String toStringNoHash(Object o){
  if (o == null)   return "String_Node_Str";
  return o.toString().replace(Integer.toHexString(o.hashCode()),"String_Node_Str");
}
Program: 88692
Project: 88692
Buggy source:
@Override public void actionPerformed(ActionEvent e){
  MdDebug.log("String_Node_Str");
  Collection<Element> selectedElements=MDUtils.getSelection(e,Configurator.lastContextIsDiagram);
  setContext(selectedElements);
  OclEvaluator.resetEnvironment();
  constraintRule.init(Utils.getProject(),null);
  Set<Annotation> annotations=constraintRule.run(Utils.getProject(),null,selectedElements);
  Utils.displayValidationWindow(validationOutput,"String_Node_Str");
  MdDebug.log("String_Node_Str");
}

Fixed version (ground truth):
@Override public void actionPerformed(ActionEvent e){
  Collection<Element> selectedElements=MDUtils.getSelection(e,Configurator.lastContextIsDiagram);
  setContext(selectedElements);
  OclEvaluator.resetEnvironment();
  constraintRule.constraintType=Type.STATIC;
  constraintRule.init(Utils.getProject(),null);
  constraintRule.run(Utils.getProject(),null,selectedElements);
  Utils.displayValidationWindow(validationOutput,"String_Node_Str");
}
Program: 88693
Project: 88693
Buggy source:
public static InitialNode findInitialNode(Element a){
  for (  Element e : a.getOwnedElement())   if (e instanceof InitialNode)   return (InitialNode)e;
  return null;
}

Fixed version (ground truth):
public static InitialNode findInitialNode(Element a){
  if (a == null)   return null;
  for (  Element e : a.getOwnedElement())   if (e instanceof InitialNode)   return (InitialNode)e;
  return null;
}
Program: 88694
Project: 88694
Buggy source:
public void actionPerformed(ActionEvent e){
  Collection<Element> selectedElements=MDUtils.getSelection(e);
  setContext(selectedElements);
  OclEvaluator.opsCache=null;
  boolean wasOn=Debug.isOn();
  Debug.turnOn();
  try {
    RepeatInputComboBoxDialog.showRepeatInputComboBoxDialog("String_Node_Str","String_Node_Str",new ProcessOclQuery(selectedElements));
  }
 catch (  Throwable t) {
    t.printStackTrace();
  }
  if (!wasOn)   Debug.turnOff();
}

Fixed version (ground truth):
public void actionPerformed(ActionEvent e){
  Collection<Element> selectedElements=MDUtils.getSelection(e);
  setContext(selectedElements);
  OclEvaluator.resetEnvironment();
  boolean wasOn=Debug.isOn();
  Debug.turnOn();
  try {
    RepeatInputComboBoxDialog.showRepeatInputComboBoxDialog("String_Node_Str","String_Node_Str",new ProcessOclQuery(selectedElements));
  }
 catch (  Throwable t) {
    t.printStackTrace();
  }
  if (!wasOn)   Debug.turnOff();
}
Program: 88695
Project: 88695
Buggy source:
@Override public Object process(Object input){
  String oclString=input == null ? null : input.toString();
  ArrayList<Object> outputList=new ArrayList<Object>();
  OclEvaluator.opsCache=null;
  if (Utils2.isNullOrEmpty(getContext())) {
    outputList=process(null,oclString);
  }
 else   for (  Element elem : getContext()) {
    ArrayList<Object> results=process(elem,oclString);
    if (results != null)     outputList.addAll(results);
  }
  if (outputList != null && outputList.size() == 1)   return outputList.get(0);
  return outputList;
}

Fixed version (ground truth):
@Override public Object process(Object input){
  String oclString=input == null ? null : input.toString();
  ArrayList<Object> outputList=new ArrayList<Object>();
  OclEvaluator.resetEnvironment();
  if (Utils2.isNullOrEmpty(getContext())) {
    outputList=process(null,oclString);
  }
 else   for (  Element elem : getContext()) {
    ArrayList<Object> results=process(elem,oclString);
    if (results != null)     outputList.addAll(results);
  }
  if (outputList != null && outputList.size() == 1)   return outputList.get(0);
  return outputList;
}
Program: 88696
Project: 88696
Buggy source:
@Override public void actionPerformed(ActionEvent e){
  Collection<Element> selectedElements=MDUtils.getSelection(e);
  setContext(selectedElements);
  OclEvaluator.opsCache=null;
  constraintRule.init(Utils.getProject(),null);
  Set<Annotation> annotations=constraintRule.run(Utils.getProject(),null,selectedElements);
  Utils.displayValidationWindow(validationOutput,"String_Node_Str");
}

Fixed version (ground truth):
@Override public void actionPerformed(ActionEvent e){
  Collection<Element> selectedElements=MDUtils.getSelection(e);
  setContext(selectedElements);
  OclEvaluator.resetEnvironment();
  constraintRule.init(Utils.getProject(),null);
  Set<Annotation> annotations=constraintRule.run(Utils.getProject(),null,selectedElements);
  Utils.displayValidationWindow(validationOutput,"String_Node_Str");
}
Program: 88698
Project: 88698
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.opsCache=null;
  OclEvaluator.useCachedOps=true;
}

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;
  OclEvaluator.resetEnvironment();
}
Program: 88699
Project: 88699
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" + paramConstraint + "String_Node_Str"+ paramCollection+ "String_Node_Str");
  OclEvaluator.opsCache=null;
  OclEvaluator.useCachedOps=true;
  initConstraintMaps(paramProject,paramCollection);
  Collection<gov.nasa.jpl.mbee.constraint.Constraint> constraints=(Collection<gov.nasa.jpl.mbee.constraint.Constraint>)(Utils2.isNullOrEmpty(elementsWithConstraints) ? (constraintToElementMap == null ? Utils2.newList() : constraintToElementMap.keySet()) : getAffectedConstraints(elementsWithConstraints));
  for (  gov.nasa.jpl.mbee.constraint.Constraint constraint : constraints) {
    try {
      Boolean satisfied=DocumentValidator.evaluateConstraint(constraint,this,false);
    }
 catch (    Throwable e) {
      Debug.error(true,false,"String_Node_Str" + e.getLocalizedMessage());
    }
  }
  Project project=Utils.getProject();
  Constraint cons=(Constraint)project.getElementByID("String_Node_Str");
  result=Utils.getAnnotations(this,project,cons);
  annotations=result;
  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" + paramConstraint + "String_Node_Str"+ paramCollection+ "String_Node_Str");
  OclEvaluator.resetEnvironment();
  initConstraintMaps(paramProject,paramCollection);
  Collection<gov.nasa.jpl.mbee.constraint.Constraint> constraints=(Collection<gov.nasa.jpl.mbee.constraint.Constraint>)(Utils2.isNullOrEmpty(elementsWithConstraints) ? (constraintToElementMap == null ? Utils2.newList() : constraintToElementMap.keySet()) : getAffectedConstraints(elementsWithConstraints));
  for (  gov.nasa.jpl.mbee.constraint.Constraint constraint : constraints) {
    try {
      Boolean satisfied=DocumentValidator.evaluateConstraint(constraint,this,false);
    }
 catch (    Throwable e) {
      Debug.error(true,false,"String_Node_Str" + e.getLocalizedMessage());
    }
  }
  Project project=Utils.getProject();
  Constraint cons=(Constraint)project.getElementByID("String_Node_Str");
  result=Utils.getAnnotations(this,project,cons);
  annotations=result;
  return result;
}
Program: 88700
Project: 88700
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 {
  setupEnvironment();
  if (queryString == null)   return null;
  OclEvaluator.createOclInstance(envFactory);
  setOclTracingEnabled(verbose);
  queryStatus=QueryStatus.VALID_OCL;
  if (context instanceof EObject) {
    getHelper().setContext(context == null ? null : ((EObject)context).eClass());
  }
 else   if (context instanceof Collection) {
    getHelper().setContext(context == null ? null : OCLStandardLibraryImpl.INSTANCE.getCollection());
  }
  Object result=null;
  basicDiagnostic=null;
  problemHandler=null;
  result=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 {
  if (needEnvironmentSetup()) {
    resetEnvironment();
    setupEnvironment();
  }
  if (queryString == null)   return null;
  setOclTracingEnabled(verbose);
  queryStatus=QueryStatus.VALID_OCL;
  if (context instanceof EObject) {
    getHelper().setContext(context == null ? null : ((EObject)context).eClass());
  }
 else   if (context instanceof Collection) {
    getHelper().setContext(context == null ? null : OCLStandardLibraryImpl.INSTANCE.getCollection());
  }
  Object result=null;
  basicDiagnostic=null;
  problemHandler=null;
  result=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: 88701
Project: 88701
Buggy source:
protected static DgEnvironmentFactory setupEnvironment(){
  DgEnvironmentFactory.reset();
  envFactory=new DgEnvironmentFactory();
  if (useCachedOps && !Utils2.isNullOrEmpty(opsCache)) {
    envFactory.getDgEnvironment().operations.addAll(opsCache);
  }
 else {
    addRegexMatchOperation(envFactory);
    addROperation(envFactory);
    addMOperation(envFactory);
    addTOperation(envFactory);
    addSOperation(envFactory);
    addNOperation(envFactory);
    addExpressionOperations(envFactory);
    opsCache=envFactory.getDgEnvironment().operations;
  }
  return envFactory;
}

Fixed version (ground truth):
protected static DgEnvironmentFactory setupEnvironment(){
  addRegexMatchOperation(getEnvironmentFactory());
  addROperation(getEnvironmentFactory());
  addMOperation(getEnvironmentFactory());
  addTOperation(getEnvironmentFactory());
  addSOperation(getEnvironmentFactory());
  addNOperation(getEnvironmentFactory());
  addExpressionOperations(getEnvironmentFactory());
  return getEnvironmentFactory();
}
Program: 88702
Project: 88702
Buggy source:
public static OCL<?,EClassifier,?,?,?,?,?,?,?,Constraint,EClass,EObject> getOcl(){
  if (ocl == null) {
    setOcl(OCL.newInstance(envFactory));
  }
  return ocl;
}

Fixed version (ground truth):
public static OCL<?,EClassifier,?,?,?,?,?,?,?,Constraint,EClass,EObject> getOcl(){
  if (ocl == null) {
    createOclInstance(getEnvironmentFactory());
  }
  return ocl;
}
Program: 88703
Project: 88703
Buggy source:
/** 
 * Evaluates the specified invariant (constraint given a particular context) Note that the evaluateQuery is more generic and can handle invariants as well
 * @param context			EObject of the context that the constraint should be checked against
 * @param constraintString	Valid OCL constraint string to be checked
 * @param verbose			Turns on OCL debugging if true, off if false 
 * @return					true if constraint is satisfied, false otherwise
 */
public static boolean checkConstraint(EObject context,String constraintString,boolean verbose){
  setOclTracingEnabled(verbose);
  queryStatus=QueryStatus.VALID_OCL;
  OCLHelper<EClassifier,?,?,Constraint> helper=ocl.createOCLHelper();
  helper.setContext(context.eClass());
  boolean ok=false;
  Constraint constraint=null;
  try {
    constraint=helper.createInvariant(constraintString);
  }
 catch (  ParserException e) {
    queryStatus=QueryStatus.PARSE_EXCEPTION;
    e.printStackTrace();
    return ok;
  }
  if (constraint != null) {
    Query<EClassifier,EClass,EObject> eval=ocl.createQuery(constraint);
    ok=eval.check(context);
  }
  return ok;
}

Fixed version (ground truth):
/** 
 * Evaluates the specified invariant (constraint given a particular context) Note that the evaluateQuery is more generic and can handle invariants as well
 * @param context			EObject of the context that the constraint should be checked against
 * @param constraintString	Valid OCL constraint string to be checked
 * @param verbose			Turns on OCL debugging if true, off if false 
 * @return					true if constraint is satisfied, false otherwise
 */
public static boolean checkConstraint(EObject context,String constraintString,boolean verbose){
  setOclTracingEnabled(verbose);
  queryStatus=QueryStatus.VALID_OCL;
  OCLHelper<EClassifier,?,?,Constraint> helper=getOcl().createOCLHelper();
  helper.setContext(context.eClass());
  boolean ok=false;
  Constraint constraint=null;
  try {
    constraint=helper.createInvariant(constraintString);
  }
 catch (  ParserException e) {
    queryStatus=QueryStatus.PARSE_EXCEPTION;
    e.printStackTrace();
    return ok;
  }
  if (constraint != null) {
    Query<EClassifier,EClass,EObject> eval=getOcl().createQuery(constraint);
    ok=eval.check(context);
  }
  return ok;
}
Program: 88704
Project: 88704
Buggy source:
public static <T>T getBestArgTypes(Map<T,Pair<Class<?>[],Boolean>> candidates,Class<?>... argTypes){
  ArgTypeCompare<T> atc=new ArgTypeCompare<T>(argTypes);
  for (  Entry<T,Pair<Class<?>[],Boolean>> e : candidates.entrySet()) {
    atc.compare(e.getKey(),e.getValue().first,e.getValue().second);
  }
  if (atc.best != null && !atc.allArgsMatched) {
    System.err.println("String_Node_Str" + atc.best + "String_Node_Str"+ atc.mostMatchingArgs+ "String_Node_Str"+ Utils2.toString(argTypes,false));
  }
 else   if (atc.best == null) {
    System.err.println("String_Node_Str" + candidates);
  }
  return atc.best;
}

Fixed version (ground truth):
public static <T>T getBestArgTypes(Map<T,Pair<Class<?>[],Boolean>> candidates,Class<?>... argTypes){
  ArgTypeCompare<T> atc=new ArgTypeCompare<T>(argTypes);
  for (  Entry<T,Pair<Class<?>[],Boolean>> e : candidates.entrySet()) {
    atc.compare(e.getKey(),e.getValue().first,e.getValue().second);
  }
  if (atc.best != null && !atc.allNonNullArgsMatched) {
    System.err.println("String_Node_Str" + atc.best + "String_Node_Str"+ atc.mostMatchingArgs+ "String_Node_Str"+ Utils2.toString(argTypes,false));
  }
 else   if (atc.best == null) {
    System.err.println("String_Node_Str" + candidates);
  }
  return atc.best;
}
Program: 88706
Project: 88706
Buggy source:
/** 
 * @param elem
 * @return all slots for the element's applied stereotype instance
 */
public static List<Slot> getSlots(Element elem){
  List<Slot> slots=new ArrayList<Slot>();
  InstanceSpecification localInstanceSpecification=elem.getAppliedStereotypeInstance();
  slots.addAll(localInstanceSpecification.getSlot());
  return slots;
}

Fixed version (ground truth):
/** 
 * @param elem
 * @return all slots for the element's applied stereotype instance
 */
public static List<Slot> getSlots(Element elem){
  List<Slot> slots=new ArrayList<Slot>();
  InstanceSpecification localInstanceSpecification=elem.getAppliedStereotypeInstance();
  if (localInstanceSpecification != null) {
    slots.addAll(localInstanceSpecification.getSlot());
  }
  return slots;
}
Program: 88707
Project: 88707
Buggy source:
@Override public Object process(Object input){
  String oclString=input == null ? null : input.toString();
  ArrayList<Object> outputList=new ArrayList<Object>();
  if (Utils2.isNullOrEmpty(getContext())) {
    outputList=process(null,oclString);
  }
 else   for (  Element elem : getContext()) {
    ArrayList<Object> results=process(elem,oclString);
    if (results != null)     outputList.addAll(results);
  }
  if (outputList != null && outputList.size() == 1)   return outputList.get(0);
  return outputList;
}

Fixed version (ground truth):
@Override public Object process(Object input){
  String oclString=input == null ? null : input.toString();
  ArrayList<Object> outputList=new ArrayList<Object>();
  OclEvaluator.opsCache=null;
  if (Utils2.isNullOrEmpty(getContext())) {
    outputList=process(null,oclString);
  }
 else   for (  Element elem : getContext()) {
    ArrayList<Object> results=process(elem,oclString);
    if (results != null)     outputList.addAll(results);
  }
  if (outputList != null && outputList.size() == 1)   return outputList.get(0);
  return outputList;
}