nus-yam/ex-repair huggingface dataset:
Program: 144808
Project: 144808
Buggy source:
public Boolean parse() throws InvalidStructureException, IOException, XmlPullParserException, UnfullfilledRequirementsException {
  try {
    String rootName=parser.getName();
    if (requiredRootEnvelope != null && !requiredRootEnvelope.equals(rootName)) {
      throw new InvalidStructureException("String_Node_Str" + rootName + "String_Node_Str"+ requiredRootEnvelope+ "String_Node_Str",parser);
    }
    String itemString=parser.getAttributeValue(null,"String_Node_Str");
    int itemNumber=-1;
    if (itemString != null) {
      try {
        itemNumber=Integer.parseInt(itemString);
      }
 catch (      NumberFormatException e) {
        itemNumber=0;
      }
      rListener.setTotalForms(itemNumber);
    }
    parseBlock(rootName);
  }
  finally {
    try {
      is.close();
    }
 catch (    IOException ioe) {
    }
  }
  if (errors.size() == 0) {
    return Boolean.TRUE;
  }
 else {
    return Boolean.FALSE;
  }
}

Fixed version (ground truth):
public Boolean parse() throws InvalidStructureException, IOException, XmlPullParserException, UnfullfilledRequirementsException {
  try {
    String rootName=parser.getName();
    if (requiredRootEnvelope != null && !requiredRootEnvelope.equals(rootName)) {
      throw new InvalidStructureException("String_Node_Str" + rootName + "String_Node_Str"+ requiredRootEnvelope+ "String_Node_Str",parser);
    }
    String itemString=parser.getAttributeValue(null,"String_Node_Str");
    int itemNumber=-1;
    if (itemString != null) {
      try {
        itemNumber=Integer.parseInt(itemString);
      }
 catch (      NumberFormatException e) {
        itemNumber=0;
      }
      if (rListener != null) {
        rListener.setTotalForms(itemNumber);
      }
    }
    parseBlock(rootName);
  }
  finally {
    try {
      is.close();
    }
 catch (    IOException ioe) {
    }
  }
  if (errors.size() == 0) {
    return Boolean.TRUE;
  }
 else {
    return Boolean.FALSE;
  }
}
Program: 144809
Project: 144809
Buggy source:
protected void checkNode(String[] names) throws InvalidStructureException {
  boolean checksOut=false;
  if (parser.getName() == null) {
  }
 else {
    for (    String name : names) {
      if (parser.getName().toLowerCase().equals(name)) {
        checksOut=true;
      }
    }
  }
  if (!checksOut) {
    int eventType=-1;
    try {
      eventType=parser.getEventType();
    }
 catch (    XmlPullParserException xppe) {
    }
    String oneOf=null;
    if (names.length == 1) {
      oneOf="String_Node_Str" + names[0] + "String_Node_Str";
    }
 else {
      oneOf="String_Node_Str";
      for (      String name : names) {
        oneOf+="String_Node_Str" + name + "String_Node_Str";
      }
      oneOf+="String_Node_Str";
    }
    String foundInstead="String_Node_Str";
    if (eventType == KXmlParser.END_TAG) {
      foundInstead="String_Node_Str" + parser.getName() + "String_Node_Str";
    }
 else     if (eventType == KXmlParser.START_TAG) {
      foundInstead="String_Node_Str" + parser.getName() + "String_Node_Str";
    }
 else     if (eventType == KXmlParser.TEXT) {
      foundInstead="String_Node_Str" + parser.getText() + "String_Node_Str";
    }
 else {
      foundInstead="String_Node_Str";
    }
    throw new InvalidStructureException("String_Node_Str" + oneOf + foundInstead+ "String_Node_Str",parser);
  }
}

Fixed version (ground truth):
/** 
 * Evaluates whether the current node is of an appropriate name and throws the proper exception if not.
 * @param name A list of names which are valid during this stepof parsing
 * @throws InvalidStructureException If the node at the currentposition is not the one expected.
 */
protected void checkNode(String[] names) throws InvalidStructureException {
  boolean checksOut=false;
  if (parser.getName() == null) {
  }
 else {
    for (    String name : names) {
      if (parser.getName().toLowerCase().equals(name)) {
        checksOut=true;
      }
    }
  }
  if (!checksOut) {
    int eventType=-1;
    try {
      eventType=parser.getEventType();
    }
 catch (    XmlPullParserException xppe) {
    }
    String oneOf=null;
    if (names.length == 1) {
      oneOf="String_Node_Str" + names[0] + "String_Node_Str";
    }
 else {
      oneOf="String_Node_Str";
      for (      String name : names) {
        oneOf+="String_Node_Str" + name + "String_Node_Str";
      }
      oneOf+="String_Node_Str";
    }
    String foundInstead="String_Node_Str";
    if (eventType == KXmlParser.END_TAG) {
      foundInstead="String_Node_Str" + parser.getName() + "String_Node_Str";
    }
 else     if (eventType == KXmlParser.START_TAG) {
      foundInstead="String_Node_Str" + parser.getName() + "String_Node_Str";
    }
 else     if (eventType == KXmlParser.TEXT) {
      foundInstead="String_Node_Str" + parser.getText() + "String_Node_Str";
    }
 else {
      foundInstead="String_Node_Str";
    }
    throw new InvalidStructureException("String_Node_Str" + oneOf + foundInstead+ "String_Node_Str",parser);
  }
}
Program: 144812
Project: 144812
Buggy source:
private void testEval(String expr,FormInstance model,EvaluationContext ec,Object expected){
  XPathExpression xpe=null;
  boolean exceptionExpected=(expected instanceof XPathException);
  if (ec == null) {
    ec=new EvaluationContext(model);
  }
  try {
    xpe=XPathParseTool.parseXPath(expr);
  }
 catch (  XPathSyntaxException xpse) {
  }
  if (xpe == null) {
    fail("String_Node_Str" + expr);
  }
  try {
    Object result=xpe.eval(model,ec);
    if (exceptionExpected) {
      fail("String_Node_Str" + expr);
    }
 else     if ((result instanceof Double && expected instanceof Double)) {
      Double o=((Double)result).doubleValue();
      Double t=((Double)expected).doubleValue();
      if (Math.abs(o - t) > 1.0e-12) {
        fail("String_Node_Str" + o + "String_Node_Str"+ t+ "String_Node_Str");
      }
    }
 else     if (!expected.equals(result)) {
      fail("String_Node_Str" + expr);
    }
  }
 catch (  XPathException xpex) {
    if (!exceptionExpected) {
      fail("String_Node_Str");
    }
 else     if (xpex.getClass() != expected.getClass()) {
      fail("String_Node_Str");
    }
  }
}

Fixed version (ground truth):
private void testEval(String expr,FormInstance model,EvaluationContext ec,Object expected,double tolerance){
  XPathExpression xpe=null;
  boolean exceptionExpected=(expected instanceof XPathException);
  if (ec == null) {
    ec=new EvaluationContext(model);
  }
  try {
    xpe=XPathParseTool.parseXPath(expr);
  }
 catch (  XPathSyntaxException xpse) {
  }
  if (xpe == null) {
    fail("String_Node_Str" + expr);
  }
  try {
    Object result=xpe.eval(model,ec);
    if (tolerance != XPathFuncExpr.DOUBLE_TOLERANCE) {
      System.out.println(expr + "String_Node_Str" + result);
    }
    if (exceptionExpected) {
      fail("String_Node_Str" + expr);
    }
 else     if ((result instanceof Double && expected instanceof Double)) {
      Double o=((Double)result).doubleValue();
      Double t=((Double)expected).doubleValue();
      if (Math.abs(o - t) > tolerance) {
        fail("String_Node_Str" + o + "String_Node_Str"+ t+ "String_Node_Str");
      }
    }
 else     if (!expected.equals(result)) {
      fail("String_Node_Str" + expr);
    }
  }
 catch (  XPathException xpex) {
    if (!exceptionExpected) {
      fail("String_Node_Str");
    }
 else     if (xpex.getClass() != expected.getClass()) {
      fail("String_Node_Str");
    }
  }
}
Program: 144816
Project: 144816
Buggy source:
public boolean equals(Object o){
  return (o instanceof PrefixTreeNode ? prefix.equals(((PrefixTreeNode)o).prefix) : false);
}

Fixed version (ground truth):
public boolean equals(Object o){
  return (o instanceof PrefixTreeNode ? ArrayUtilities.arraysEqual(prefix,0,((PrefixTreeNode)o).prefix,0) : false);
}
Program: 144817
Project: 144817
Buggy source:
public void testAddExistingLocale(){
  Localizer l=new Localizer();
  final String TEST_LOCALE="String_Node_Str";
  l.addAvailableLocale(TEST_LOCALE);
  TableLocaleSource table=new TableLocaleSource();
  table.setLocaleMapping("String_Node_Str","String_Node_Str");
  l.registerLocaleResource(TEST_LOCALE,table);
  OrderedHashtable localeData=l.getLocaleData(TEST_LOCALE);
  boolean result=l.addAvailableLocale(TEST_LOCALE);
  if (result) {
    fail("String_Node_Str");
  }
  if (!localeData.equals(l.getLocaleData(TEST_LOCALE))) {
    fail("String_Node_Str");
  }
}

Fixed version (ground truth):
public void testAddExistingLocale(){
  Localizer l=new Localizer();
  final String TEST_LOCALE="String_Node_Str";
  l.addAvailableLocale(TEST_LOCALE);
  TableLocaleSource table=new TableLocaleSource();
  table.setLocaleMapping("String_Node_Str","String_Node_Str");
  l.registerLocaleResource(TEST_LOCALE,table);
  OrderedHashtable localeData=l.getLocaleData(TEST_LOCALE);
  boolean result=l.addAvailableLocale(TEST_LOCALE);
  if (result) {
    fail("String_Node_Str");
  }
  Hashtable newLocaleData=l.getLocaleData(TEST_LOCALE);
  if (!localeData.equals(newLocaleData)) {
    fail("String_Node_Str");
  }
}
Program: 144818
Project: 144818
Buggy source:
public Vector getSingleStringAttributeVector(){
  Vector strings=new Vector();
  if (attributes == null || attributes.size() == 0)   return null;
 else {
    for (int i=0; i < this.attributes.size(); i++) {
      TreeElement attribute=attributes.elementAt(i);
      String value=getAttributeValue(attribute);
      if (attribute.namespace == null || attribute.namespace == "String_Node_Str")       strings.addElement(new String(attribute.getName() + "String_Node_Str" + value));
 else       strings.addElement(new String(attribute.namespace + "String_Node_Str" + attribute.getName()+ "String_Node_Str"+ value));
    }
    return strings;
  }
}

Fixed version (ground truth):
public Vector getSingleStringAttributeVector(){
  Vector strings=new Vector();
  if (attributes == null || attributes.size() == 0)   return null;
 else {
    for (int i=0; i < this.attributes.size(); i++) {
      TreeElement attribute=attributes.elementAt(i);
      String value=getAttributeValue(attribute);
      if (attribute.namespace == null || attribute.namespace.equals("String_Node_Str"))       strings.addElement(new String(attribute.getName() + "String_Node_Str" + value));
 else       strings.addElement(new String(attribute.namespace + "String_Node_Str" + attribute.getName()+ "String_Node_Str"+ value));
    }
    return strings;
  }
}
Program: 144819
Project: 144819
Buggy source:
public K intern(K k){
synchronized (this) {
    int hash=k.hashCode();
    K nk=retrieve(hash);
    if (nk == null) {
      register(hash,k);
      return k;
    }
    if (k.equals(nk)) {
      return nk;
    }
    return k;
  }
}

Fixed version (ground truth):
public K intern(K k){
synchronized (this) {
    int hash=k.hashCode();
    K nk=retrieve(hash);
    if (nk == null) {
      register(hash,k);
      return k;
    }
    if (k.equals(nk)) {
      return nk;
    }
 else {
      System.out.println("String_Node_Str" + nk.toString() + "String_Node_Str"+ k);
    }
    return k;
  }
}
Program: 144821
Project: 144821
Buggy source:
public void register(int key,K item){
synchronized (this) {
    currentTable.put(DataUtil.integer(key),new WeakReference(item));
  }
}

Fixed version (ground truth):
public void register(int key,K item){
synchronized (this) {
    currentTable.put(DataUtil.integer(key),new WeakReference(item));
    totalAdditions++;
  }
}
Program: 144822
Project: 144822
Buggy source:
public int hashCode(){
  int code=this.axis | this.test | (this.name == null ? 0 : this.name.hashCode())| (this.literal == null ? 0 : this.literal.hashCode())| (this.namespace == null ? 0 : this.namespace.hashCode());
  for (  XPathExpression xpe : predicates) {
    code|=xpe.hashCode();
  }
  return code;
}

Fixed version (ground truth):
public int hashCode(){
  int code=this.axis ^ this.test ^ (this.name == null ? 0 : this.name.hashCode())^ (this.literal == null ? 0 : this.literal.hashCode())^ (this.namespace == null ? 0 : this.namespace.hashCode());
  for (  XPathExpression xpe : predicates) {
    code^=xpe.hashCode();
  }
  return code;
}
Program: 144823
Project: 144823
Buggy source:
private void buildIndex(){
synchronized (metadataAccessLock) {
    MemoryUtils.stopTerning();
    try {
      metaDataIndex=new Hashtable();
      if (!hasMetaData) {
        return;
      }
      String[] fields=getFields();
      for (int k=0; k < fields.length; k++) {
        metaDataIndex.put(fields[k],new Hashtable());
      }
      IStorageIterator i=iterate();
      int records=this.getNumRecords();
      Hashtable[] metadata=new Hashtable[records];
      int[] recordIds=new int[records];
      for (int j=0; j < records; ++j) {
        metadata[j]=new Hashtable(fields.length);
        for (        String field : fields) {
          metadata[j].put(field,"String_Node_Str");
        }
      }
      int count=0;
      IMetaData obj;
      while (i.hasMore()) {
        recordIds[count]=i.nextID();
        count++;
      }
      for (int index=0; index < recordIds.length; ++index) {
        obj=(IMetaData)read(recordIds[index]);
        copyHT(metadata[index],getMetaData(obj,fields),fields);
        obj=null;
        System.gc();
      }
      for (int index=0; index < recordIds.length; ++index) {
        indexMetaData(recordIds[index],metadata[index]);
      }
    }
  finally {
      MemoryUtils.revertTerning();
    }
  }
}

Fixed version (ground truth):
private void buildIndex(){
synchronized (metadataAccessLock) {
    try {
      metaDataIndex=new Hashtable();
      if (!hasMetaData) {
        return;
      }
      String[] fields=getFields();
      for (int k=0; k < fields.length; k++) {
        metaDataIndex.put(fields[k],new Hashtable());
      }
      IStorageIterator i=iterate();
      int records=this.getNumRecords();
      Hashtable[] metadata=new Hashtable[records];
      int[] recordIds=new int[records];
      for (int j=0; j < records; ++j) {
        metadata[j]=new Hashtable(fields.length);
        for (        String field : fields) {
          metadata[j].put(field,"String_Node_Str");
        }
      }
      int count=0;
      IMetaData obj;
      while (i.hasMore()) {
        recordIds[count]=i.nextID();
        count++;
      }
      for (int index=0; index < recordIds.length; ++index) {
        obj=(IMetaData)read(recordIds[index]);
        copyHT(metadata[index],getMetaData(obj,fields),fields);
        obj=null;
        System.gc();
      }
      for (int index=0; index < recordIds.length; ++index) {
        indexMetaData(recordIds[index],metadata[index]);
      }
    }
  finally {
    }
  }
}
Program: 144824
Project: 144824
Buggy source:
public static void startStateWithLoadingScreen(State state,ProgressIndicator indicator){
  final State s=state;
  loading.cancelLoading();
  loading=new LoadingScreenThread(display);
  loading.startLoading(indicator);
  if (display != null) {
    CrashHandler.expire(display.getCurrent());
  }
  new HandledThread(new Runnable(){
    public void run(){
      s.start();
    }
  }
).start();
}

Fixed version (ground truth):
public static void startStateWithLoadingScreen(State state,ProgressIndicator indicator){
  final State s=state;
  loading.cancelLoading();
  loading=new LoadingScreenThread(display);
  loading.startLoading(indicator);
  if (display != null) {
    CrashHandler.expire(display.getCurrent());
  }
  new HandledThread(new Runnable(){
    public void run(){
      String className=s.getClass().getName();
      MemoryUtils.printMemoryTest(className.substring(Math.max(0,className.lastIndexOf('.'))));
      s.start();
    }
  }
).start();
}
Program: 144825
Project: 144825
Buggy source:
public void run(){
  s.start();
}

Fixed version (ground truth):
public void run(){
  String className=s.getClass().getName();
  MemoryUtils.printMemoryTest(className.substring(Math.max(0,className.lastIndexOf('.'))));
  s.start();
}
Program: 144826
Project: 144826
Buggy source:
public static void main(String argv[]){
  XFormValidatorGUI.instance=new XFormValidatorGUI();
}

Fixed version (ground truth):
public static void main(String argv[]){
  XFormValidatorGUI.instance=new XFormValidatorGUI();
  XFormUtils.setXFormParserFactory(new XFormParserFactory(interns));
}
Program: 144827
Project: 144827
Buggy source:
public TreeReference genericize(){
  TreeReference genericRef=clone();
  for (int i=0; i < genericRef.size(); i++) {
    genericRef.setMultiplicity(i,INDEX_UNBOUND);
  }
  return genericRef;
}

Fixed version (ground truth):
public TreeReference genericize(){
  TreeReference genericRef=clone();
  for (int i=0; i < genericRef.size(); i++) {
    if (genericRef.getMultiplicity(i) > -1 || genericRef.getMultiplicity(i) == INDEX_TEMPLATE) {
      genericRef.setMultiplicity(i,INDEX_UNBOUND);
    }
  }
  return genericRef;
}
Program: 144828
Project: 144828
Buggy source:
public void doTest(int i){
switch (i) {
case 1:
    testClones();
  break;
case 2:
testSerialization();
break;
case 3:
testParentage();
break;
case 4:
testIntersection();
break;
case 5:
contextualization();
break;
case 6:
testPredicates();
break;
}
}

Fixed version (ground truth):
public void doTest(int i){
switch (i) {
case 1:
    testClones();
  break;
case 2:
testSerialization();
break;
case 3:
testParentage();
break;
case 4:
testIntersection();
break;
case 5:
contextualization();
break;
case 6:
testPredicates();
break;
case 7:
testGenericize();
break;
}
}
Program: 144834
Project: 144834
Buggy source:
private static Recalculate buildCalculate(String xpath,IDataReference contextRef){
  XPathConditional calc;
  try {
    calc=new XPathConditional(xpath);
  }
 catch (  XPathSyntaxException xse) {
    System.err.println("String_Node_Str" + xpath + "String_Node_Str");
    return null;
  }
  Recalculate r=new Recalculate(calc,FormInstance.unpackReference(contextRef));
  return r;
}

Fixed version (ground truth):
private static Recalculate buildCalculate(String xpath,IDataReference contextRef) throws XPathSyntaxException {
  XPathConditional calc=new XPathConditional(xpath);
  Recalculate r=new Recalculate(calc,FormInstance.unpackReference(contextRef));
  return r;
}
Program: 144837
Project: 144837
Buggy source:
/** 
 * This just calls the resource's installer directly, but also handles the logic around attempting retries if applicable
 * @throws UnfullfilledRequirementsException 
 */
private boolean installResource(Resource r,ResourceLocation location,Reference ref,ResourceTable table,CommCareInstance instance,boolean upgrade) throws UnresolvedResourceException, UnfullfilledRequirementsException {
  UnreliableSourceException aFailure=null;
  for (int i=0; i < 1 + this.numberOfLossyRetries; ++i) {
    try {
      return r.getInstaller().install(r,location,ref,table,instance,upgrade);
    }
 catch (    UnreliableSourceException use) {
      System.out.println("String_Node_Str");
      aFailure=use;
      Logger.log("String_Node_Str","String_Node_Str" + (i + 1) + "String_Node_Str"+ (numberOfLossyRetries + 1)+ "String_Node_Str"+ ref.getURI()+ "String_Node_Str"+ use.getMessage());
      if (use.shouldBreak()) {
        break;
      }
    }
  }
  if (aFailure != null) {
    throw aFailure;
  }
  return false;
}

Fixed version (ground truth):
/** 
 * This just calls the resource's installer directly, but also handles the logic around attempting retries if applicable
 * @throws UnfullfilledRequirementsException 
 */
private boolean installResource(Resource r,ResourceLocation location,Reference ref,ResourceTable table,CommCareInstance instance,boolean upgrade) throws UnresolvedResourceException, UnfullfilledRequirementsException {
  UnreliableSourceException aFailure=null;
  for (int i=0; i < 1 + this.numberOfLossyRetries; ++i) {
    try {
      return r.getInstaller().install(r,location,ref,table,instance,upgrade);
    }
 catch (    UnreliableSourceException use) {
      aFailure=use;
      Logger.log("String_Node_Str","String_Node_Str" + (i + 1) + "String_Node_Str"+ (numberOfLossyRetries + 1)+ "String_Node_Str"+ ref.getURI()+ "String_Node_Str"+ use.getMessage());
    }
  }
  if (aFailure != null) {
    throw aFailure;
  }
  return false;
}
Program: 144838
Project: 144838
Buggy source:
public UnreliableSourceException(Resource r,String message,boolean shouldBreak){
  super(r,message);
  this.shouldBreak=shouldBreak;
}

Fixed version (ground truth):
public UnreliableSourceException(Resource r,String message){
  super(r,message);
}
Program: 144839
Project: 144839
Buggy source:
public boolean install(Resource r,ResourceLocation location,Reference ref,ResourceTable table,CommCareInstance instance,boolean upgrade) throws UnresolvedResourceException {
  InputStream incoming=null;
  try {
    if (location.getAuthority() == Resource.RESOURCE_AUTHORITY_CACHE) {
      return false;
    }
 else {
      incoming=ref.getStream();
      if (incoming == null) {
        return false;
      }
      FormDef formDef=new XFormParser(new InputStreamReader(incoming,"String_Node_Str")).parse();
      if (formDef == null) {
        return false;
      }
      if (upgrade) {
        formDef.getInstance().schema=formDef.getInstance().schema + "String_Node_Str";
        storage().write(formDef);
        cacheLocation=formDef.getID();
        table.commit(r,Resource.RESOURCE_STATUS_UPGRADE);
      }
 else {
        storage().write(formDef);
        cacheLocation=formDef.getID();
        table.commit(r,Resource.RESOURCE_STATUS_INSTALLED);
      }
      return true;
    }
  }
 catch (  StorageFullException e) {
    e.printStackTrace();
    return false;
  }
catch (  IOException e) {
    throw new UnreliableSourceException(r,e.getMessage());
  }
catch (  XFormParseException xpe) {
    System.out.println("String_Node_Str");
    throw new UnreliableSourceException(r,xpe.getMessage(),true);
  }
 finally {
    try {
      if (incoming != null) {
        incoming.close();
      }
    }
 catch (    IOException e) {
    }
  }
}

Fixed version (ground truth):
public boolean install(Resource r,ResourceLocation location,Reference ref,ResourceTable table,CommCareInstance instance,boolean upgrade) throws UnresolvedResourceException {
  InputStream incoming=null;
  try {
    if (location.getAuthority() == Resource.RESOURCE_AUTHORITY_CACHE) {
      return false;
    }
 else {
      incoming=ref.getStream();
      if (incoming == null) {
        return false;
      }
      FormDef formDef=new XFormParser(new InputStreamReader(incoming,"String_Node_Str")).parse();
      if (formDef == null) {
        return false;
      }
      if (upgrade) {
        formDef.getInstance().schema=formDef.getInstance().schema + "String_Node_Str";
        storage().write(formDef);
        cacheLocation=formDef.getID();
        table.commit(r,Resource.RESOURCE_STATUS_UPGRADE);
      }
 else {
        storage().write(formDef);
        cacheLocation=formDef.getID();
        table.commit(r,Resource.RESOURCE_STATUS_INSTALLED);
      }
      return true;
    }
  }
 catch (  StorageFullException e) {
    e.printStackTrace();
    return false;
  }
catch (  IOException e) {
    throw new UnreliableSourceException(r,e.getMessage());
  }
catch (  XFormParseException xpe) {
    throw new UnresolvedResourceException(r,"String_Node_Str" + ref.getURI() + "String_Node_Str"+ xpe.getMessage(),true);
  }
 finally {
    try {
      if (incoming != null) {
        incoming.close();
      }
    }
 catch (    IOException e) {
    }
  }
}
Program: 144841
Project: 144841
Buggy source:
/** 
 */
private static void init(){
  if (globalLocalizer == null) {
    globalLocalizer=new Localizer(true,true);
  }
}

Fixed version (ground truth):
/** 
 */
private static void init(){
  if (globalLocalizer == null) {
    globalLocalizer=new Localizer(true,false);
  }
}
Program: 144842
Project: 144842
Buggy source:
/** 
 * Retrieve the localized text for a text handle in the given locale. If no mapping is found initially, then, depending on enabled fallback modes, other places will be searched until a mapping is found. <p> The search order is thus: 1) Specified locale, specified text form 2) Specified locale, default text form 3) Default locale, specified text form 4) Default locale, default text form <p> (1) and (3) are only searched if a text form ('long', 'short', etc.) is specified. If a text form is specified, (2) and (4) are only searched if default-form-fallback mode is enabled. (3) and (4) are only searched if default-locale-fallback mode is enabled. It is not an error in this situation if no default locale is set; (3) and (4) will simply not be searched.
 * @param textID Text handle (text ID appended with optional text form). Must not be null.
 * @param locale Locale. Must be defined and not null.
 * @return Localized text. If no text is found after using all fallbacks, return null.
 * @throws UnregisteredLocaleException If the locale is not defined or null.
 * @throws NullPointerException if textID is null
 */
public String getText(String textID,String locale){
  String text=getRawText(locale,textID);
  if (text == null && fallbackDefaultForm && textID.indexOf("String_Node_Str") != -1)   text=getRawText(locale,textID.substring(0,textID.indexOf("String_Node_Str")));
  return text;
}

Fixed version (ground truth):
/** 
 * Retrieve the localized text for a text handle in the given locale. If no mapping is found initially, then, depending on enabled fallback modes, other places will be searched until a mapping is found. <p> The search order is thus: 1) Specified locale, specified text form 2) Specified locale, default text form 3) Default locale, specified text form 4) Default locale, default text form <p> (1) and (3) are only searched if a text form ('long', 'short', etc.) is specified. If a text form is specified, (2) and (4) are only searched if default-form-fallback mode is enabled. (3) and (4) are only searched if default-locale-fallback mode is enabled. It is not an error in this situation if no default locale is set; (3) and (4) will simply not be searched.
 * @param textID Text handle (text ID appended with optional text form). Must not be null.
 * @param locale Locale. Must be defined and not null.
 * @return Localized text. If no text is found after using all fallbacks, return null.
 * @throws UnregisteredLocaleException If the locale is not defined or null.
 * @throws NullPointerException if textID is null
 */
public String getText(String textID,String locale){
  String text=getRawText(locale,textID);
  if (text == null && fallbackDefaultForm && textID.indexOf("String_Node_Str") != -1)   text=getRawText(locale,textID.substring(0,textID.indexOf("String_Node_Str")));
  if (text == null && fallbackDefaultLocale && !locale.equals(defaultLocale) && defaultLocale != null && fallbackDefaultForm)   text=getText(textID,defaultLocale);
  return text;
}
Program: 144843
Project: 144843
Buggy source:
private Localizer buildLocalizer(int i,int j,int k,String ourLocale,String otherLocale){
  Localizer l=new Localizer(i / 2 == 0,i % 2 == 0);
  TableLocaleSource firstLocale=new TableLocaleSource();
  TableLocaleSource secondLocale=new TableLocaleSource();
  l.addAvailableLocale(ourLocale);
  l.registerLocaleResource(ourLocale,firstLocale);
  l.setLocale(ourLocale);
  if (otherLocale != null) {
    l.addAvailableLocale(otherLocale);
    l.registerLocaleResource(otherLocale,secondLocale);
  }
  if (l.hasLocale("String_Node_Str")) {
    l.setDefaultLocale("String_Node_Str");
  }
  if (j / 2 == 0)   firstLocale.setLocaleMapping("String_Node_Str","String_Node_Str" + ourLocale + "String_Node_Str");
  if (j % 2 == 0)   firstLocale.setLocaleMapping("String_Node_Str","String_Node_Str" + ourLocale + "String_Node_Str");
  if (otherLocale != null) {
    if (k / 2 == 0)     secondLocale.setLocaleMapping("String_Node_Str","String_Node_Str" + otherLocale + "String_Node_Str");
    if (k % 2 == 0)     secondLocale.setLocaleMapping("String_Node_Str","String_Node_Str" + otherLocale + "String_Node_Str");
  }
  return l;
}

Fixed version (ground truth):
private Localizer buildLocalizer(int i,int j,int k,String ourLocale,String otherLocale){
  Localizer l=new Localizer(i / 2 == 0,i % 2 == 0);
  TableLocaleSource firstLocale=new TableLocaleSource();
  TableLocaleSource secondLocale=new TableLocaleSource();
  if (j / 2 == 0 || "String_Node_Str".equals(ourLocale))   firstLocale.setLocaleMapping("String_Node_Str","String_Node_Str" + ourLocale + "String_Node_Str");
  if (j % 2 == 0 || "String_Node_Str".equals(ourLocale))   firstLocale.setLocaleMapping("String_Node_Str","String_Node_Str" + ourLocale + "String_Node_Str");
  if (otherLocale != null) {
    if (k / 2 == 0 || "String_Node_Str".equals(otherLocale))     secondLocale.setLocaleMapping("String_Node_Str","String_Node_Str" + otherLocale + "String_Node_Str");
    if (k % 2 == 0 || "String_Node_Str".equals(otherLocale))     secondLocale.setLocaleMapping("String_Node_Str","String_Node_Str" + otherLocale + "String_Node_Str");
  }
  l.addAvailableLocale(ourLocale);
  l.registerLocaleResource(ourLocale,firstLocale);
  if (otherLocale != null) {
    l.addAvailableLocale(otherLocale);
    l.registerLocaleResource(otherLocale,secondLocale);
  }
  if (l.hasLocale("String_Node_Str")) {
    l.setDefaultLocale("String_Node_Str");
  }
  l.setLocale(ourLocale);
  return l;
}
Program: 144844
Project: 144844
Buggy source:
public Vector<TreeReference> evalNodeset(DataInstance model,EvaluationContext evalContext){
  if (expr instanceof XPathPathExpr) {
    return ((XPathPathExpr)expr).eval(model,evalContext).nodes;
  }
 else {
    throw new FatalException("String_Node_Str");
  }
}

Fixed version (ground truth):
public Vector<TreeReference> evalNodeset(DataInstance model,EvaluationContext evalContext){
  if (expr instanceof XPathPathExpr) {
    return ((XPathPathExpr)expr).eval(model,evalContext).getReferences();
  }
 else {
    throw new FatalException("String_Node_Str");
  }
}
Program: 144845
Project: 144845
Buggy source:
private void performEvaluation(){
synchronized (evaluated) {
    if (evaluated.booleanValue()) {
      return;
    }
    nodes=ec.expandReference(unExpandedRef);
    for (int i=0; i < nodes.size(); i++) {
      if (!instance.resolveReference((TreeReference)nodes.elementAt(i)).isRelevant()) {
        nodes.removeElementAt(i);
        i--;
      }
    }
    evaluated=true;
  }
}

Fixed version (ground truth):
private void performEvaluation(){
synchronized (evaluated) {
    if (evaluated.booleanValue()) {
      return;
    }
    Vector<TreeReference> nodes=ec.expandReference(unExpandedRef);
    for (int i=0; i < nodes.size(); i++) {
      if (!instance.resolveReference((TreeReference)nodes.elementAt(i)).isRelevant()) {
        nodes.removeElementAt(i);
        i--;
      }
    }
    this.setReferences(nodes);
    evaluated=true;
  }
}
Program: 144846
Project: 144846
Buggy source:
/** 
 * @return The value represented by this xpath. Can only be evaluated when this xpath represents exactly onereference, or when it represents 0 references after a filtering operation (a reference which _could_ have existed, but didn't, rather than a reference which could not represent a real node).
 */
public Object unpack(){
synchronized (evaluated) {
    if (evaluated.booleanValue()) {
      return super.unpack();
    }
    int size=unExpandedRef.size();
    boolean safe=true;
    ;
    for (int i=0; i < size; ++i) {
      if (unExpandedRef.getPredicate(i) != null) {
        safe=false;
        break;
      }
      int mult=unExpandedRef.getMultiplicity(i);
      if (!(mult >= 0 || mult == TreeReference.INDEX_UNBOUND)) {
        safe=false;
        break;
      }
    }
    if (!safe) {
      performEvaluation();
      return super.unpack();
    }
    return XPathPathExpr.getRefValue(instance,ec,unExpandedRef);
  }
}

Fixed version (ground truth):
/** 
 * @return The value represented by this xpath. Can only be evaluated when this xpath represents exactly onereference, or when it represents 0 references after a filtering operation (a reference which _could_ have existed, but didn't, rather than a reference which could not represent a real node).
 */
public Object unpack(){
synchronized (evaluated) {
    if (evaluated.booleanValue()) {
      return super.unpack();
    }
    int size=unExpandedRef.size();
    boolean safe=true;
    ;
    for (int i=0; i < size; ++i) {
      if (unExpandedRef.getPredicate(i) != null) {
        safe=false;
        break;
      }
      int mult=unExpandedRef.getMultiplicity(i);
      if (!(mult >= 0 || mult == TreeReference.INDEX_UNBOUND)) {
        safe=false;
        break;
      }
    }
    if (!safe) {
      performEvaluation();
      return super.unpack();
    }
    try {
      return XPathPathExpr.getRefValue(instance,ec,unExpandedRef);
    }
 catch (    XPathException xpe) {
      performEvaluation();
      return super.unpack();
    }
  }
}
Program: 144848
Project: 144848
Buggy source:
public Boolean parse() throws InvalidStructureException, IOException, XmlPullParserException, UnfullfilledRequirementsException {
  try {
    String rootName=parser.getName();
    String itemString=parser.getAttributeValue(null,"String_Node_Str");
    int itemNumber=-1;
    if (itemString != null) {
      try {
        itemNumber=Integer.parseInt(itemString);
      }
 catch (      NumberFormatException e) {
        itemNumber=0;
      }
      rListener.setTotalForms(itemNumber);
    }
    parseBlock(rootName);
  }
  finally {
    try {
      is.close();
    }
 catch (    IOException ioe) {
    }
  }
  if (errors.size() == 0) {
    return Boolean.TRUE;
  }
 else {
    return Boolean.FALSE;
  }
}

Fixed version (ground truth):
public Boolean parse() throws InvalidStructureException, IOException, XmlPullParserException, UnfullfilledRequirementsException {
  try {
    String rootName=parser.getName();
    if (requiredRootEnvelope != null && !requiredRootEnvelope.equals(rootName)) {
      throw new InvalidStructureException("String_Node_Str" + rootName + "String_Node_Str"+ requiredRootEnvelope+ "String_Node_Str",parser);
    }
    String itemString=parser.getAttributeValue(null,"String_Node_Str");
    int itemNumber=-1;
    if (itemString != null) {
      try {
        itemNumber=Integer.parseInt(itemString);
      }
 catch (      NumberFormatException e) {
        itemNumber=0;
      }
      rListener.setTotalForms(itemNumber);
    }
    parseBlock(rootName);
  }
  finally {
    try {
      is.close();
    }
 catch (    IOException ioe) {
    }
  }
  if (errors.size() == 0) {
    return Boolean.TRUE;
  }
 else {
    return Boolean.FALSE;
  }
}
Program: 144849
Project: 144849
Buggy source:
/** 
 * Get all of the elements which will need to be evaluated (in order) when the triggerable is fired.
 * @param t
 */
public void fillTriggeredElements(Triggerable t,Vector<Triggerable> destination){
  if (t.canCascade()) {
    for (int j=0; j < t.getTargets().size(); j++) {
      TreeReference target=(TreeReference)t.getTargets().elementAt(j);
      Vector<TreeReference> updatedNodes=new Vector<TreeReference>();
      updatedNodes.addElement(target);
      if (t.isCascadingToChildren()) {
        addChildrenOfReference(target,updatedNodes);
      }
      for (      TreeReference ref : updatedNodes) {
        Vector<Triggerable> triggered=(Vector<Triggerable>)triggerIndex.get(ref);
        if (triggered != null) {
          for (int k=0; k < triggered.size(); k++) {
            Triggerable u=(Triggerable)triggered.elementAt(k);
            if (!destination.contains(u))             destination.addElement(u);
          }
        }
      }
    }
  }
}

Fixed version (ground truth):
/** 
 * Get all of the elements which will need to be evaluated (in order) when the triggerable is fired.
 * @param t
 */
public void fillTriggeredElements(Triggerable t,Vector<Triggerable> destination){
  if (t.canCascade()) {
    for (int j=0; j < t.getTargets().size(); j++) {
      TreeReference target=(TreeReference)t.getTargets().elementAt(j);
      Vector<TreeReference> updatedNodes=new Vector<TreeReference>();
      updatedNodes.addElement(target);
      if (t.isCascadingToChildren()) {
        addChildrenOfReference(target,updatedNodes);
      }
      for (      TreeReference ref : updatedNodes) {
        Vector<Triggerable> triggered=(Vector<Triggerable>)triggerIndex.get(ref.hasPredicates() ? ref.removePredicates() : ref);
        if (triggered != null) {
          for (int k=0; k < triggered.size(); k++) {
            Triggerable u=(Triggerable)triggered.elementAt(k);
            if (!destination.contains(u))             destination.addElement(u);
          }
        }
      }
    }
  }
}
Program: 144850
Project: 144850
Buggy source:
public int hashCode(){
  int hash=(new Integer(refLevel)).hashCode();
  for (int i=0; i < size(); i++) {
    Integer mult=DataUtil.integer(getMultiplicity(i));
    if (i == 0 && mult.intValue() == INDEX_UNBOUND)     mult=DataUtil.integer(0);
    hash^=getName(i).hashCode();
    hash^=mult.hashCode();
  }
  return hash;
}

Fixed version (ground truth):
public int hashCode(){
  int hash=(new Integer(refLevel)).hashCode();
  for (int i=0; i < size(); i++) {
    Integer mult=DataUtil.integer(getMultiplicity(i));
    if (i == 0 && mult.intValue() == INDEX_UNBOUND)     mult=DataUtil.integer(0);
    hash^=getName(i).hashCode();
    hash^=mult.hashCode();
    Vector<XPathExpression> predicates=this.getPredicate(i);
    if (predicates == null) {
      continue;
    }
    int val=0;
    for (    XPathExpression xpe : predicates) {
      hash^=val;
      hash^=xpe.hashCode();
      ++val;
    }
  }
  return hash;
}
Program: 144851
Project: 144851
Buggy source:
private static void getTriggers(XPathExpression x,Vector<TreeReference> v,TreeReference contextRef){
  if (x instanceof XPathPathExpr) {
    TreeReference ref=((XPathPathExpr)x).getReference();
    TreeReference contextualized=ref;
    if (contextRef != null) {
      contextualized=ref.contextualize(contextRef);
    }
    if (!v.contains(contextualized)) {
      v.addElement(contextualized);
    }
    for (int i=0; i < ref.size(); i++) {
      Vector<XPathExpression> predicates=ref.getPredicate(i);
      if (predicates == null) {
        continue;
      }
      if (!ref.isAbsolute()) {
        throw new IllegalArgumentException("String_Node_Str");
      }
      TreeReference predicateContext=ref.getSubReference(i);
      for (      XPathExpression predicate : predicates) {
        getTriggers(predicate,v,predicateContext);
      }
    }
  }
 else   if (x instanceof XPathBinaryOpExpr) {
    getTriggers(((XPathBinaryOpExpr)x).a,v,contextRef);
    getTriggers(((XPathBinaryOpExpr)x).b,v,contextRef);
  }
 else   if (x instanceof XPathUnaryOpExpr) {
    getTriggers(((XPathUnaryOpExpr)x).a,v,contextRef);
  }
 else   if (x instanceof XPathFuncExpr) {
    XPathFuncExpr fx=(XPathFuncExpr)x;
    for (int i=0; i < fx.args.length; i++)     getTriggers(fx.args[i],v,contextRef);
  }
}

Fixed version (ground truth):
private static void getTriggers(XPathExpression x,Vector<TreeReference> v,TreeReference contextRef){
  if (x instanceof XPathPathExpr) {
    TreeReference ref=((XPathPathExpr)x).getReference();
    TreeReference contextualized=ref;
    if (contextRef != null) {
      contextualized=ref.contextualize(contextRef);
    }
    if (contextualized.hasPredicates()) {
      contextualized=contextualized.removePredicates();
    }
    if (!v.contains(contextualized)) {
      v.addElement(contextualized);
    }
    for (int i=0; i < ref.size(); i++) {
      Vector<XPathExpression> predicates=ref.getPredicate(i);
      if (predicates == null) {
        continue;
      }
      if (!ref.isAbsolute()) {
        throw new IllegalArgumentException("String_Node_Str");
      }
      TreeReference predicateContext=ref.getSubReference(i);
      for (      XPathExpression predicate : predicates) {
        getTriggers(predicate,v,predicateContext);
      }
    }
  }
 else   if (x instanceof XPathBinaryOpExpr) {
    getTriggers(((XPathBinaryOpExpr)x).a,v,contextRef);
    getTriggers(((XPathBinaryOpExpr)x).b,v,contextRef);
  }
 else   if (x instanceof XPathUnaryOpExpr) {
    getTriggers(((XPathUnaryOpExpr)x).a,v,contextRef);
  }
 else   if (x instanceof XPathFuncExpr) {
    XPathFuncExpr fx=(XPathFuncExpr)x;
    for (int i=0; i < fx.args.length; i++)     getTriggers(fx.args[i],v,contextRef);
  }
}
Program: 144852
Project: 144852
Buggy source:
private boolean command(String command) throws BadPlaybackException {
  environment.recordAction(new Action(new Command(command)));
  if ("String_Node_Str".equalsIgnoreCase(command)) {
    fec.stepToNextEvent();
    return false;
  }
 else   if ("String_Node_Str".equalsIgnoreCase(command)) {
    forward=false;
    fec.stepToPreviousEvent();
    return false;
  }
 else   if ("String_Node_Str".equalsIgnoreCase(command)) {
    out.println("String_Node_Str");
    return true;
  }
 else   if ("String_Node_Str".equalsIgnoreCase(command) && fec.getModel().getEvent() == FormEntryController.EVENT_END_OF_FORM) {
    out.println("String_Node_Str");
    return true;
  }
 else {
    badInput(command,"String_Node_Str" + command);
    return false;
  }
}

Fixed version (ground truth):
private boolean command(String command) throws BadPlaybackException {
  environment.recordAction(new Action(new Command(command)));
  if ("String_Node_Str".equalsIgnoreCase(command)) {
    fec.stepToNextEvent();
    return false;
  }
 else   if ("String_Node_Str".equalsIgnoreCase(command)) {
    forward=false;
    fec.stepToPreviousEvent();
    return false;
  }
 else   if ("String_Node_Str".equalsIgnoreCase(command)) {
    out.println("String_Node_Str");
    return true;
  }
 else   if ("String_Node_Str".equalsIgnoreCase(command) && fec.getModel().getEvent() == FormEntryController.EVENT_END_OF_FORM) {
    out.println("String_Node_Str");
    return true;
  }
 else   if ("String_Node_Str".equalsIgnoreCase(command)) {
    printInstance(out,fec.getModel().getForm().getInstance());
    return false;
  }
 else {
    badInput(command,"String_Node_Str" + command);
    return false;
  }
}
Program: 144853
Project: 144853
Buggy source:
public void _commandAction(Command c,Displayable d){
  if (c == LoginForm.CMD_CANCEL_LOGIN) {
    transitions.exit();
  }
 else   if (c == LoginForm.CMD_LOGIN_BUTTON) {
    if (this.view.validateUser()) {
      transitions.loggedIn(view.getLoggedInUser(),view.getPassWord());
      return;
    }
    performCustomUserValidation();
  }
 else   if (c == LoginForm.CMD_TOOLS) {
    transitions.tools();
  }
 else   if (c == LoginForm.CMD_DEMO_BUTTON) {
    try {
      Reference demoWarning=ReferenceManager._().DeriveReference(Localization.get("String_Node_Str"));
      if (demoWarning.doesBinaryExist()) {
        MediaUtils.playAudio(demoWarning.getURI());
      }
    }
 catch (    Exception e) {
    }
    demoModeAlert=J2MEDisplay.showError(null,Localization.get("String_Node_Str"),null,null,this);
  }
 else   if (d == demoModeAlert) {
    User u=User.FactoryDemoUser();
    transitions.loggedIn(u,null);
  }
}

Fixed version (ground truth):
public void _commandAction(Command c,Displayable d){
  if (c == LoginForm.CMD_CANCEL_LOGIN) {
    transitions.exit();
  }
 else   if (c == LoginForm.CMD_LOGIN_BUTTON) {
    if (this.view.validateUser()) {
      transitions.loggedIn(view.getLoggedInUser(),view.getPassWord());
      return;
    }
    performCustomUserValidation();
  }
 else   if (c == LoginForm.CMD_TOOLS) {
    transitions.tools();
  }
 else   if (c == LoginForm.CMD_DEMO_BUTTON) {
    try {
      MediaUtils.playAudio(Localization.get("String_Node_Str"));
    }
 catch (    NoLocalizedTextException e) {
    }
    demoModeAlert=J2MEDisplay.showError(null,Localization.get("String_Node_Str"),null,null,this);
  }
 else   if (d == demoModeAlert) {
    User u=User.FactoryDemoUser();
    transitions.loggedIn(u,null);
  }
}
Program: 144854
Project: 144854
Buggy source:
public boolean equals(Object o){
  if (this == o) {
    return true;
  }
 else   if (o instanceof TreeReference) {
    TreeReference ref=(TreeReference)o;
    if (this.refLevel == ref.refLevel && this.size() == ref.size()) {
      for (int i=0; i < this.size(); i++) {
        String nameA=this.getName(i);
        String nameB=ref.getName(i);
        int multA=this.getMultiplicity(i);
        int multB=ref.getMultiplicity(i);
        if (!nameA.equals(nameB)) {
          return false;
        }
 else         if (multA != multB) {
          if (i == 0 && (multA == 0 || multA == INDEX_UNBOUND) && (multB == 0 || multB == INDEX_UNBOUND)) {
          }
 else {
            return false;
          }
        }
      }
      return true;
    }
 else {
      return false;
    }
  }
 else {
    return false;
  }
}

Fixed version (ground truth):
public boolean equals(Object o){
  if (this == o) {
    return true;
  }
 else   if (o instanceof TreeReference) {
    TreeReference ref=(TreeReference)o;
    if (this.refLevel == ref.refLevel && this.size() == ref.size()) {
      for (int i=0; i < this.size(); i++) {
        String nameA=this.getName(i);
        String nameB=ref.getName(i);
        int multA=this.getMultiplicity(i);
        int multB=ref.getMultiplicity(i);
        Vector<XPathExpression> predA=this.getPredicate(i);
        Vector<XPathExpression> predB=ref.getPredicate(i);
        if (!nameA.equals(nameB)) {
          return false;
        }
 else         if (multA != multB) {
          if (i == 0 && (multA == 0 || multA == INDEX_UNBOUND) && (multB == 0 || multB == INDEX_UNBOUND)) {
          }
 else {
            return false;
          }
        }
 else         if (predA != null && predB != null) {
          if (predA.size() != predB.size()) {
            return false;
          }
          for (int j=0; j < predA.size(); ++j) {
            if (!predA.elementAt(j).equals(predB.elementAt(j))) {
              return false;
            }
          }
        }
 else         if ((predA == null && predB != null) || (predA != null && predB == null)) {
          return false;
        }
      }
      return true;
    }
 else {
      return false;
    }
  }
 else {
    return false;
  }
}
Program: 144855
Project: 144855
Buggy source:
public void doTest(int i){
switch (i) {
case 1:
    testClones();
  break;
case 2:
testSerialization();
break;
case 3:
testParentage();
break;
case 4:
testIntersection();
break;
case 5:
contextualization();
break;
}
}

Fixed version (ground truth):
public void doTest(int i){
switch (i) {
case 1:
    testClones();
  break;
case 2:
testSerialization();
break;
case 3:
testParentage();
break;
case 4:
testIntersection();
break;
case 5:
contextualization();
break;
case 6:
testPredicates();
break;
}
}
Program: 144856
Project: 144856
Buggy source:
public void initStuff(){
  root=TreeReference.rootRef();
  a=root.extendRef("String_Node_Str",TreeReference.DEFAULT_MUTLIPLICITY);
  b=root.extendRef("String_Node_Str",TreeReference.DEFAULT_MUTLIPLICITY);
  ac=a.extendRef("String_Node_Str",TreeReference.DEFAULT_MUTLIPLICITY);
  bc=b.extendRef("String_Node_Str",TreeReference.DEFAULT_MUTLIPLICITY);
  acd=ac.extendRef("String_Node_Str",TreeReference.DEFAULT_MUTLIPLICITY);
  ace=ac.extendRef("String_Node_Str",TreeReference.DEFAULT_MUTLIPLICITY);
  dot=TreeReference.selfRef();
  dotc=dot.extendRef("String_Node_Str",TreeReference.DEFAULT_MUTLIPLICITY);
  a2=root.extendRef("String_Node_Str",2);
  a2ext=root.extendRef("String_Node_Str",-1);
  a2ext.setInstanceName("String_Node_Str");
}

Fixed version (ground truth):
public void initStuff(){
  root=TreeReference.rootRef();
  a=root.extendRef("String_Node_Str",TreeReference.DEFAULT_MUTLIPLICITY);
  b=root.extendRef("String_Node_Str",TreeReference.DEFAULT_MUTLIPLICITY);
  ac=a.extendRef("String_Node_Str",TreeReference.DEFAULT_MUTLIPLICITY);
  bc=b.extendRef("String_Node_Str",TreeReference.DEFAULT_MUTLIPLICITY);
  acd=ac.extendRef("String_Node_Str",TreeReference.DEFAULT_MUTLIPLICITY);
  ace=ac.extendRef("String_Node_Str",TreeReference.DEFAULT_MUTLIPLICITY);
  dot=TreeReference.selfRef();
  dotc=dot.extendRef("String_Node_Str",TreeReference.DEFAULT_MUTLIPLICITY);
  a2=root.extendRef("String_Node_Str",2);
  a2ext=root.extendRef("String_Node_Str",-1);
  a2ext.setInstanceName("String_Node_Str");
  apred=a.clone();
  apredmatch=a.clone();
  aprednot=a.clone();
  try {
    Vector<XPathExpression> apreds=new Vector<XPathExpression>();
    apreds.add(XPathParseTool.parseXPath("String_Node_Str"));
    apred.addPredicate(0,apreds);
    Vector<XPathExpression> amatchpreds=new Vector<XPathExpression>();
    amatchpreds.add(XPathParseTool.parseXPath("String_Node_Str"));
    apredmatch.addPredicate(0,amatchpreds);
    Vector<XPathExpression> anotpreds=new Vector<XPathExpression>();
    anotpreds.add(XPathParseTool.parseXPath("String_Node_Str"));
    aprednot.addPredicate(0,anotpreds);
  }
 catch (  XPathSyntaxException e) {
    fail("String_Node_Str");
  }
}