nus-yam/ex-repair huggingface dataset:
Program: 144700
Project: 144700
Buggy source:
public CommCareConfigEngine(OutputStream output,PrototypeFactory prototypeFactory){
  this.output=output;
  this.print=new PrintStream(output);
  this.platform=new CommCarePlatform(2,26);
  this.mLiveFactory=prototypeFactory;
  setRoots();
  table=ResourceTable.RetrieveTable(new DummyIndexedStorageUtility(Resource.class,mLiveFactory));
  updateTable=ResourceTable.RetrieveTable(new DummyIndexedStorageUtility(Resource.class,mLiveFactory));
  recoveryTable=ResourceTable.RetrieveTable(new DummyIndexedStorageUtility(Resource.class,mLiveFactory));
  StorageManager.forceClear();
  StorageManager.setStorageFactory(new IStorageFactory(){
    public IStorageUtility newStorage(    String name,    Class type){
      return new DummyIndexedStorageUtility(type,mLiveFactory);
    }
  }
);
  StorageManager.registerStorage(Profile.STORAGE_KEY,Profile.class);
  StorageManager.registerStorage(Suite.STORAGE_KEY,Suite.class);
  StorageManager.registerStorage(FormDef.STORAGE_KEY,FormDef.class);
  StorageManager.registerStorage("String_Node_Str",FormInstance.class);
}

Fixed version (ground truth):
public CommCareConfigEngine(OutputStream output,PrototypeFactory prototypeFactory){
  this.output=output;
  this.print=new PrintStream(output);
  this.platform=new CommCarePlatform(2,26);
  this.mLiveFactory=prototypeFactory;
  setRoots();
  table=ResourceTable.RetrieveTable(new DummyIndexedStorageUtility(Resource.class,mLiveFactory));
  updateTable=ResourceTable.RetrieveTable(new DummyIndexedStorageUtility(Resource.class,mLiveFactory));
  recoveryTable=ResourceTable.RetrieveTable(new DummyIndexedStorageUtility(Resource.class,mLiveFactory));
  StorageManager.forceClear();
  StorageManager.setStorageFactory(new IStorageFactory(){
    public IStorageUtility newStorage(    String name,    Class type){
      return new DummyIndexedStorageUtility(type,mLiveFactory);
    }
  }
);
  StorageManager.registerStorage(Profile.STORAGE_KEY,Profile.class);
  StorageManager.registerStorage(Suite.STORAGE_KEY,Suite.class);
  StorageManager.registerStorage(FormDef.STORAGE_KEY,FormDef.class);
  StorageManager.registerStorage(FormInstance.STORAGE_KEY,FormInstance.class);
}
Program: 144702
Project: 144702
Buggy source:
public Vector getChildrenWithName(String name){
  Vector children=super.getChildrenWithName(CaseChildElement.this.parent.intern(name));
  if (!done[0]) {
    return children;
  }
  if (children.size() == 0) {
    TreeElement emptyNode=new TreeElement(name);
    emptyNode.setAttribute(null,"String_Node_Str","String_Node_Str");
    this.addChild(emptyNode);
    emptyNode.setParent(this);
    children.addElement(emptyNode);
  }
  return children;
}

Fixed version (ground truth):
public Vector getChildrenWithName(String name){
  Vector children=super.getChildrenWithName(CaseChildElement.this.parent.intern(name));
  if (!done[0]) {
    return children;
  }
  if (children.size() == 0) {
    TreeElement emptyNode=new TreeElement(name);
    emptyNode.setAttribute(null,"String_Node_Str","String_Node_Str");
    emptyNode.setAttribute(null,"String_Node_Str","String_Node_Str");
    this.addChild(emptyNode);
    emptyNode.setParent(this);
    children.addElement(emptyNode);
  }
  return children;
}
Program: 144704
Project: 144704
Buggy source:
/** 
 * Rebase assigns this tree element to a new root instance node. Used to migrate the already created tree structure to a new instance connector.
 * @param instanceRoot The root of the new tree that this element should be a part of
 */
public void rebase(AbstractTreeElement instanceRoot){
  this.instanceRoot=instanceRoot;
  expireCachedRef();
}

Fixed version (ground truth):
/** 
 * Rebase assigns this tree element to a new root instance node. Used to migrate the already created tree structure to a new instance connector.
 * @param instanceRoot The root of the new tree that this element should be a part of//     
 */
public void rebase(AbstractTreeElement instanceRoot){
  this.instanceRoot=instanceRoot;
  expireCachedRef();
}
Program: 144705
Project: 144705
Buggy source:
@Override public void writeExternal(DataOutputStream out) throws IOException {
  ExtUtil.writeString(out,frameId);
  ExtUtil.write(out,new ExtWrapList(steps));
  ExtUtil.write(out,new ExtWrapList(snapshot));
  ExtUtil.writeBool(out,dead);
}

Fixed version (ground truth):
@Override public void writeExternal(DataOutputStream out) throws IOException {
  ExtUtil.write(out,new ExtWrapNullable(frameId));
  ExtUtil.write(out,new ExtWrapList(steps));
  ExtUtil.write(out,new ExtWrapList(snapshot));
  ExtUtil.writeBool(out,dead);
}
Program: 144706
Project: 144706
Buggy source:
public synchronized void clearSnapshot(){
  this.snapshot=null;
}

Fixed version (ground truth):
public synchronized void clearSnapshot(){
  this.snapshot.clear();
}
Program: 144707
Project: 144707
Buggy source:
/** 
 * Requests that the frame capture an original snapshot of its state. This snapshot can be referenced later to compare the eventual state of the frame to an earlier point
 */
public synchronized void captureSnapshot(){
  snapshot=new Vector<StackFrameStep>();
  for (  StackFrameStep s : steps) {
    snapshot.addElement(s);
  }
}

Fixed version (ground truth):
/** 
 * Requests that the frame capture an original snapshot of its state. This snapshot can be referenced later to compare the eventual state of the frame to an earlier point
 */
public synchronized void captureSnapshot(){
  snapshot.clear();
  for (  StackFrameStep s : steps) {
    snapshot.addElement(s);
  }
}
Program: 144708
Project: 144708
Buggy source:
@Override public void readExternal(DataInputStream in,PrototypeFactory pf) throws IOException, DeserializationException {
  frameId=ExtUtil.readString(in);
  steps=(Vector<StackFrameStep>)ExtUtil.read(in,new ExtWrapList(StackFrameStep.class),pf);
  snapshot=(Vector<StackFrameStep>)ExtUtil.read(in,new ExtWrapList(StackFrameStep.class),pf);
  dead=ExtUtil.readBool(in);
}

Fixed version (ground truth):
@Override public void readExternal(DataInputStream in,PrototypeFactory pf) throws IOException, DeserializationException {
  frameId=(String)ExtUtil.read(in,new ExtWrapNullable(String.class));
  steps=(Vector<StackFrameStep>)ExtUtil.read(in,new ExtWrapList(StackFrameStep.class),pf);
  snapshot=(Vector<StackFrameStep>)ExtUtil.read(in,new ExtWrapList(StackFrameStep.class),pf);
  dead=ExtUtil.readBool(in);
}
Program: 144709
Project: 144709
Buggy source:
/** 
 * Determines whether the current frame state is incompatible with a previously snapshotted frame state, if one exists. If no snapshot exists, this method will return false. Compatibility is determined by checking that each step in the previous snapshot is matched by an identical step in the current snapshot.
 */
public synchronized boolean isSnapshotIncompatible(){
  if (snapshot == null) {
    return false;
  }
  if (snapshot.size() > steps.size()) {
    return true;
  }
  for (int i=0; i < snapshot.size(); ++i) {
    if (!snapshot.elementAt(i).equals(steps.elementAt(i))) {
      return true;
    }
  }
  return false;
}

Fixed version (ground truth):
/** 
 * Determines whether the current frame state is incompatible with a previously snapshotted frame state, if one exists. If no snapshot exists, this method will return false. Compatibility is determined by checking that each step in the previous snapshot is matched by an identical step in the current snapshot.
 */
public synchronized boolean isSnapshotIncompatible(){
  if (snapshot.isEmpty()) {
    return false;
  }
  if (snapshot.size() > steps.size()) {
    return true;
  }
  for (int i=0; i < snapshot.size(); ++i) {
    if (!snapshot.elementAt(i).equals(steps.elementAt(i))) {
      return true;
    }
  }
  return false;
}
Program: 144710
Project: 144710
Buggy source:
@Override public String toString(){
  StringBuilder output=new StringBuilder("String_Node_Str");
  prettyPrintSteps(steps,output);
  if (snapshot != null && !snapshot.isEmpty()) {
    output.append("String_Node_Str");
    prettyPrintSteps(snapshot,output);
  }
  if (dead) {
    output.append("String_Node_Str");
  }
  return output.toString();
}

Fixed version (ground truth):
@Override public String toString(){
  StringBuilder output=new StringBuilder("String_Node_Str");
  prettyPrintSteps(steps,output);
  if (!snapshot.isEmpty()) {
    output.append("String_Node_Str");
    prettyPrintSteps(snapshot,output);
  }
  if (dead) {
    output.append("String_Node_Str");
  }
  return output.toString();
}
Program: 144711
Project: 144711
Buggy source:
@Override public Object eval(FormInstance model,EvaluationContext ec){
  try {
    return expr.evalRaw(model,ec);
  }
 catch (  XPathException e) {
    e.setSource("String_Node_Str" + contextRef.toString(true));
    throw e;
  }
}

Fixed version (ground truth):
public Object eval(FormInstance model,EvaluationContext ec){
  try {
    return expr.evalRaw(model,ec);
  }
 catch (  XPathException e) {
    e.setSource("String_Node_Str" + contextRef.toString(true));
    throw e;
  }
}
Program: 144712
Project: 144712
Buggy source:
@Override public boolean canCascade(){
  return true;
}

Fixed version (ground truth):
public boolean canCascade(){
  return true;
}
Program: 144713
Project: 144713
Buggy source:
@Override public void apply(TreeReference ref,Object result,FormInstance model,FormDef f){
  int dataType=f.getMainInstance().resolveReference(ref).getDataType();
  f.setAnswer(wrapData(result,dataType),ref);
}

Fixed version (ground truth):
public void apply(TreeReference ref,Object result,FormInstance model,FormDef f){
  int dataType=f.getMainInstance().resolveReference(ref).getDataType();
  f.setAnswer(wrapData(result,dataType),ref);
}
Program: 144714
Project: 144714
Buggy source:
@Override public String getDebugLabel(){
  return "String_Node_Str";
}

Fixed version (ground truth):
public String getDebugLabel(){
  return "String_Node_Str";
}
Program: 144715
Project: 144715
Buggy source:
/** 
 * Copy constructor
 */
public ExternalDataInstance(ExternalDataInstance instance){
  super(instance.getInstanceId());
  this.reference=instance.getReference();
  this.base=instance.getBase();
  this.root=instance.getRoot();
}

Fixed version (ground truth):
/** 
 * Copy constructor
 */
public ExternalDataInstance(ExternalDataInstance instance){
  super(instance.getInstanceId());
  this.reference=instance.getReference();
  this.base=instance.getBase();
  this.root=instance.getRoot();
  this.mCacheHost=instance.getCacheHost();
}
Program: 144716
Project: 144716
Buggy source:
/** 
 * Creates a new factory for processing incoming XML.
 * @param tolerant True if processing should fail in the event of conflicting data,false if processing should proceed as long as it is possible.
 */
public J2METransactionParserFactory(boolean tolerant){
  super(new J2MESandbox());
  syncToken=null;
  caseTallies=new int[3];
  this.tolerant=tolerant;
}

Fixed version (ground truth):
/** 
 * Creates a new factory for processing incoming XML.
 * @param tolerant True if processing should fail in the event of conflicting data,false if processing should proceed as long as it is possible.
 */
public J2METransactionParserFactory(boolean tolerant){
  super(new J2MESandbox());
  caseTallies=new int[3];
  this.tolerant=tolerant;
}
Program: 144718
Project: 144718
Buggy source:
/** 
 * Take in a value (only a string for now, TODO: Extend?) that doesn't have any type information and attempt to infer a more specific type that may assist in equality or comparison operations
 * @param attrValue A typeless data object
 * @return The passed in object in as specific of a type as was able tobe identified.
 */
public static Object InferType(String attrValue){
  try {
    return new Double(Double.parseDouble(attrValue));
  }
 catch (  NumberFormatException ife) {
  }
  return attrValue;
}

Fixed version (ground truth):
/** 
 * Take in a value (only a string for now, TODO: Extend?) that doesn't have any type information and attempt to infer a more specific type that may assist in equality or comparison operations
 * @param attrValue A typeless data object
 * @return The passed in object in as specific of a type as was able tobe identified.
 */
public static Object InferType(String attrValue){
  Double d=mDoubleParseCache.retrieve(attrValue);
  if (d != null) {
    if (d.isNaN()) {
      return attrValue;
    }
 else {
      return d;
    }
  }
  try {
    Double ret=new Double(Double.parseDouble(attrValue));
    mDoubleParseCache.register(attrValue,ret);
    return ret;
  }
 catch (  NumberFormatException ife) {
    mDoubleParseCache.register(attrValue,new Double(Double.NaN));
  }
  return attrValue;
}
Program: 144720
Project: 144720
Buggy source:
/** 
 * Given an array of details, count their total number of fields.
 * @return int
 */
private int getFlattenedFieldCount(){
  Detail[] details=this.getFlattenedDetails();
  int count=0;
  for (int i=0; i < details.length; i++) {
    count+=details[i].getFields().length;
  }
  return count;
}

Fixed version (ground truth):
/** 
 * Given an array of details, count their total number of fields.
 * @return int
 */
public int getFlattenedFieldCount(){
  Detail[] details=this.getFlattenedDetails();
  int count=0;
  for (int i=0; i < details.length; i++) {
    count+=details[i].getFields().length;
  }
  return count;
}
Program: 144721
Project: 144721
Buggy source:
public static void parseAndAdd(OrderedHashtable locale,String line,int curline){
  line=line.trim();
  int i=0;
  int dec=line.length();
  while ((i=LocalizationUtils.lastIndexOf(line.substring(0,dec),"String_Node_Str")) != -1) {
    if ((i != 0) && !(line.charAt(i - 1) == '\\')) {
      line=line.substring(0,i);
      dec=line.length();
    }
 else {
      dec=i;
    }
  }
  if (line.indexOf('=') == -1) {
    if (line.trim().equals("String_Node_Str")) {
    }
 else {
      System.out.println("String_Node_Str" + curline + "String_Node_Str"+ line);
    }
  }
 else {
    if (line.indexOf('=') != line.length() - 1) {
      String value=line.substring(line.indexOf('=') + 1,line.length());
      locale.put(line.substring(0,line.indexOf('=')),parseValue(value));
    }
 else {
      System.out.println("String_Node_Str" + curline + "String_Node_Str"+ line+ "String_Node_Str");
    }
  }
}

Fixed version (ground truth):
public static void parseAndAdd(OrderedHashtable locale,String line,int curline){
  line=line.trim();
  int i=0;
  int dec=line.length();
  while ((i=LocalizationUtils.lastIndexOf(line.substring(0,dec),"String_Node_Str")) != -1) {
    if ((i == 0) || !(line.charAt(i - 1) == '\\')) {
      line=line.substring(0,i);
      dec=line.length();
    }
 else {
      dec=i;
    }
  }
  if (line.indexOf('=') == -1) {
    if (line.trim().equals("String_Node_Str")) {
    }
 else {
      System.out.println("String_Node_Str" + curline + "String_Node_Str"+ line);
    }
  }
 else {
    if (line.indexOf('=') != line.length() - 1) {
      String value=line.substring(line.indexOf('=') + 1,line.length());
      locale.put(line.substring(0,line.indexOf('=')),parseValue(value));
    }
 else {
      System.out.println("String_Node_Str" + curline + "String_Node_Str"+ line+ "String_Node_Str");
    }
  }
}
Program: 144722
Project: 144722
Buggy source:
public CaseChildElement getChild(String name,int multiplicity){
  if ((multiplicity == TreeReference.INDEX_TEMPLATE) && "String_Node_Str".equals(name)) {
    return CaseChildElement.TemplateElement(this);
  }
  if (name.equals("String_Node_Str")) {
    getCases();
    if (cases.size() == 0) {
      return CaseChildElement.TemplateElement(this);
    }
    return cases.elementAt(multiplicity);
  }
  return null;
}

Fixed version (ground truth):
public CaseChildElement getChild(String name,int multiplicity){
  if ((multiplicity == TreeReference.INDEX_TEMPLATE) && "String_Node_Str".equals(name)) {
    return null;
  }
  if (name.equals("String_Node_Str")) {
    getCases();
    if (cases.size() == 0) {
      return CaseChildElement.TemplateElement(this);
    }
    return cases.elementAt(multiplicity);
  }
  return null;
}
Program: 144723
Project: 144723
Buggy source:
public LedgerChildElement getChild(String name,int multiplicity){
  if ((multiplicity == TreeReference.INDEX_TEMPLATE) && "String_Node_Str".equals(name)) {
    return LedgerChildElement.TemplateElement(this);
  }
  if (name.equals(LedgerChildElement.NAME)) {
    getLedgers();
    if (ledgers.size() == 0) {
      return LedgerChildElement.TemplateElement(this);
    }
    return ledgers.elementAt(multiplicity);
  }
  return null;
}

Fixed version (ground truth):
public LedgerChildElement getChild(String name,int multiplicity){
  if ((multiplicity == TreeReference.INDEX_TEMPLATE) && "String_Node_Str".equals(name)) {
    return null;
  }
  if (name.equals(LedgerChildElement.NAME)) {
    getLedgers();
    if (ledgers.size() == 0) {
      return LedgerChildElement.TemplateElement(this);
    }
    return ledgers.elementAt(multiplicity);
  }
  return null;
}
Program: 144725
Project: 144725
Buggy source:
public FormInstance getSessionInstance(String deviceId,String appversion,String username,String userId,Hashtable<String,String> userFields){
  TreeElement sessionRoot=new TreeElement("String_Node_Str",0);
  TreeElement sessionData=new TreeElement("String_Node_Str",0);
  sessionRoot.addChild(sessionData);
  for (  StackFrameStep step : frame.getSteps()) {
    if (step.getType() == SessionFrame.STATE_DATUM_VAL) {
      TreeElement datum=new TreeElement(step.getId());
      datum.setValue(new UncastData(step.getValue()));
      sessionData.addChild(datum);
    }
  }
  TreeElement sessionMeta=new TreeElement("String_Node_Str",0);
  addData(sessionMeta,"String_Node_Str",deviceId);
  addData(sessionMeta,"String_Node_Str",appversion);
  addData(sessionMeta,"String_Node_Str",username);
  addData(sessionMeta,"String_Node_Str",userId);
  sessionRoot.addChild(sessionMeta);
  TreeElement user=new TreeElement("String_Node_Str",0);
  TreeElement userData=new TreeElement("String_Node_Str",0);
  user.addChild(userData);
  for (Enumeration en=userFields.keys(); en.hasMoreElements(); ) {
    String key=(String)en.nextElement();
    addData(userData,key,userFields.get(key));
  }
  sessionRoot.addChild(user);
  return new FormInstance(sessionRoot,"String_Node_Str");
}

Fixed version (ground truth):
public FormInstance getSessionInstance(String deviceId,String appversion,String username,String userId,Hashtable<String,String> userFields){
  TreeElement sessionRoot=new TreeElement("String_Node_Str",0);
  TreeElement sessionData=new TreeElement("String_Node_Str",0);
  sessionRoot.addChild(sessionData);
  for (  StackFrameStep step : frame.getSteps()) {
    if (step.getType() == SessionFrame.STATE_DATUM_VAL) {
      Vector<TreeElement> matchingElements=sessionData.getChildrenWithName(step.getId());
      if (matchingElements.size() > 0) {
        matchingElements.elementAt(0).setValue(new UncastData(step.getValue()));
      }
 else {
        TreeElement datum=new TreeElement(step.getId());
        datum.setValue(new UncastData(step.getValue()));
        sessionData.addChild(datum);
      }
    }
  }
  TreeElement sessionMeta=new TreeElement("String_Node_Str",0);
  addData(sessionMeta,"String_Node_Str",deviceId);
  addData(sessionMeta,"String_Node_Str",appversion);
  addData(sessionMeta,"String_Node_Str",username);
  addData(sessionMeta,"String_Node_Str",userId);
  sessionRoot.addChild(sessionMeta);
  TreeElement user=new TreeElement("String_Node_Str",0);
  TreeElement userData=new TreeElement("String_Node_Str",0);
  user.addChild(userData);
  for (Enumeration en=userFields.keys(); en.hasMoreElements(); ) {
    String key=(String)en.nextElement();
    addData(userData,key,userFields.get(key));
  }
  sessionRoot.addChild(user);
  return new FormInstance(sessionRoot,"String_Node_Str");
}
Program: 144727
Project: 144727
Buggy source:
protected void goHome(){
  session.markCurrentFrameForDeath();
  if (ops.size() > 0) {
    EvaluationContext ec=session.getEvaluationContext(getIif());
    session.executeStackOperations(ops,ec);
  }
  if (session.finishAndPop()) {
    next();
  }
 else {
    J2MEDisplay.startStateWithLoadingScreen(new CommCareHomeState());
  }
}

Fixed version (ground truth):
protected void goHome(){
  if (session.finishExecuteAndPop(session.getEvaluationContext(getIif()))) {
    next();
  }
 else {
    J2MEDisplay.startStateWithLoadingScreen(new CommCareHomeState());
  }
}
Program: 144728
Project: 144728
Buggy source:
/** 
 * Complete the current session (and perform any cleanup), then check the stack for any pending frames, and load the top one into the current session if so.
 * @return True if there was a pending frame and it has beenpopped into the current session. False if the stack was empty and the session is over.
 */
public boolean finishAndPop(){
  cleanStack();
  if (frameStack.empty()) {
    return false;
  }
 else {
    frame=frameStack.pop();
    if (!frameStack.isEmpty()) {
      frame.captureSnapshot();
    }
    syncState();
    return true;
  }
}

Fixed version (ground truth):
/** 
 * Complete the current session (and perform any cleanup), then check the stack for any pending frames, and load the top one into the current session if so.
 * @return True if there was a pending frame and it has beenpopped into the current session. False if the stack was empty and the session is over.
 */
private boolean finishAndPop(){
  cleanStack();
  if (frameStack.empty()) {
    return false;
  }
 else {
    frame=frameStack.pop();
    if (!frameStack.isEmpty()) {
      frame.captureSnapshot();
    }
    syncState();
    return true;
  }
}
Program: 144729
Project: 144729
Buggy source:
/** 
 * @param args
 */
public static void main(String[] args){
  if (args.length < 1) {
    printformat();
    System.exit(-1);
  }
  PrototypeFactory prototypeFactory=setupStaticStorage();
  if (args[0].equals("String_Node_Str")) {
    if (args.length < 2) {
      printvalidateformat();
      System.exit(-1);
    }
    CommCareConfigEngine engine=configureApp(args,prototypeFactory);
    engine.describeApplication();
    System.exit(0);
  }
  if ("String_Node_Str".equals(args[0])) {
    if (args.length < 4) {
      printplayformat();
      System.exit(-1);
    }
    CommCareConfigEngine engine=configureApp(args,prototypeFactory);
    String username=args[2];
    String password=args[3];
    ApplicationHost host=new ApplicationHost(engine,username,password,prototypeFactory);
    host.run();
    System.exit(0);
  }
}

Fixed version (ground truth):
/** 
 * @param args
 */
public static void main(String[] args){
  if (args.length < 1) {
    printformat();
    System.exit(-1);
  }
  PrototypeFactory prototypeFactory=setupStaticStorage();
  if (args[0].equals("String_Node_Str")) {
    if (args.length < 2) {
      printvalidateformat();
      System.exit(-1);
    }
    CommCareConfigEngine engine=configureApp(args,prototypeFactory);
    engine.describeApplication();
    System.exit(0);
  }
  if ("String_Node_Str".equals(args[0])) {
    try {
      if (args.length < 4) {
        printplayformat();
        System.exit(-1);
      }
      CommCareConfigEngine engine=configureApp(args,prototypeFactory);
      String username=args[2];
      String password=args[3];
      username=username.trim().toLowerCase();
      ApplicationHost host=new ApplicationHost(engine,username,password,prototypeFactory);
      host.run();
      System.exit(-1);
    }
 catch (    RuntimeException re) {
      System.out.print("String_Node_Str");
      re.printStackTrace();
      throw re;
    }
 finally {
      System.exit(0);
    }
  }
}
Program: 144730
Project: 144730
Buggy source:
private void loop() throws IOException {
  boolean keepExecuting=true;
  while (keepExecuting) {
    mSession.clearAllState();
    keepExecuting=loopSession();
    if (this.mUpdatePending) {
      mSession.clearAllState();
      this.mUpdatePending=false;
      boolean forceUpdate=mForceLatestUpdate;
      this.mForceLatestUpdate=false;
      mEngine.attemptAppUpdate(forceUpdate);
    }
  }
}

Fixed version (ground truth):
private void loop() throws IOException {
  boolean keepExecuting=true;
  while (keepExecuting) {
    if (!mSessionHasNextFrameReady) {
      mSession.clearAllState();
    }
    mSessionHasNextFrameReady=false;
    keepExecuting=loopSession();
    if (this.mUpdatePending) {
      processAppUpdate();
    }
  }
}
Program: 144731
Project: 144731
Buggy source:
private boolean loopSession() throws IOException {
  Screen s=getNextScreen();
  while (s != null) {
    try {
      s.init(mPlatform,mSession,mSandbox);
      System.out.println("String_Node_Str");
      s.prompt(System.out);
      System.out.print("String_Node_Str");
      String input=reader.readLine();
      if (input.startsWith("String_Node_Str")) {
        if (input.equals("String_Node_Str") || input.equals("String_Node_Str")) {
          return false;
        }
        if (input.startsWith("String_Node_Str")) {
          mUpdatePending=true;
          if (input.contains("String_Node_Str")) {
            mForceLatestUpdate=true;
          }
          return true;
        }
        if (input.equals("String_Node_Str")) {
          return true;
        }
      }
      s.updateSession(mSession,input);
      s=getNextScreen();
    }
 catch (    CommCareSessionException ccse) {
      System.out.println("String_Node_Str");
      ccse.printStackTrace();
      System.out.println("String_Node_Str");
      reader.readLine();
      return true;
    }
  }
  String formXmlns=mSession.getForm();
  XFormPlayer player=new XFormPlayer(System.in,System.out,null);
  player.setSessionIIF(mSession.getIIF());
  player.start(mEngine.loadFormByXmlns(formXmlns));
  return true;
}

Fixed version (ground truth):
private boolean loopSession() throws IOException {
  Screen s=getNextScreen();
  while (s != null) {
    try {
      s.init(mPlatform,mSession,mSandbox);
      System.out.println("String_Node_Str");
      s.prompt(System.out);
      System.out.print("String_Node_Str");
      String input=reader.readLine();
      if (input.startsWith("String_Node_Str")) {
        if (input.equals("String_Node_Str") || input.equals("String_Node_Str")) {
          return false;
        }
        if (input.startsWith("String_Node_Str")) {
          mUpdatePending=true;
          if (input.contains("String_Node_Str")) {
            mForceLatestUpdate=true;
          }
          return true;
        }
        if (input.equals("String_Node_Str")) {
          return true;
        }
      }
      s.updateSession(mSession,input);
      s=getNextScreen();
    }
 catch (    CommCareSessionException ccse) {
      printErrorAndContinue("String_Node_Str",ccse);
      return true;
    }
  }
  String formXmlns=mSession.getForm();
  XFormPlayer player=new XFormPlayer(System.in,System.out,null);
  player.setSessionIIF(mSession.getIIF());
  player.start(mEngine.loadFormByXmlns(formXmlns));
  if (player.getExecutionResult() == XFormPlayer.FormResult.Completed) {
    if (!processResultInstance(player.getResultStream())) {
      return true;
    }
    mSession.clearVolitiles();
    if (mSession.finishExecuteAndPop(mSession.getEvaluationContext())) {
      mSessionHasNextFrameReady=true;
    }
  }
  return true;
}
Program: 144732
Project: 144732
Buggy source:
public void stepBack(){
  StackFrameStep recentPop=frame.popStep();
  syncState();
  popped=recentPop;
  if (this.getNeededData() == SessionFrame.STATE_DATUM_COMPUTED) {
    stepBack();
  }
}

Fixed version (ground truth):
public void stepBack(){
  StackFrameStep recentPop=frame.popStep();
  syncState();
  while (this.getNeededData() == null || this.getNeededData() == SessionFrame.STATE_DATUM_COMPUTED) {
    recentPop=frame.popStep();
    syncState();
  }
  popped=recentPop;
}
Program: 144733
Project: 144733
Buggy source:
/** 
 * Based on the current state of the session, determine what information is needed next to proceed
 * @return 1 of the 4 STATE strings declared at the top of SessionFrame.java, or null ifcould not be determined
 */
public String getNeededData(){
  if (this.getCommand() == null) {
    return SessionFrame.STATE_COMMAND_ID;
  }
  Vector<Entry> entries=getEntriesForCommand(this.getCommand(),this.getData());
  String needDatum=null;
  String nextKey=null;
  for (  Entry e : entries) {
    if (e.getSessionDataReqs().size() > this.getData().size()) {
      SessionDatum datum=e.getSessionDataReqs().elementAt(this.getData().size());
      String needed=datum.getDataId();
      if (nextKey == null) {
        nextKey=needed;
        if (datum.getNodeset() != null) {
          needDatum=SessionFrame.STATE_DATUM_VAL;
        }
 else {
          needDatum=SessionFrame.STATE_DATUM_COMPUTED;
        }
        continue;
      }
 else {
        if (nextKey.equals(needed)) {
          continue;
        }
      }
    }
    needDatum=null;
    break;
  }
  if (needDatum != null) {
    return needDatum;
  }
  if (entries.size() > 1 || !entries.elementAt(0).getCommandId().equals(this.getCommand())) {
    return SessionFrame.STATE_COMMAND_ID;
  }
 else {
    return null;
  }
}

Fixed version (ground truth):
/** 
 * Based on the current state of the session, determine what information is needed next to proceed
 * @return 1 of the 4 STATE strings declared at the top of SessionFrame.java, or null ifthe session does not need anything else to proceed
 */
public String getNeededData(){
  if (this.getCommand() == null) {
    return SessionFrame.STATE_COMMAND_ID;
  }
  Vector<Entry> entries=getEntriesForCommand(this.getCommand(),this.getData());
  String needDatum=null;
  String nextKey=null;
  for (  Entry e : entries) {
    if (e.getSessionDataReqs().size() > this.getData().size()) {
      SessionDatum datum=e.getSessionDataReqs().elementAt(this.getData().size());
      String needed=datum.getDataId();
      if (nextKey == null) {
        nextKey=needed;
        if (datum.getNodeset() != null) {
          needDatum=SessionFrame.STATE_DATUM_VAL;
        }
 else {
          needDatum=SessionFrame.STATE_DATUM_COMPUTED;
        }
        continue;
      }
 else {
        if (nextKey.equals(needed)) {
          continue;
        }
      }
    }
    needDatum=null;
    break;
  }
  if (needDatum != null) {
    return needDatum;
  }
  if (entries.size() > 1 || !entries.elementAt(0).getCommandId().equals(this.getCommand())) {
    return SessionFrame.STATE_COMMAND_ID;
  }
 else {
    return null;
  }
}
Program: 144734
Project: 144734
Buggy source:
private boolean propertiesEqual(String a,String b){
  return a == null && b != null || a != null && b == null || a != null && b != null && !a.equals(b);
}

Fixed version (ground truth):
private boolean propertiesEqual(String a,String b){
  if (a == null) {
    return b == null;
  }
 else {
    return (a.equals(b));
  }
}
Program: 144735
Project: 144735
Buggy source:
public String getNeededData(){
  if (this.getCommand() == null) {
    return SessionFrame.STATE_COMMAND_ID;
  }
  Vector<Entry> entries=getEntriesForCommand(this.getCommand(),this.getData());
  String needDatum=null;
  String nextKey=null;
  for (  Entry e : entries) {
    if (e.getSessionDataReqs().size() > this.getData().size()) {
      SessionDatum datum=e.getSessionDataReqs().elementAt(this.getData().size());
      String needed=datum.getDataId();
      if (nextKey == null) {
        nextKey=needed;
        if (datum.getNodeset() != null) {
          needDatum=SessionFrame.STATE_DATUM_VAL;
        }
 else {
          needDatum=SessionFrame.STATE_DATUM_COMPUTED;
        }
        continue;
      }
 else {
        if (nextKey.equals(needed)) {
          continue;
        }
      }
    }
    needDatum=null;
    break;
  }
  if (needDatum != null) {
    return needDatum;
  }
  if (entries.size() > 1 || !entries.elementAt(0).getCommandId().equals(this.getCommand())) {
    return SessionFrame.STATE_COMMAND_ID;
  }
 else {
    return null;
  }
}

Fixed version (ground truth):
/** 
 * Based on the current state of the session, determine what information is needed next to proceed
 * @return 1 of the 4 STATE strings declared at the top of SessionFrame.java, or null ifcould not be determined
 */
public String getNeededData(){
  if (this.getCommand() == null) {
    return SessionFrame.STATE_COMMAND_ID;
  }
  Vector<Entry> entries=getEntriesForCommand(this.getCommand(),this.getData());
  String needDatum=null;
  String nextKey=null;
  for (  Entry e : entries) {
    if (e.getSessionDataReqs().size() > this.getData().size()) {
      SessionDatum datum=e.getSessionDataReqs().elementAt(this.getData().size());
      String needed=datum.getDataId();
      if (nextKey == null) {
        nextKey=needed;
        if (datum.getNodeset() != null) {
          needDatum=SessionFrame.STATE_DATUM_VAL;
        }
 else {
          needDatum=SessionFrame.STATE_DATUM_COMPUTED;
        }
        continue;
      }
 else {
        if (nextKey.equals(needed)) {
          continue;
        }
      }
    }
    needDatum=null;
    break;
  }
  if (needDatum != null) {
    return needDatum;
  }
  if (entries.size() > 1 || !entries.elementAt(0).getCommandId().equals(this.getCommand())) {
    return SessionFrame.STATE_COMMAND_ID;
  }
 else {
    return null;
  }
}
Program: 144736
Project: 144736
Buggy source:
public <T extends Persistable>byte[] serialize(T t){
  try {
    ByteArrayOutputStream baos=new ByteArrayOutputStream();
    t.writeExternal(new DataOutputStream(baos));
    return baos.toByteArray();
  }
 catch (  IOException e) {
    throw wrap("String_Node_Str" + t.getClass().getName(),e);
  }
}

Fixed version (ground truth):
public <T extends Externalizable>byte[] serialize(T t){
  try {
    ByteArrayOutputStream baos=new ByteArrayOutputStream();
    t.writeExternal(new DataOutputStream(baos));
    return baos.toByteArray();
  }
 catch (  IOException e) {
    throw wrap("String_Node_Str" + t.getClass().getName(),e);
  }
}
Program: 144737
Project: 144737
Buggy source:
public <T extends Persistable>T deserialize(byte[] object,Class<T> c){
  try {
    return (T)ExtUtil.deserialize(object,c,factory);
  }
 catch (  IOException|DeserializationException e) {
    throw wrap("String_Node_Str" + c.getName(),e);
  }
}

Fixed version (ground truth):
public <T extends Externalizable>T deserialize(byte[] object,Class<T> c){
  try {
    return (T)ExtUtil.deserialize(object,c,factory);
  }
 catch (  IOException|DeserializationException e) {
    throw wrap("String_Node_Str" + c.getName(),e);
  }
}
Program: 144738
Project: 144738
Buggy source:
private void loop(){
  while (true) {
    mSession.clearAllState();
    loopSession();
  }
}

Fixed version (ground truth):
private void loop() throws IOException {
  while (true) {
    mSession.clearAllState();
    loopSession();
  }
}
Program: 144739
Project: 144739
Buggy source:
public void run(){
  setupSandbox();
  mSession=new SessionWrapper(mPlatform,mSandbox);
  loop();
}

Fixed version (ground truth):
public void run(){
  setupSandbox();
  mSession=new SessionWrapper(mPlatform,mSandbox);
  try {
    loop();
  }
 catch (  IOException e) {
    e.printStackTrace();
    System.exit(-1);
  }
}
Program: 144740
Project: 144740
Buggy source:
private void loopSession(){
  Screen s=getNextScreen();
  while (s != null) {
    s.init(mPlatform,mSession,mSandbox);
    System.out.println("String_Node_Str");
    System.out.println("String_Node_Str");
    System.out.println("String_Node_Str");
    System.out.println("String_Node_Str");
    System.out.println("String_Node_Str");
    System.out.println("String_Node_Str");
    System.out.println("String_Node_Str");
    s.prompt(System.out);
    System.out.print("String_Node_Str");
    try {
      String input=reader.readLine();
      s.updateSession(mSession,input);
      s=getNextScreen();
    }
 catch (    IOException e) {
      e.printStackTrace();
    }
  }
  String formXmlns=mSession.getForm();
  XFormPlayer player=new XFormPlayer(System.in,System.out,null);
  player.setSessionIIF(mSession.getIIF());
  player.start(mEngine.loadFormByXmlns(formXmlns));
}

Fixed version (ground truth):
private void loopSession() throws IOException {
  Screen s=getNextScreen();
  while (s != null) {
    try {
      s.init(mPlatform,mSession,mSandbox);
      System.out.println("String_Node_Str");
      System.out.println("String_Node_Str");
      System.out.println("String_Node_Str");
      System.out.println("String_Node_Str");
      System.out.println("String_Node_Str");
      System.out.println("String_Node_Str");
      System.out.println("String_Node_Str");
      s.prompt(System.out);
      System.out.print("String_Node_Str");
      String input=reader.readLine();
      s.updateSession(mSession,input);
      s=getNextScreen();
    }
 catch (    CommCareSessionException ccse) {
      System.out.println("String_Node_Str");
      ccse.printStackTrace();
      System.out.println("String_Node_Str");
      reader.readLine();
      mSession.clearAllState();
      loopSession();
    }
  }
  String formXmlns=mSession.getForm();
  XFormPlayer player=new XFormPlayer(System.in,System.out,null);
  player.setSessionIIF(mSession.getIIF());
  player.start(mEngine.loadFormByXmlns(formXmlns));
}
Program: 144741
Project: 144741
Buggy source:
@Override public void init(CommCarePlatform platform,SessionWrapper session,MockUserDataSandbox sandbox){
  this.mPlatform=platform;
  this.mSandbox=sandbox;
  this.mSession=session;
  needed=session.getNeededDatum();
  String detail=needed.getShortDetail();
  if (detail == null) {
    error("String_Node_Str" + needed.getDataId());
  }
  Detail shortDetail=platform.getDetail(detail);
  if (shortDetail == null) {
    error("String_Node_Str" + detail);
  }
  mTitle=shortDetail.getTitle().evaluate(session.getEvaluationContext()).getName();
  mHeader=this.createHeader(shortDetail);
  Vector<TreeReference> references=inflateReference(needed.getNodeset());
  rows=new String[references.size()];
  int i=0;
  for (  TreeReference entity : references) {
    rows[i]=createRow(entity,shortDetail);
    ++i;
  }
  this.mChoices=new TreeReference[references.size()];
  references.copyInto(mChoices);
  setTitle(mTitle);
}

Fixed version (ground truth):
@Override public void init(CommCarePlatform platform,SessionWrapper session,MockUserDataSandbox sandbox) throws CommCareSessionException {
  this.mPlatform=platform;
  this.mSandbox=sandbox;
  this.mSession=session;
  needed=session.getNeededDatum();
  String detail=needed.getShortDetail();
  if (detail == null) {
    throw new CommCareSessionException("String_Node_Str" + needed.getDataId());
  }
  Detail shortDetail=platform.getDetail(detail);
  if (shortDetail == null) {
    throw new CommCareSessionException("String_Node_Str" + detail);
  }
  mTitle=shortDetail.getTitle().evaluate(session.getEvaluationContext()).getName();
  mHeader=this.createHeader(shortDetail);
  Vector<TreeReference> references=inflateReference(needed.getNodeset());
  rows=new String[references.size()];
  int i=0;
  for (  TreeReference entity : references) {
    rows[i]=createRow(entity,shortDetail);
    ++i;
  }
  this.mChoices=new TreeReference[references.size()];
  references.copyInto(mChoices);
  setTitle(mTitle);
}
Program: 144743
Project: 144743
Buggy source:
public abstract void init(CommCarePlatform platform,SessionWrapper session,MockUserDataSandbox sandbox);

Fixed version (ground truth):
public abstract void init(CommCarePlatform platform,SessionWrapper session,MockUserDataSandbox sandbox) throws CommCareSessionException ;
Program: 144744
Project: 144744
Buggy source:
public abstract void updateSession(CommCareSession session,String input);

Fixed version (ground truth):
public abstract void updateSession(CommCareSession session,String input) throws CommCareSessionException ;
Program: 144745
Project: 144745
Buggy source:
public abstract void prompt(PrintStream out);

Fixed version (ground truth):
public abstract void prompt(PrintStream out) throws CommCareSessionException ;
Program: 144746
Project: 144746
Buggy source:
public void writeExternal(DataOutputStream dos) throws IOException {
  ExtUtil.writeNumeric(dos,getID());
  ExtUtil.write(dos,new ExtWrapNullable(binding == null ? null : new ExtWrapTagged(binding)));
  ExtUtil.write(dos,new ExtWrapNullable(getAppearanceAttr()));
  ExtUtil.writeNumeric(dos,getControlType());
  ExtUtil.write(dos,new ExtWrapList(ExtUtil.emptyIfNull(choices)));
  ExtUtil.write(dos,new ExtWrapNullable(dynamicChoices));
  ExtUtil.write(dos,new ExtWrapMap(String.class,QuestionString.class));
}

Fixed version (ground truth):
public void writeExternal(DataOutputStream dos) throws IOException {
  ExtUtil.writeNumeric(dos,getID());
  ExtUtil.write(dos,new ExtWrapNullable(binding == null ? null : new ExtWrapTagged(binding)));
  ExtUtil.write(dos,new ExtWrapNullable(getAppearanceAttr()));
  ExtUtil.writeNumeric(dos,getControlType());
  ExtUtil.write(dos,new ExtWrapList(ExtUtil.emptyIfNull(choices)));
  ExtUtil.write(dos,new ExtWrapNullable(dynamicChoices));
  ExtUtil.write(dos,new ExtWrapMap(mQuestionStrings));
}
Program: 144747
Project: 144747
Buggy source:
public QuestionDef(int id,int controlType){
  setID(id);
  setControlType(controlType);
  observers=new Vector();
  mQuestionStrings=new Hashtable<String,QuestionString>();
}

Fixed version (ground truth):
public QuestionDef(int id,int controlType){
  setID(id);
  setControlType(controlType);
  observers=new Vector();
  mQuestionStrings=new Hashtable<String,QuestionString>();
  mQuestionStrings.put(XFormParser.LABEL_ELEMENT,new QuestionString(XFormParser.LABEL_ELEMENT,null));
}
Program: 144748
Project: 144748
Buggy source:
/** 
 * Test that the long and short text forms work as expected (fallback to default for example). Test being able to retrieve other exotic forms
 */
public void testTextForms(){
  FormEntryController fec=fpi.getFormEntryController();
  fec.jumpToIndex(FormIndex.createBeginningOfFormIndex());
  boolean foundFlag=false;
  Localizer l=fpi.getFormDef().getLocalizer();
  l.setDefaultLocale(l.getAvailableLocales()[0]);
  l.setLocale(l.getAvailableLocales()[0]);
  int state=-99;
  while (state != FormEntryController.EVENT_QUESTION) {
    state=fec.stepToNextEvent();
  }
  if (!fep.getLongText().equals("String_Node_Str"))   fail("String_Node_Str");
  if (!fep.getShortText().equals("String_Node_Str"))   fail("String_Node_Str");
  if (!fep.getAudioText().equals("String_Node_Str"))   fail("String_Node_Str");
  state=-99;
  while (state != FormEntryController.EVENT_QUESTION) {
    state=fec.stepToNextEvent();
  }
  if (!fep.getLongText().equals("String_Node_Str"))   fail("String_Node_Str");
  if (!fep.getSpecialFormQuestionText("String_Node_Str").equals(null))   fail("String_Node_Str");
}

Fixed version (ground truth):
/** 
 * Test that the long and short text forms work as expected (fallback to default for example). Test being able to retrieve other exotic forms
 */
public void testTextForms(){
  FormEntryController fec=fpi.getFormEntryController();
  fec.jumpToIndex(FormIndex.createBeginningOfFormIndex());
  Localizer l=fpi.getFormDef().getLocalizer();
  l.setDefaultLocale(l.getAvailableLocales()[0]);
  l.setLocale(l.getAvailableLocales()[0]);
  int state=fec.getModel().getEvent();
  while (state != FormEntryController.EVENT_QUESTION) {
    state=fec.stepToNextEvent();
  }
  fep=fec.getModel().getQuestionPrompt();
  if (!fep.getLongText().equals("String_Node_Str"))   fail("String_Node_Str");
  if (!fep.getShortText().equals("String_Node_Str"))   fail("String_Node_Str");
  if (!fep.getAudioText().equals("String_Node_Str"))   fail("String_Node_Str");
  state=-99;
  while (state != FormEntryController.EVENT_QUESTION) {
    state=fec.stepToNextEvent();
  }
  fep=fec.getModel().getQuestionPrompt();
  if (!fep.getLongText().equals("String_Node_Str"))   fail("String_Node_Str" + fep.getLongText());
  if (fep.getSpecialFormQuestionText("String_Node_Str") != null)   fail("String_Node_Str");
}
Program: 144749
Project: 144749
Buggy source:
public void run(TestCase tc){
  ((QuestionDefTest)tc).doTest(testID);
}

Fixed version (ground truth):
public void run(TestCase tc){
  ((TextFormTests)tc).doTest(testID);
}
Program: 144750
Project: 144750
Buggy source:
public void testPromptsNoLocalizer(){
  QuestionDef q=new QuestionDef();
  q.putQuestionString("String_Node_Str",new QuestionString("String_Node_Str","String_Node_Str"));
  if (!"String_Node_Str".equals(q.getQuestionString("String_Node_Str"))) {
    fail("String_Node_Str");
  }
}

Fixed version (ground truth):
public void testPromptsNoLocalizer(){
  QuestionDef q=new QuestionDef();
  q.putQuestionString("String_Node_Str",new QuestionString("String_Node_Str","String_Node_Str"));
  if (!"String_Node_Str".equals(q.getQuestionString("String_Node_Str").getTextInner())) {
    fail("String_Node_Str");
  }
}
Program: 144751
Project: 144751
Buggy source:
public Test suite(){
  TestSuite aSuite=new TestSuite();
  System.out.println("String_Node_Str");
  for (int i=1; i <= NUM_TESTS; i++) {
    final int testID=i;
    aSuite.addTest(new QuestionDefTest("String_Node_Str" + i,new TestMethod(){
      public void run(      TestCase tc){
        ((QuestionDefTest)tc).doTest(testID);
      }
    }
));
  }
  return aSuite;
}

Fixed version (ground truth):
public Test suite(){
  TestSuite aSuite=new TestSuite();
  System.out.println("String_Node_Str");
  for (int i=1; i <= NUM_TESTS; i++) {
    final int testID=i;
    aSuite.addTest(new TextFormTests("String_Node_Str" + i,new TestMethod(){
      public void run(      TestCase tc){
        ((TextFormTests)tc).doTest(testID);
      }
    }
));
  }
  return aSuite;
}
Program: 144752
Project: 144752
Buggy source:
public void testPromptIDsNoLocalizer(){
  QuestionDef q=new QuestionDef();
  q.setTextID("String_Node_Str");
  if (!"String_Node_Str".equals(q.getTextID())) {
    fail("String_Node_Str");
  }
  QuestionString hint=new QuestionString("String_Node_Str");
  hint.setTextId("String_Node_Str");
  q.putQuestionString("String_Node_Str",hint);
  if (!"String_Node_Str".equals(q.getQuestionString("String_Node_Str").getTextId()) || q.getQuestionString("String_Node_Str") != null) {
    fail("String_Node_Str");
  }
}

Fixed version (ground truth):
public void testPromptIDsNoLocalizer(){
  QuestionDef q=new QuestionDef();
  q.setTextID("String_Node_Str");
  if (!"String_Node_Str".equals(q.getTextID())) {
    fail("String_Node_Str");
  }
  QuestionString hint=new QuestionString("String_Node_Str");
  hint.setTextId("String_Node_Str");
  q.putQuestionString("String_Node_Str",hint);
  if (!"String_Node_Str".equals(q.getQuestionString("String_Node_Str").getTextId())) {
    fail("String_Node_Str");
  }
}
Program: 144753
Project: 144753
Buggy source:
/** 
 * Convenience method Get longText form of text for THIS element (if available) !!Falls back to default form if 'long' form does not exist.!! Use getSpecialFormQuestionText() if you want short form only.
 * @return longText form
 */
public String getConstraintText(){
  String newConstraintMsg=this.localizeText(getQuestion().getQuestionString(XFormParser.CONSTRAINT_ELEMENT));
  if (newConstraintMsg != null) {
    return newConstraintMsg;
  }
  EvaluationContext ec=new EvaluationContext(form.exprEvalContext,mTreeElement.getRef());
  return mTreeElement.getConstraint().getConstraintMessage(ec,form.getMainInstance(),null);
}

Fixed version (ground truth):
public String getConstraintText(String textForm,IAnswerData attemptedValue){
  if (mTreeElement.getConstraint() == null) {
    return null;
  }
 else {
    EvaluationContext ec=new EvaluationContext(form.exprEvalContext,mTreeElement.getRef());
    if (textForm != null) {
      ec.setOutputTextForm(textForm);
    }
    if (attemptedValue != null) {
      ec.isConstraint=true;
      ec.candidateValue=attemptedValue;
    }
    return mTreeElement.getConstraint().getConstraintMessage(ec,form.getMainInstance(),textForm);
  }
}
Program: 144755
Project: 144755
Buggy source:
public DisplayData evaluate(EvaluationContext ec){
  return new DisplayData(name.evaluate(ec),imageReference.evaluate(ec),audioReference.evaluate(ec));
}

Fixed version (ground truth):
public DisplayData evaluate(EvaluationContext ec){
  String imageRef=imageReference == null ? null : imageReference.evaluate(ec);
  String audioRef=audioReference == null ? null : audioReference.evaluate(ec);
  return new DisplayData(name.evaluate(ec),imageRef,audioRef);
}