nus-yam/ex-repair huggingface dataset:
Program: 146585
Project: 146585
Buggy source:
private SelectChoice buildSelectChoice(TreeReference choiceRef,ItemsetBinding itemset,DataInstance formInstance,EvaluationContext ec,ReducingTraceReporter reporter,int index){
  String label=itemset.labelExpr.evalReadable(formInstance,new EvaluationContext(ec,choiceRef));
  if (reporter != null) {
    InstrumentationUtils.printAndClearTraces(reporter,"String_Node_Str");
  }
  String value=null;
  TreeElement copyNode=null;
  if (itemset.copyMode) {
    copyNode=this.getMainInstance().resolveReference(itemset.copyRef.contextualize(choiceRef));
  }
  if (itemset.valueRef != null) {
    value=itemset.valueExpr.evalReadable(formInstance,new EvaluationContext(ec,choiceRef));
  }
  if (reporter != null) {
    InstrumentationUtils.printAndClearTraces(reporter,"String_Node_Str");
  }
  SelectChoice choice=new SelectChoice(label,value != null ? value : "String_Node_Str" + index,itemset.labelIsItext);
  choice.setIndex(index);
  if (itemset.copyMode) {
    choice.copyNode=copyNode;
  }
  if (itemset.sortRef != null) {
    String evaluatedSortProperty=itemset.sortExpr.evalReadable(formInstance,new EvaluationContext(ec,choiceRef));
    choice.setSortProperty(evaluatedSortProperty);
  }
  if (reporter != null) {
    InstrumentationUtils.printAndClearTraces(reporter,"String_Node_Str");
  }
  return choice;
}

Fixed version (ground truth):
private SelectChoice buildSelectChoice(TreeReference choiceRef,ItemsetBinding itemset,DataInstance formInstance,EvaluationContext ec,ReducingTraceReporter reporter,int index){
  EvaluationContext subContext=new EvaluationContext(ec,choiceRef);
  String label=itemset.labelExpr.evalReadable(formInstance,subContext);
  String value=null;
  TreeElement copyNode=null;
  if (itemset.copyMode) {
    copyNode=this.getMainInstance().resolveReference(itemset.copyRef.contextualize(choiceRef));
  }
  if (itemset.valueRef != null) {
    value=itemset.valueExpr.evalReadable(formInstance,subContext);
  }
  SelectChoice choice=new SelectChoice(label,value != null ? value : "String_Node_Str" + index,itemset.labelIsItext);
  choice.setIndex(index);
  if (itemset.copyMode) {
    choice.copyNode=copyNode;
  }
  if (itemset.sortRef != null) {
    String evaluatedSortProperty=itemset.sortExpr.evalReadable(formInstance,subContext);
    choice.setSortProperty(evaluatedSortProperty);
  }
  return choice;
}
Program: 146587
Project: 146587
Buggy source:
public AbstractTreeElement resolveReference(TreeReference qualifiedRef){
  DataInstance instance=this.getMainInstance();
  if (qualifiedRef.getInstanceName() != null && (instance == null || instance.getInstanceId() == null || !instance.getInstanceId().equals(qualifiedRef.getInstanceName()))) {
    instance=this.getInstance(qualifiedRef.getInstanceName());
  }
  return instance.resolveReference(qualifiedRef);
}

Fixed version (ground truth):
public AbstractTreeElement resolveReference(TreeReference qualifiedRef){
  DataInstance instance=this.getMainInstance();
  if (qualifiedRef.getInstanceName() != null && (instance == null || instance.getInstanceId() == null || !instance.getInstanceId().equals(qualifiedRef.getInstanceName()))) {
    instance=this.getInstance(qualifiedRef.getInstanceName());
  }
  return instance.resolveReference(qualifiedRef,this);
}
Program: 146589
Project: 146589
Buggy source:
private String getRuntimeCount(long l){
  if (l / 1000 / 1000 > 0) {
    return l / 1000 / 1000 + "String_Node_Str";
  }
 else   if (l / 1000 > 0) {
    return l / 1000 + "String_Node_Str";
  }
 else {
    return l + "String_Node_Str";
  }
}

Fixed version (ground truth):
public static String getRuntimeCount(long l){
  if (l / 1000 / 1000 > 0) {
    return l / 1000 / 1000 + "String_Node_Str";
  }
 else   if (l / 1000 > 0) {
    return l / 1000 + "String_Node_Str";
  }
 else {
    return l + "String_Node_Str";
  }
}
Program: 146590
Project: 146590
Buggy source:
private void performEvaluation(){
synchronized (evaluated) {
    if (evaluated) {
      return;
    }
    Vector<TreeReference> nodes=ec.expandReference(unExpandedRef);
    for (int i=0; i < nodes.size(); i++) {
      if (!instance.resolveReference(nodes.elementAt(i),ec).isRelevant()) {
        nodes.removeElementAt(i);
        i--;
      }
    }
    this.setReferences(nodes);
    evaluated=true;
  }
}

Fixed version (ground truth):
private void performEvaluation(){
synchronized (evaluated) {
    if (evaluated) {
      return;
    }
    Vector<TreeReference> nodes=ec.expandReference(unExpandedRef);
    for (int i=0; i < nodes.size(); i++) {
      if (!instance.resolveReference(nodes.elementAt(i),ec).isRelevant()) {
        nodes.removeElementAt(i);
        i--;
      }
    }
    this.setReferences(nodes);
    evaluated=new Boolean(true);
  }
}
Program: 146591
Project: 146591
Buggy source:
protected Model getElement(int recordId,QueryContext context){
  if (context == null || getStorageCacheName() == null) {
    return getElementSingular(recordId,context);
  }
  RecordSetResultCache recordSetCache=context.getQueryCacheOrNull(RecordSetResultCache.class);
  RecordObjectCache<Model> recordObjectCache=getRecordObjectCacheIfRelevant(context);
  if (recordObjectCache != null) {
    if (recordObjectCache.isLoaded(recordId)) {
      return recordObjectCache.getLoadedRecordObject(recordId);
    }
    if (canLoadRecordFromGroup(recordSetCache,recordId)) {
      Pair<String,LinkedHashSet<Integer>> tranche=recordSetCache.getRecordSetForRecordId(getStorageCacheName(),recordId);
      EvaluationTrace loadTrace=new EvaluationTrace(String.format("String_Node_Str",this.getStorageCacheName(),tranche.first));
      LinkedHashSet<Integer> body=tranche.second;
      storage.bulkRead(body,recordObjectCache.getLoadedCaseMap());
      loadTrace.setOutcome("String_Node_Str" + body.size());
      context.reportTrace(loadTrace);
      return recordObjectCache.getLoadedRecordObject(recordId);
    }
  }
  return getElementSingular(recordId,context);
}

Fixed version (ground truth):
protected Model getElement(int recordId,QueryContext context){
  if (context == null || getStorageCacheName() == null) {
    return getElementSingular(recordId,context);
  }
  RecordSetResultCache recordSetCache=context.getQueryCacheOrNull(RecordSetResultCache.class);
  RecordObjectCache<Model> recordObjectCache=getRecordObjectCacheIfRelevant(context);
  String storageCacheKey=getStorageCacheName();
  if (recordObjectCache != null) {
    if (recordObjectCache.isLoaded(storageCacheKey,recordId)) {
      return recordObjectCache.getLoadedRecordObject(storageCacheKey,recordId);
    }
    if (canLoadRecordFromGroup(recordSetCache,recordId)) {
      Pair<String,LinkedHashSet<Integer>> tranche=recordSetCache.getRecordSetForRecordId(storageCacheKey,recordId);
      EvaluationTrace loadTrace=new EvaluationTrace(String.format("String_Node_Str",this.getStorageCacheName(),tranche.first));
      LinkedHashSet<Integer> body=tranche.second;
      storage.bulkRead(body,recordObjectCache.getLoadedCaseMap(storageCacheKey));
      loadTrace.setOutcome("String_Node_Str" + body.size());
      context.reportTrace(loadTrace);
      return recordObjectCache.getLoadedRecordObject(storageCacheKey,recordId);
    }
  }
  return getElementSingular(recordId,context);
}
Program: 146592
Project: 146592
Buggy source:
public HashMap<Integer,T> getLoadedCaseMap(){
  return cachedRecordObjects;
}

Fixed version (ground truth):
public HashMap<Integer,T> getLoadedCaseMap(String storageSetID){
  return getCache(storageSetID);
}
Program: 146593
Project: 146593
Buggy source:
public T getLoadedRecordObject(int recordId){
  return cachedRecordObjects.get(recordId);
}

Fixed version (ground truth):
public T getLoadedRecordObject(String storageSetID,int recordId){
  return getCache(storageSetID).get(recordId);
}
Program: 146594
Project: 146594
Buggy source:
public boolean isLoaded(int recordId){
  return cachedRecordObjects.containsKey(recordId);
}

Fixed version (ground truth):
public boolean isLoaded(String storageSetID,int recordId){
  return getCache(storageSetID).containsKey(recordId);
}
Program: 146595
Project: 146595
Buggy source:
protected Model getElement(int recordId,QueryContext context){
  if (context == null || getStorageCacheName() == null) {
    return getElementSingular(recordId,context);
  }
  RecordSetResultCache recordSetCache=context.getQueryCacheOrNull(RecordSetResultCache.class);
  RecordObjectCache<Model> recordObjectCache=getRecordObjectCacheIfRelevant(context);
  if (recordObjectCache != null) {
    if (recordObjectCache.isLoaded(recordId)) {
      return recordObjectCache.getLoadedRecordObject(recordId);
    }
    if (canLoadRecordFromGroup(recordSetCache,recordId)) {
      Pair<String,LinkedHashSet<Integer>> tranche=recordSetCache.getRecordSetForRecordId(getStorageCacheName(),recordId);
      EvaluationTrace loadTrace=new EvaluationTrace(String.format("String_Node_Str",this.getStorageCacheName(),tranche.first));
      LinkedHashSet<Integer> body=tranche.second;
      storage.bulkRead(body,recordObjectCache.getLoadedCaseMap());
      loadTrace.setOutcome("String_Node_Str" + body.size());
      context.reportTrace(loadTrace);
      return recordObjectCache.getLoadedRecordObject(recordId);
    }
  }
  return getElementSingular(recordId,context);
}

Fixed version (ground truth):
protected Model getElement(int recordId,QueryContext context){
  if (context == null || getStorageCacheName() == null) {
    return getElementSingular(recordId,context);
  }
  RecordSetResultCache recordSetCache=context.getQueryCacheOrNull(RecordSetResultCache.class);
  RecordObjectCache<Model> recordObjectCache=getRecordObjectCacheIfRelevant(context);
  String storageCacheKey=getStorageCacheName();
  if (recordObjectCache != null) {
    if (recordObjectCache.isLoaded(storageCacheKey,recordId)) {
      return recordObjectCache.getLoadedRecordObject(storageCacheKey,recordId);
    }
    FunctionUtils.toString(XPathParseTool.parseXPath().eval(evalContext));
    if (canLoadRecordFromGroup(recordSetCache,recordId)) {
      Pair<String,LinkedHashSet<Integer>> tranche=recordSetCache.getRecordSetForRecordId(storageCacheKey,recordId);
      EvaluationTrace loadTrace=new EvaluationTrace(String.format("String_Node_Str",this.getStorageCacheName(),tranche.first));
      LinkedHashSet<Integer> body=tranche.second;
      storage.bulkRead(body,recordObjectCache.getLoadedCaseMap(storageCacheKey));
      loadTrace.setOutcome("String_Node_Str" + body.size());
      context.reportTrace(loadTrace);
      return recordObjectCache.getLoadedRecordObject(storageCacheKey,recordId);
    }
  }
  return getElementSingular(recordId,context);
}
Program: 146596
Project: 146596
Buggy source:
public HashMap<Integer,T> getLoadedCaseMap(){
  return cachedRecordObjects;
}

Fixed version (ground truth):
public HashMap<Integer,T> getLoadedCaseMap(String storageSetID){
  return getCache(storageSetID);
}
Program: 146597
Project: 146597
Buggy source:
public T getLoadedRecordObject(int recordId){
  return cachedRecordObjects.get(recordId);
}

Fixed version (ground truth):
public T getLoadedRecordObject(String storageSetID,int recordId){
  return getCache(storageSetID).get(recordId);
}
Program: 146598
Project: 146598
Buggy source:
public boolean isLoaded(int recordId){
  return cachedRecordObjects.containsKey(recordId);
}

Fixed version (ground truth):
public boolean isLoaded(String storageSetID,int recordId){
  return getCache(storageSetID).containsKey(recordId);
}
Program: 146599
Project: 146599
Buggy source:
private SelectChoice buildSelectChoice(TreeReference choiceRef,ItemsetBinding itemset,DataInstance formInstance,EvaluationContext ec,int index){
  String label=itemset.labelExpr.evalReadable(formInstance,new EvaluationContext(ec,choiceRef));
  String value=null;
  TreeElement copyNode=null;
  if (itemset.copyMode) {
    copyNode=this.getMainInstance().resolveReference(itemset.copyRef.contextualize(choiceRef));
  }
  if (itemset.valueRef != null) {
    value=itemset.valueExpr.evalReadable(formInstance,new EvaluationContext(ec,choiceRef));
  }
  SelectChoice choice=new SelectChoice(label,value != null ? value : "String_Node_Str" + index,itemset.labelIsItext);
  choice.setIndex(index);
  if (itemset.copyMode) {
    choice.copyNode=copyNode;
  }
  if (itemset.sortRef != null) {
    String evaluatedSortProperty=itemset.sortExpr.evalReadable(formInstance,new EvaluationContext(ec,choiceRef));
    choice.setSortProperty(evaluatedSortProperty);
  }
  return choice;
  if (reporter != null) {
    InstrumentationUtils.printAndClearTraces(reporter,"String_Node_Str");
  }
}

Fixed version (ground truth):
private SelectChoice buildSelectChoice(TreeReference choiceRef,ItemsetBinding itemset,DataInstance formInstance,EvaluationContext ec,ReducingTraceReporter reporter,int index){
  String label=itemset.labelExpr.evalReadable(formInstance,new EvaluationContext(ec,choiceRef));
  if (reporter != null) {
    InstrumentationUtils.printAndClearTraces(reporter,"String_Node_Str");
  }
  String value=null;
  TreeElement copyNode=null;
  if (itemset.copyMode) {
    copyNode=this.getMainInstance().resolveReference(itemset.copyRef.contextualize(choiceRef));
  }
  if (itemset.valueRef != null) {
    value=itemset.valueExpr.evalReadable(formInstance,new EvaluationContext(ec,choiceRef));
  }
  if (reporter != null) {
    InstrumentationUtils.printAndClearTraces(reporter,"String_Node_Str");
  }
  SelectChoice choice=new SelectChoice(label,value != null ? value : "String_Node_Str" + index,itemset.labelIsItext);
  choice.setIndex(index);
  if (itemset.copyMode) {
    choice.copyNode=copyNode;
  }
  if (itemset.sortRef != null) {
    String evaluatedSortProperty=itemset.sortExpr.evalReadable(formInstance,new EvaluationContext(ec,choiceRef));
    choice.setSortProperty(evaluatedSortProperty);
  }
  if (reporter != null) {
    InstrumentationUtils.printAndClearTraces(reporter,"String_Node_Str");
  }
  return choice;
}
Program: 146601
Project: 146601
Buggy source:
private void runAsync(Runnable test){
  Thread t=new Thread(test);
  t.start();
  try {
    t.join(50);
  }
 catch (  InterruptedException e) {
  }
  if (t.isAlive()) {
    t.stop();
    throw new RuntimeException("String_Node_Str");
  }
}

Fixed version (ground truth):
private void runAsync(Runnable test,String label){
  Thread t=new Thread(test);
  t.start();
  try {
    t.join(50);
  }
 catch (  InterruptedException e) {
  }
  if (t.isAlive()) {
    t.stop();
    throw new RuntimeException("String_Node_Str" + label);
  }
}
Program: 146602
Project: 146602
Buggy source:
@Test public void testLinearSub(){
  final String F="String_Node_Str";
  final String S="String_Node_Str";
  final String C="String_Node_Str";
  final String D="String_Node_Str";
  final String[] res=new String[]{"String_Node_Str","String_Node_Str"};
  assertEquals(Localizer.processArguments("String_Node_Str",new String[]{F}),F);
  assertEquals(Localizer.processArguments("String_Node_Str",new String[]{F,S}),F + "String_Node_Str" + S);
  assertEquals(Localizer.processArguments("String_Node_Str",new String[]{F}),"String_Node_Str" + F);
  assertEquals(Localizer.processArguments("String_Node_Str",new String[]{F}),"String_Node_Str" + F + "String_Node_Str");
  final String[] holder=new String[1];
  runAsync(new Runnable(){
    @Override public void run(){
      holder[0]=Localizer.processArguments("String_Node_Str",new String[]{C});
    }
  }
);
  assertEquals(holder[0],C);
  runAsync(new Runnable(){
    @Override public void run(){
      holder[0]=Localizer.processArguments("String_Node_Str",new String[]{D});
    }
  }
);
  assertEquals(holder[0],D);
  runAsync(new Runnable(){
    @Override public void run(){
      holder[0]=Localizer.processArguments(holder[0],res);
    }
  }
);
  assertEquals(holder[0],res[1] + res[0]);
  runAsync(new Runnable(){
    @Override public void run(){
      holder[0]=Localizer.processArguments("String_Node_Str",res);
    }
  }
);
  assertEquals(holder[0],"String_Node_Str" + res[1]);
}

Fixed version (ground truth):
@Test public void testLinearSub(){
  final String F="String_Node_Str";
  final String S="String_Node_Str";
  final String C="String_Node_Str";
  final String D="String_Node_Str";
  final String[] res=new String[]{"String_Node_Str","String_Node_Str"};
  assertEquals(Localizer.processArguments("String_Node_Str",new String[]{F}),F);
  assertEquals(Localizer.processArguments("String_Node_Str",new String[]{F,S}),F + "String_Node_Str" + S);
  assertEquals(Localizer.processArguments("String_Node_Str",new String[]{F}),"String_Node_Str" + F);
  assertEquals(Localizer.processArguments("String_Node_Str",new String[]{F}),"String_Node_Str" + F + "String_Node_Str");
  final String[] holder=new String[1];
  runAsync(new Runnable(){
    @Override public void run(){
      holder[0]=Localizer.processArguments("String_Node_Str",new String[]{C});
    }
  }
,"String_Node_Str" + C);
  assertEquals(holder[0],C);
  runAsync(new Runnable(){
    @Override public void run(){
      holder[0]=Localizer.processArguments("String_Node_Str",new String[]{D});
    }
  }
,"String_Node_Str" + D);
  assertEquals(holder[0],D);
  runAsync(new Runnable(){
    @Override public void run(){
      holder[0]=Localizer.processArguments(holder[0],res);
    }
  }
,"String_Node_Str" + res[1] + res[0]);
  assertEquals(holder[0],res[1] + res[0]);
  runAsync(new Runnable(){
    @Override public void run(){
      holder[0]=Localizer.processArguments("String_Node_Str",res);
    }
  }
,"String_Node_Str" + "String_Node_Str" + res[1]);
  assertEquals(holder[0],"String_Node_Str" + res[1]);
}
Program: 146603
Project: 146603
Buggy source:
/** 
 * Converts a (possibly relative) reference into an absolute reference based on its parent
 * @param ref       potentially null reference
 * @param parentRef must be an absolute path
 */
public static XPathReference getAbsRef(XPathReference ref,TreeReference parentRef){
  TreeReference tref;
  if (!parentRef.isAbsolute()) {
    throw new RuntimeException("String_Node_Str");
  }
  if (ref != null) {
    tref=ref.getReference();
  }
 else {
    tref=TreeReference.selfRef();
  }
  tref=tref.parent(parentRef);
  if (tref == null) {
    throw new XFormParseException("String_Node_Str" + tref + "String_Node_Str"+ parentRef+ "String_Node_Str");
  }
  return new XPathReference(tref);
}

Fixed version (ground truth):
/** 
 * Converts a (possibly relative) reference into an absolute reference based on its parent
 * @param ref       potentially null reference
 * @param parentRef must be an absolute path
 */
public static XPathReference getAbsRef(XPathReference ref,TreeReference parentRef){
  TreeReference tref;
  if (!parentRef.isAbsolute()) {
    throw new RuntimeException("String_Node_Str");
  }
  if (ref != null) {
    tref=ref.getReference();
  }
 else {
    tref=TreeReference.selfRef();
  }
  tref=tref.parent(parentRef);
  if (tref == null) {
    throw new XFormParseException("String_Node_Str" + ref.getReference().toString(true) + "String_Node_Str"+ parentRef+ "String_Node_Str");
  }
  return new XPathReference(tref);
}
Program: 146604
Project: 146604
Buggy source:
@Test public void testEmptyMenu(){
  SessionWrapper session=mApp.getSession();
  MenuLoader menuLoader=new MenuLoader(session.getPlatform(),session,"String_Node_Str",new TestLogger());
  this.mChoices=menuLoader.getMenus();
  Assert.assertEquals("String_Node_Str",this.mChoices,1);
}

Fixed version (ground truth):
@Test public void testEmptyMenu(){
  SessionWrapper session=mApp.getSession();
  MenuLoader menuLoader=new MenuLoader(session.getPlatform(),session,"String_Node_Str",new TestLogger());
  this.mChoices=menuLoader.getMenus();
  Assert.assertEquals("String_Node_Str",this.mChoices.length,1);
}
Program: 146605
Project: 146605
Buggy source:
protected Model getModelTemplate(){
  return storage.read(1);
}

Fixed version (ground truth):
protected Model getModelTemplate(){
  return storage.read(0);
}
Program: 146606
Project: 146606
Buggy source:
@Test public void queryLookupsOfSubelementsInIndexedFixtures() throws XPathSyntaxException, UnfullfilledRequirementsException, XmlPullParserException, IOException, InvalidStructureException {
  ParseUtils.parseIntoSandbox(getClass().getResourceAsStream("String_Node_Str"),sandbox);
  assertEquals(4,sandbox.getIndexedFixtureStorage("String_Node_Str").getNumRecords());
  EvaluationContext ec=MockDataUtils.buildContextWithInstance(sandbox,"String_Node_Str",CaseTestUtils.FIXTURE_INSTANCE_PRODUCT);
  CaseTestUtils.xpathEvalAndAssert(ec,"String_Node_Str","String_Node_Str");
  CaseTestUtils.xpathEvalAndAssert(ec,"String_Node_Str","String_Node_Str");
  CaseTestUtils.xpathEvalAndAssert(ec,"String_Node_Str","String_Node_Str");
  CaseTestUtils.xpathEvalAndAssert(ec,"String_Node_Str","String_Node_Str");
  CaseTestUtils.xpathEvalAndAssert(ec,"String_Node_Str","String_Node_Str");
}

Fixed version (ground truth):
@Test public void queryLookupsOfSubelementsInIndexedFixtures() throws XPathSyntaxException, UnfullfilledRequirementsException, XmlPullParserException, IOException, InvalidStructureException {
  ParseUtils.parseIntoSandbox(getClass().getResourceAsStream("String_Node_Str"),sandbox);
  assertEquals(4,sandbox.getIndexedFixtureStorage("String_Node_Str").getNumRecords());
  EvaluationContext ec=MockDataUtils.buildContextWithInstance(sandbox,"String_Node_Str",CaseTestUtils.FIXTURE_INSTANCE_PRODUCT);
  CaseTestUtils.xpathEvalAndAssert(ec,"String_Node_Str","String_Node_Str");
  CaseTestUtils.xpathEvalAndAssert(ec,"String_Node_Str","String_Node_Str");
  CaseTestUtils.xpathEvalAndAssert(ec,"String_Node_Str","String_Node_Str");
}
Program: 146607
Project: 146607
Buggy source:
@Override protected Hashtable<XPathPathExpr,String> getStorageIndexMap(){
  if (storageIndexMap == null) {
    storageIndexMap=new Hashtable<>();
    StorageBackedModel template=getModelTemplate();
    for (    String attrName : template.getAttributes().keySet()) {
      storageIndexMap.put(XPathReference.getPathExpr(attrName),StorageBackedModel.getColumnName(attrName));
    }
    for (    String elementName : template.getElements().keySet()) {
      String escapedElem=StorageBackedModel.getUniqueColumnName(elementName,template.getEscapedAttributeKeys());
      storageIndexMap.put(XPathReference.getPathExpr(elementName),escapedElem);
    }
  }
  return storageIndexMap;
}

Fixed version (ground truth):
@Override protected Hashtable<XPathPathExpr,String> getStorageIndexMap(){
  if (storageIndexMap == null) {
    storageIndexMap=new Hashtable<>();
    StorageBackedModel template=getModelTemplate();
    for (    String attrName : template.getAttributes().keySet()) {
      storageIndexMap.put(XPathReference.getPathExpr("String_Node_Str" + attrName),StorageBackedModel.getColumnName(attrName));
    }
    for (    String elementName : template.getElements().keySet()) {
      String escapedElem=StorageBackedModel.getUniqueColumnName(elementName,template.getEscapedAttributeKeys());
      storageIndexMap.put(XPathReference.getPathExpr(elementName),escapedElem);
    }
  }
  return storageIndexMap;
}
Program: 146610
Project: 146610
Buggy source:
protected TreeElement loadFixtureRoot(String reference,String userId){
  String refId=reference.substring(reference.lastIndexOf('/') + 1,reference.length());
  try {
    String key=refId + userId;
    TreeElement root=fixtureBases.retrieve(key);
    if (root == null) {
      FormInstance fixture=SandboxUtils.loadFixture(mSandbox,refId,userId);
      if (fixture == null) {
        throw new FixtureInitializationException(reference);
      }
      root=fixture.getRoot();
      fixtureBases.register(key,root);
    }
    return root;
  }
 catch (  IllegalStateException ise) {
    throw new FixtureInitializationException(reference);
  }
}

Fixed version (ground truth):
protected TreeElement loadFixtureRoot(ExternalDataInstance instance,String reference,String userId){
  String refId=reference.substring(reference.lastIndexOf('/') + 1,reference.length());
  String instanceBase=instance.getBase().getInstanceName();
  try {
    String key=refId + userId + instanceBase;
    TreeElement root=fixtureBases.retrieve(key);
    if (root == null) {
      FormInstance fixture=SandboxUtils.loadFixture(mSandbox,refId,userId);
      if (fixture == null) {
        throw new FixtureInitializationException(reference);
      }
      root=fixture.getRoot();
      fixtureBases.register(key,root);
    }
    return root;
  }
 catch (  IllegalStateException ise) {
    throw new FixtureInitializationException(reference);
  }
}
Program: 146611
Project: 146611
Buggy source:
protected AbstractTreeElement setupFixtureData(ExternalDataInstance instance){
  String ref=instance.getReference();
  String userId="String_Node_Str";
  User u=mSandbox.getLoggedInUser();
  if (u != null) {
    userId=u.getUniqueId();
  }
  TreeElement fixtureRoot=loadFixtureRoot(ref,userId);
  fixtureRoot.setParent(instance.getBase());
  return fixtureRoot;
}

Fixed version (ground truth):
protected AbstractTreeElement setupFixtureData(ExternalDataInstance instance){
  String ref=instance.getReference();
  String userId="String_Node_Str";
  User u=mSandbox.getLoggedInUser();
  if (u != null) {
    userId=u.getUniqueId();
  }
  TreeElement fixtureRoot=loadFixtureRoot(instance,ref,userId);
  fixtureRoot.setParent(instance.getBase());
  return fixtureRoot;
}
Program: 146612
Project: 146612
Buggy source:
@Override public void readExternal(DataInputStream in,PrototypeFactory pf) throws IOException, DeserializationException {
  super.readExternal(in,pf);
  hiddenQueryValues=(Hashtable<String,XPathExpression>)ExtUtil.read(in,new ExtWrapMapPoly(String.class),pf);
  userQueryPrompts=(OrderedHashtable<String,DisplayUnit>)ExtUtil.read(in,new ExtWrapMap(String.class,DisplayUnit.class),pf);
}

Fixed version (ground truth):
@Override public void readExternal(DataInputStream in,PrototypeFactory pf) throws IOException, DeserializationException {
  super.readExternal(in,pf);
  hiddenQueryValues=(Hashtable<String,XPathExpression>)ExtUtil.read(in,new ExtWrapMapPoly(String.class),pf);
  userQueryPrompts=(OrderedHashtable<String,DisplayUnit>)ExtUtil.read(in,new ExtWrapMap(String.class,DisplayUnit.class,ExtWrapMap.TYPE_ORDERED),pf);
}
Program: 146613
Project: 146613
Buggy source:
/** 
 * Deletes the inner-most repeat that this node belongs to and returns the corresponding FormIndex. Behavior is currently undefined if you call this method on a node that is not contained within a repeat.
 */
public FormIndex deleteRepeat(FormIndex index){
  Vector indexes=new Vector();
  Vector multiplicities=new Vector();
  Vector elements=new Vector();
  collapseIndex(index,indexes,multiplicities,elements);
  for (int i=elements.size() - 1; i >= 0; i--) {
    IFormElement e=(IFormElement)elements.elementAt(i);
    if (e instanceof GroupDef && ((GroupDef)e).getRepeat()) {
      break;
    }
 else {
      indexes.removeElementAt(i);
      multiplicities.removeElementAt(i);
      elements.removeElementAt(i);
    }
  }
  FormIndex newIndex=buildIndex(indexes,multiplicities,elements);
  TreeReference deleteRef=getChildInstanceRef(newIndex);
  TreeElement deleteElement=mainInstance.resolveReference(deleteRef);
  TreeReference parentRef=deleteRef.getParentRef();
  TreeElement parentElement=mainInstance.resolveReference(parentRef);
  int childMult=deleteElement.getMult();
  parentElement.removeChild(deleteElement);
  for (int i=0; i < parentElement.getNumChildren(); i++) {
    TreeElement child=parentElement.getChildAt(i);
    if (child.getMult() > childMult) {
      child.setMult(child.getMult() - 1);
    }
  }
  this.getMainInstance().cleanCache();
  triggerTriggerables(deleteRef);
  return newIndex;
}

Fixed version (ground truth):
/** 
 * Deletes the inner-most repeat that this node belongs to and returns the corresponding FormIndex. Behavior is currently undefined if you call this method on a node that is not contained within a repeat.
 */
public FormIndex deleteRepeat(FormIndex index){
  Vector indexes=new Vector();
  Vector multiplicities=new Vector();
  Vector elements=new Vector();
  collapseIndex(index,indexes,multiplicities,elements);
  for (int i=elements.size() - 1; i >= 0; i--) {
    IFormElement e=(IFormElement)elements.elementAt(i);
    if (e instanceof GroupDef && ((GroupDef)e).getRepeat()) {
      break;
    }
 else {
      indexes.removeElementAt(i);
      multiplicities.removeElementAt(i);
      elements.removeElementAt(i);
    }
  }
  FormIndex newIndex=buildIndex(indexes,multiplicities,elements);
  TreeReference deleteRef=getChildInstanceRef(newIndex);
  TreeElement deleteElement=mainInstance.resolveReference(deleteRef);
  TreeReference parentRef=deleteRef.getParentRef();
  TreeElement parentElement=mainInstance.resolveReference(parentRef);
  int childMult=deleteElement.getMult();
  parentElement.removeChild(deleteElement);
  for (int i=0; i < parentElement.getNumChildren(); i++) {
    TreeElement child=parentElement.getChildAt(i);
    if (child.doFieldsMatch(deleteElement) && child.getMult() > childMult) {
      child.setMult(child.getMult() - 1);
    }
  }
  this.getMainInstance().cleanCache();
  triggerTriggerables(deleteRef);
  return newIndex;
}
Program: 146615
Project: 146615
Buggy source:
@Override public TreeReference getRef(){
  if (ref == null) {
    ref=TreeReference.buildRefFromTreeElement(this);
  }
  return ref;
}

Fixed version (ground truth):
@Override public TreeReference getRef(){
  if (ref == null) {
    ref=TreeReference.buildRefFromTreeElement((AbstractTreeElement)this);
  }
  return ref;
}
Program: 146616
Project: 146616
Buggy source:
@Override public TreeReference getRef(){
  if (cachedRef == null) {
    cachedRef=TreeReference.buildRefFromTreeElement(this);
  }
  return cachedRef;
}

Fixed version (ground truth):
@Override public TreeReference getRef(){
  if (cachedRef == null) {
    cachedRef=TreeReference.buildRefFromTreeElement((AbstractTreeElement)this);
  }
  return cachedRef;
}
Program: 146617
Project: 146617
Buggy source:
public TreeReference getRef(){
  if (ref == null) {
    ref=TreeReference.buildRefFromTreeElement(this);
  }
  return ref;
}

Fixed version (ground truth):
public TreeReference getRef(){
  if (ref == null) {
    ref=TreeReference.buildRefFromTreeElement((AbstractTreeElement)this);
  }
  return ref;
}
Program: 146618
Project: 146618
Buggy source:
@Override public TreeReference getRef(){
  if (cachedRef == null) {
    cachedRef=TreeReference.buildRefFromTreeElement(this);
  }
  return cachedRef;
}

Fixed version (ground truth):
@Override public TreeReference getRef(){
  if (cachedRef == null) {
    cachedRef=TreeReference.buildRefFromTreeElement((AbstractTreeElement)this);
  }
  return cachedRef;
}
Program: 146619
Project: 146619
Buggy source:
@Override public TreeReference getRef(){
  if (ref == null) {
    ref=TreeReference.buildRefFromTreeElement((AbstractTreeElement)this);
  }
  return ref;
}

Fixed version (ground truth):
@Override public TreeReference getRef(){
  if (ref == null) {
    ref=TreeReference.buildRefFromTreeElement(this);
  }
  return ref;
}
Program: 146620
Project: 146620
Buggy source:
@Override public TreeReference getRef(){
  if (cachedRef == null) {
    cachedRef=TreeReference.buildRefFromTreeElement((AbstractTreeElement)this);
  }
  return cachedRef;
}

Fixed version (ground truth):
@Override public TreeReference getRef(){
  if (cachedRef == null) {
    cachedRef=TreeReference.buildRefFromTreeElement(this);
  }
  return cachedRef;
}
Program: 146621
Project: 146621
Buggy source:
public TreeReference getRef(){
  if (ref == null) {
    ref=TreeReference.buildRefFromTreeElement((AbstractTreeElement)this);
  }
  return ref;
}

Fixed version (ground truth):
public TreeReference getRef(){
  if (ref == null) {
    ref=TreeReference.buildRefFromTreeElement(this);
  }
  return ref;
}
Program: 146622
Project: 146622
Buggy source:
@Override public TreeReference getRef(){
  if (cachedRef == null) {
    cachedRef=TreeReference.buildRefFromTreeElement((AbstractTreeElement)this);
  }
  return cachedRef;
}

Fixed version (ground truth):
@Override public TreeReference getRef(){
  if (cachedRef == null) {
    cachedRef=TreeReference.buildRefFromTreeElement(this);
  }
  return cachedRef;
}
Program: 146623
Project: 146623
Buggy source:
@Override public void writeExternal(DataOutputStream out) throws IOException {
  ExtUtil.write(out,new ExtWrapMap(params));
  ExtUtil.writeString(out,url);
}

Fixed version (ground truth):
@Override public void writeExternal(DataOutputStream out) throws IOException {
  ExtUtil.write(out,new ExtWrapMapPoly(params));
  ExtUtil.writeString(out,url);
}
Program: 146624
Project: 146624
Buggy source:
@Override public void readExternal(DataInputStream in,PrototypeFactory pf) throws IOException, DeserializationException {
  params=(Hashtable<String,XPathExpression>)ExtUtil.read(in,new ExtWrapMap(String.class,XPathExpression.class));
  url=ExtUtil.readString(in);
}

Fixed version (ground truth):
@Override public void readExternal(DataInputStream in,PrototypeFactory pf) throws IOException, DeserializationException {
  params=(Hashtable<String,XPathExpression>)ExtUtil.read(in,new ExtWrapMapPoly(String.class),pf);
  url=ExtUtil.readString(in);
}
Program: 146625
Project: 146625
Buggy source:
@Override public void readExternal(DataInputStream in,PrototypeFactory pf) throws IOException, DeserializationException {
  super.readExternal(in,pf);
  hiddenQueryValues=(Hashtable)ExtUtil.read(in,new ExtWrapMapPoly(String.class));
  userQueryPrompts=(Hashtable<String,DisplayUnit>)ExtUtil.read(in,new ExtWrapMap(String.class,DisplayUnit.class));
}

Fixed version (ground truth):
@Override public void readExternal(DataInputStream in,PrototypeFactory pf) throws IOException, DeserializationException {
  super.readExternal(in,pf);
  hiddenQueryValues=(Hashtable<String,XPathExpression>)ExtUtil.read(in,new ExtWrapMapPoly(String.class),pf);
  userQueryPrompts=(Hashtable<String,DisplayUnit>)ExtUtil.read(in,new ExtWrapMap(String.class,DisplayUnit.class),pf);
}
Program: 146626
Project: 146626
Buggy source:
@Override public boolean equals(Object o){
  if (o instanceof XPathBinaryOpExpr) {
    XPathBinaryOpExpr x=(XPathBinaryOpExpr)o;
    return op == x.op && a.equals(x.a) && b.equals(x.b);
  }
 else {
    return false;
  }
}

Fixed version (ground truth):
@Override public abstract boolean equals(Object o);
Program: 146627
Project: 146627
Buggy source:
@Override public boolean equals(Object o){
  if (o instanceof XPathBinaryOpExpr) {
    XPathBinaryOpExpr x=(XPathBinaryOpExpr)o;
    return op == x.op && a.equals(x.a) && b.equals(x.b);
  }
 else {
    return false;
  }
}

Fixed version (ground truth):
@Override public abstract boolean equals(Object o);
Program: 146628
Project: 146628
Buggy source:
@Override public FormInstance parse() throws InvalidStructureException, IOException, XmlPullParserException, UnfullfilledRequirementsException {
  this.checkNode("String_Node_Str");
  String fixtureId=parser.getAttributeValue(null,"String_Node_Str");
  if (fixtureId == null) {
    throw new InvalidStructureException("String_Node_Str",parser);
  }
  String userId=parser.getAttributeValue(null,"String_Node_Str");
  parser.nextTag();
  TreeElement root=new TreeElementParser(parser,0,fixtureId).parse();
  FormInstance instance=new FormInstance(root,fixtureId);
  if (userId != null) {
    instance.schema=userId;
  }
  if (storage() != null) {
    int recordId=-1;
    Vector<Integer> matchingFixtures=storage().getIDsForValue(FormInstance.META_ID,fixtureId);
    if (matchingFixtures.size() > 0) {
      Vector<Integer> matchingUsers=storage().getIDsForValue(FormInstance.META_XMLNS,ExtUtil.emptyIfNull(userId));
      for (      Integer i : matchingFixtures) {
        if (matchingUsers.indexOf(i) != -1) {
          recordId=i.intValue();
        }
      }
    }
    if (recordId != -1) {
      if (!overwrite) {
        return instance;
      }
      instance.setID(recordId);
    }
  }
  commit(instance);
  return instance;
}

Fixed version (ground truth):
@Override public FormInstance parse() throws InvalidStructureException, IOException, XmlPullParserException, UnfullfilledRequirementsException {
  this.checkNode("String_Node_Str");
  String fixtureId=parser.getAttributeValue(null,"String_Node_Str");
  if (fixtureId == null) {
    throw new InvalidStructureException("String_Node_Str",parser);
  }
  String userId=parser.getAttributeValue(null,"String_Node_Str");
  TreeElement root;
  if (!nextTagInBlock("String_Node_Str")) {
    return null;
  }
  root=new TreeElementParser(parser,0,fixtureId).parse();
  FormInstance instance=new FormInstance(root,fixtureId);
  if (userId != null) {
    instance.schema=userId;
  }
  if (storage() != null) {
    int recordId=-1;
    Vector<Integer> matchingFixtures=storage().getIDsForValue(FormInstance.META_ID,fixtureId);
    if (matchingFixtures.size() > 0) {
      Vector<Integer> matchingUsers=storage().getIDsForValue(FormInstance.META_XMLNS,ExtUtil.emptyIfNull(userId));
      for (      Integer i : matchingFixtures) {
        if (matchingUsers.indexOf(i) != -1) {
          recordId=i.intValue();
        }
      }
    }
    if (recordId != -1) {
      if (!overwrite) {
        return instance;
      }
      instance.setID(recordId);
    }
  }
  commit(instance);
  return instance;
}
Program: 146629
Project: 146629
Buggy source:
/** 
 * Template constructor (For elements that need to create reference nodesets but never look up values)
 */
private CaseChildElement(CaseInstanceTreeElement parent){
  this.parent=parent;
  this.recordId=TreeReference.INDEX_TEMPLATE;
  this.mult=TreeReference.INDEX_TEMPLATE;
  this.caseId=null;
  empty=new TreeElement();
  empty=new TreeElement("String_Node_Str");
  empty.setMult(this.mult);
  empty.setAttribute(null,"String_Node_Str","String_Node_Str");
  empty.setAttribute(null,"String_Node_Str","String_Node_Str");
  empty.setAttribute(null,"String_Node_Str","String_Node_Str");
  TreeElement scratch=new TreeElement("String_Node_Str");
  scratch.setAnswer(null);
  empty.addChild(scratch);
  scratch=new TreeElement("String_Node_Str");
  scratch.setAnswer(null);
  empty.addChild(scratch);
  scratch=new TreeElement("String_Node_Str");
  scratch.setAnswer(null);
  empty.addChild(scratch);
}

Fixed version (ground truth):
/** 
 * Template constructor (For elements that need to create reference nodesets but never look up values)
 */
private CaseChildElement(CaseInstanceTreeElement parent){
  this.parent=parent;
  this.recordId=TreeReference.INDEX_TEMPLATE;
  this.mult=TreeReference.INDEX_TEMPLATE;
  this.caseId=null;
  empty=new TreeElement("String_Node_Str");
  empty.setMult(this.mult);
  empty.setAttribute(null,"String_Node_Str","String_Node_Str");
  empty.setAttribute(null,"String_Node_Str","String_Node_Str");
  empty.setAttribute(null,"String_Node_Str","String_Node_Str");
  TreeElement scratch=new TreeElement("String_Node_Str");
  scratch.setAnswer(null);
  empty.addChild(scratch);
  scratch=new TreeElement("String_Node_Str");
  scratch.setAnswer(null);
  empty.addChild(scratch);
  scratch=new TreeElement("String_Node_Str");
  scratch.setAnswer(null);
  empty.addChild(scratch);
}
Program: 146630
Project: 146630
Buggy source:
private Vector<TreeElement> getChildrenWithName(String name,boolean includeTemplate){
  Vector<TreeElement> v=new Vector<TreeElement>();
  if (children == null) {
    return v;
  }
  for (int i=0; i < this.children.size(); i++) {
    TreeElement child=(TreeElement)this.children.elementAt(i);
    if ((child.getName().equals(name) || name.equals(TreeReference.NAME_WILDCARD)) && (includeTemplate || child.multiplicity != TreeReference.INDEX_TEMPLATE))     v.addElement(child);
  }
  return v;
}

Fixed version (ground truth):
private Vector<TreeElement> getChildrenWithName(String name,boolean includeTemplate){
  Vector<TreeElement> v=new Vector<TreeElement>();
  if (children == null) {
    return v;
  }
  for (int i=0; i < children.size(); i++) {
    TreeElement child=children.elementAt(i);
    if ((child.getName().equals(name) || name.equals(TreeReference.NAME_WILDCARD)) && (includeTemplate || child.multiplicity != TreeReference.INDEX_TEMPLATE))     v.addElement(child);
  }
  return v;
}
Program: 146631
Project: 146631
Buggy source:
@Override public TreeElement getChild(String name,int multiplicity){
  if (this.children == null) {
    return null;
  }
  if (name.equals(TreeReference.NAME_WILDCARD)) {
    if (multiplicity == TreeReference.INDEX_TEMPLATE || this.children.size() < multiplicity + 1) {
      return null;
    }
    return (TreeElement)this.children.elementAt(multiplicity);
  }
 else {
    for (    TreeElement child : children) {
      if (((name.hashCode() == child.getName().hashCode()) || name.equals(child.getName())) && child.getMult() == multiplicity) {
        return child;
      }
    }
  }
  return null;
}

Fixed version (ground truth):
@Override public TreeElement getChild(String name,int multiplicity){
  if (children == null) {
    return null;
  }
  if (TreeReference.NAME_WILDCARD.equals(name)) {
    if (multiplicity == TreeReference.INDEX_TEMPLATE || children.size() < multiplicity + 1) {
      return null;
    }
    return children.elementAt(multiplicity);
  }
 else {
    for (    TreeElement child : children) {
      if ((name.hashCode() == child.getName().hashCode() || name.equals(child.getName())) && child.getMult() == multiplicity) {
        return child;
      }
    }
  }
  return null;
}
Program: 146632
Project: 146632
Buggy source:
public void setEnabled(boolean enabled,boolean inherited){
  boolean oldEnabled=isEnabled();
  if (inherited) {
    setMaskVar(MASK_ENABLED_INH,enabled);
  }
 else {
    setMaskVar(MASK_ENABLED,enabled);
  }
  if (isEnabled() != oldEnabled) {
    if (children != null) {
      for (int i=0; i < children.size(); i++) {
        ((TreeElement)children.elementAt(i)).setEnabled(isEnabled(),true);
      }
    }
    alertStateObservers(FormElementStateListener.CHANGE_ENABLED);
  }
}

Fixed version (ground truth):
public void setEnabled(boolean enabled,boolean inherited){
  boolean oldEnabled=isEnabled();
  if (inherited) {
    setMaskVar(MASK_ENABLED_INH,enabled);
  }
 else {
    setMaskVar(MASK_ENABLED,enabled);
  }
  if (isEnabled() != oldEnabled) {
    if (children != null) {
      for (int i=0; i < children.size(); i++) {
        children.elementAt(i).setEnabled(isEnabled(),true);
      }
    }
    alertStateObservers(FormElementStateListener.CHANGE_ENABLED);
  }
}
Program: 146633
Project: 146633
Buggy source:
public TreeElement deepCopy(boolean includeTemplates){
  TreeElement newNode=shallowCopy();
  if (children != null) {
    newNode.children=new Vector<TreeElement>();
    for (int i=0; i < children.size(); i++) {
      TreeElement child=(TreeElement)children.elementAt(i);
      if (includeTemplates || child.getMult() != TreeReference.INDEX_TEMPLATE) {
        newNode.addChild(child.deepCopy(includeTemplates));
      }
    }
  }
  if (attributes != null) {
    newNode.attributes=new Vector<TreeElement>();
    for (    TreeElement attr : attributes) {
      if (includeTemplates || attr.getMult() != TreeReference.INDEX_TEMPLATE) {
        newNode.addAttribute(attr.deepCopy(includeTemplates));
      }
    }
  }
  return newNode;
}

Fixed version (ground truth):
public TreeElement deepCopy(boolean includeTemplates){
  TreeElement newNode=shallowCopy();
  if (children != null) {
    newNode.children=new Vector<TreeElement>();
    for (int i=0; i < children.size(); i++) {
      TreeElement child=children.elementAt(i);
      if (includeTemplates || child.getMult() != TreeReference.INDEX_TEMPLATE) {
        newNode.addChild(child.deepCopy(includeTemplates));
      }
    }
  }
  if (attributes != null) {
    newNode.attributes=new Vector<TreeElement>();
    for (    TreeElement attr : attributes) {
      if (includeTemplates || attr.getMult() != TreeReference.INDEX_TEMPLATE) {
        newNode.addAttribute(attr.deepCopy(includeTemplates));
      }
    }
  }
  return newNode;
}
Program: 146635
Project: 146635
Buggy source:
@Override public int getNumChildren(){
  return children == null ? 0 : this.children.size();
}

Fixed version (ground truth):
@Override public int getNumChildren(){
  return children == null ? 0 : children.size();
}
Program: 146636
Project: 146636
Buggy source:
private int smallestIntersectingLevelWithPred(TreeReference refInExpr){
  TreeReference intersectionRef=contextRef.intersect(refInExpr);
  for (int refLevel=0; refLevel <= intersectionRef.size(); refLevel++) {
    Vector<XPathExpression> predicates=refInExpr.getPredicate(refLevel);
    if (predicates != null && predicates.size() > 0) {
      return refLevel - 1;
    }
  }
  return -1;
}

Fixed version (ground truth):
private int smallestIntersectingLevelWithPred(TreeReference refInExpr){
  TreeReference intersectionRef=contextRef.intersect(refInExpr.removePredicates());
  for (int refLevel=0; refLevel < Math.min(refInExpr.size(),intersectionRef.size()); refLevel++) {
    Vector<XPathExpression> predicates=refInExpr.getPredicate(refLevel);
    if (predicates != null && predicates.size() > 0) {
      return refLevel;
    }
  }
  return -1;
}
Program: 146637
Project: 146637
Buggy source:
private static CliCommand getCliCommand(String[] args) throws CliCommandNotFound {
  final String commandName=args[0];
  final String[] restArgs=java.util.Arrays.copyOfRange(args,1,args.length);
switch (commandName) {
case "String_Node_Str":
    return new CliValidateCommand(commandName,restArgs);
case "String_Node_Str":
  return new CliPlayCommand(commandName,restArgs);
default :
throw new CliCommandNotFound(commandName);
}
}

Fixed version (ground truth):
private static CliCommand getCliCommand(String commandName) throws CliCommandNotFound {
switch (commandName) {
case "String_Node_Str":
    return new CliValidateCommand();
case "String_Node_Str":
  return new CliPlayCommand();
default :
throw new CliCommandNotFound(commandName);
}
}
Program: 146638
Project: 146638
Buggy source:
public static void main(String[] args){
  CommandLineParser parser=new DefaultParser();
  Options options=getOptions();
  CommandLine cmd;
  CliCommand cliCommand;
  try {
    cliCommand=getCliCommand(args);
  }
 catch (  CliCommandNotFound e) {
    try {
      cmd=parser.parse(options,args);
    }
 catch (    ParseException parseException) {
      System.out.println("String_Node_Str" + parseException.getMessage());
      System.exit(-1);
      return;
    }
    if (cmd.hasOption("String_Node_Str")) {
      printHelpText(options);
      System.exit(0);
      return;
    }
 else {
      System.out.println("String_Node_Str" + e.getCommandName());
      printHelpText(options);
      System.exit(-1);
      return;
    }
  }
  try {
    cliCommand.parseArguments();
  }
 catch (  ParseException e) {
    System.out.println("String_Node_Str" + e.getMessage());
    System.exit(-1);
    return;
  }
  cliCommand.handle();
}

Fixed version (ground truth):
public static void main(String[] args){
  CommandLineParser parser=new DefaultParser();
  Options options=getOptions();
  CommandLine cmd;
  CliCommand cliCommand;
  try {
    cliCommand=getCliCommand(args[0]);
  }
 catch (  CliCommandNotFound e) {
    try {
      cmd=parser.parse(options,args);
    }
 catch (    ParseException parseException) {
      System.out.println("String_Node_Str" + parseException.getMessage());
      printHelpText();
      System.exit(-1);
      return;
    }
    if (cmd.hasOption("String_Node_Str")) {
      printHelpText();
      System.exit(0);
      return;
    }
 else {
      System.out.println("String_Node_Str" + e.getCommandName());
      printHelpText();
      System.exit(-1);
      return;
    }
  }
catch (  ArrayIndexOutOfBoundsException e) {
    printHelpText();
    System.exit(-1);
    return;
  }
  try {
    final String[] restArgs=java.util.Arrays.copyOfRange(args,1,args.length);
    cliCommand.parseArguments(restArgs);
  }
 catch (  ParseException e) {
    System.out.println("String_Node_Str" + e.getMessage());
    cliCommand.printHelpText();
    System.exit(-1);
    return;
  }
catch (  ArrayIndexOutOfBoundsException e) {
    cliCommand.printHelpText();
    System.exit(-1);
    return;
  }
  cliCommand.handle();
}
Program: 146639
Project: 146639
Buggy source:
private static void printHelpText(Options options){
  HelpFormatter formatter=new HelpFormatter();
  formatter.printHelp("String_Node_Str",options);
}

Fixed version (ground truth):
private static void printHelpText(){
  Options options=getOptions();
  HelpFormatter formatter=new HelpFormatter();
  String header="String_Node_Str" + "String_Node_Str";
  CliCommand[] commands={new CliValidateCommand(),new CliPlayCommand()};
  for (  CliCommand command : commands) {
    header+=String.format("String_Node_Str",command.getCommandName(),command.getHelpTextDescription());
  }
  header+="String_Node_Str";
  formatter.printHelp("String_Node_Str",header,options,"String_Node_Str");
}