nus-yam/ex-repair huggingface dataset:
Program: 144656
Project: 144656
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: 144657
Project: 144657
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: 144658
Project: 144658
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: 144659
Project: 144659
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: 144660
Project: 144660
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: 144661
Project: 144661
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: 144662
Project: 144662
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: 144663
Project: 144663
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: 144665
Project: 144665
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: 144666
Project: 144666
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: 144667
Project: 144667
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: 144668
Project: 144668
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: 144669
Project: 144669
Buggy source:
public void readExternal(DataInputStream in,PrototypeFactory pf) throws IOException, DeserializationException {
  init();
  setValue(ExtUtil.readDate(in));
}

Fixed version (ground truth):
public void readExternal(DataInputStream in,PrototypeFactory pf) throws IOException, DeserializationException {
  setValue(ExtUtil.readDate(in));
  init();
}
Program: 144670
Project: 144670
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: 144671
Project: 144671
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: 144672
Project: 144672
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");
}
Program: 144673
Project: 144673
Buggy source:
protected abstract String getHelpTextDescription();

Fixed version (ground truth):
public String getHelpTextDescription(){
  return helpTextDescription;
}
Program: 144674
Project: 144674
Buggy source:
public CliCommand(String commandName,String[] args){
  this.commandName=commandName;
  this.args=args;
  options=getOptions();
}

Fixed version (ground truth):
public CliCommand(String commandName,String helpTextDescription,String positionalArgsHelpText){
  options=getOptions();
  this.commandName=commandName;
  this.helpTextDescription=helpTextDescription;
  this.positionalArgsHelpText=positionalArgsHelpText;
}
Program: 144675
Project: 144675
Buggy source:
public void parseArguments() throws ParseException {
  CommandLineParser parser=new DefaultParser();
  cmd=parser.parse(options,args);
}

Fixed version (ground truth):
public void parseArguments(String[] args) throws ParseException {
  CommandLineParser parser=new DefaultParser();
  cmd=parser.parse(options,args);
  this.args=cmd.getArgs();
}
Program: 144676
Project: 144676
Buggy source:
protected void printHelpText(){
  String usage="String_Node_Str" + commandName + "String_Node_Str"+ getPositionalArgsHelpText();
  String header=getHelpTextDescription() + "String_Node_Str";
  HelpFormatter formatter=new HelpFormatter();
  formatter.setWidth(200);
  formatter.printHelp(usage,header,options,"String_Node_Str",true);
}

Fixed version (ground truth):
protected void printHelpText(){
  String usage="String_Node_Str" + commandName + "String_Node_Str"+ positionalArgsHelpText;
  String header=helpTextDescription + "String_Node_Str";
  HelpFormatter formatter=new HelpFormatter();
  formatter.setWidth(200);
  formatter.printHelp(usage,header,options,"String_Node_Str",true);
}
Program: 144677
Project: 144677
Buggy source:
public CliPlayCommand(String commandName,String[] args){
  super(commandName,args);
}

Fixed version (ground truth):
public CliPlayCommand(){
  super("String_Node_Str","String_Node_Str","String_Node_Str");
}
Program: 144678
Project: 144678
Buggy source:
@Override public void handle(){
  super.handle();
  PrototypeFactory prototypeFactory=new LivePrototypeFactory();
  if (args.length < 2) {
    printHelpText();
    System.exit(-1);
  }
  try {
    CommCareConfigEngine engine=configureApp(args[1],prototypeFactory);
    ApplicationHost host=new ApplicationHost(engine,prototypeFactory);
    if (cmd.hasOption("String_Node_Str")) {
      host.setRestoreToLocalFile(cmd.getOptionValue("String_Node_Str"));
    }
 else {
      if (args.length < 4) {
        printHelpText();
        System.exit(-1);
        return;
      }
      String username=args[2];
      String password=args[3];
      username=username.trim().toLowerCase();
      host.setRestoreToRemoteUser(username,password);
    }
    host.run();
    System.exit(-1);
  }
 catch (  RuntimeException re) {
    System.out.print("String_Node_Str");
    re.printStackTrace();
    throw re;
  }
 finally {
    System.exit(0);
  }
}

Fixed version (ground truth):
@Override public void handle(){
  super.handle();
  PrototypeFactory prototypeFactory=new LivePrototypeFactory();
  try {
    CommCareConfigEngine engine=configureApp(args[0],prototypeFactory);
    ApplicationHost host=new ApplicationHost(engine,prototypeFactory);
    if (cmd.hasOption("String_Node_Str")) {
      host.setRestoreToLocalFile(cmd.getOptionValue("String_Node_Str"));
    }
 else {
      username=username.trim().toLowerCase();
      host.setRestoreToRemoteUser(username,password);
    }
    host.run();
    System.exit(-1);
  }
 catch (  RuntimeException re) {
    System.out.print("String_Node_Str");
    re.printStackTrace();
    throw re;
  }
 finally {
    System.exit(0);
  }
}
Program: 144679
Project: 144679
Buggy source:
public CliValidateCommand(String commandName,String[] args){
  super(commandName,args);
}

Fixed version (ground truth):
public CliValidateCommand(){
  super("String_Node_Str","String_Node_Str","String_Node_Str");
}
Program: 144680
Project: 144680
Buggy source:
@Override public void handle(){
  super.handle();
  PrototypeFactory prototypeFactory=new LivePrototypeFactory();
  if (args.length < 2) {
    printHelpText();
    System.exit(-1);
  }
  CommCareConfigEngine engine=configureApp(args[1],prototypeFactory);
  engine.describeApplication();
  System.exit(0);
}

Fixed version (ground truth):
@Override public void handle(){
  super.handle();
  PrototypeFactory prototypeFactory=new LivePrototypeFactory();
  CommCareConfigEngine engine=configureApp(resourcePath,prototypeFactory);
  engine.describeApplication();
  System.exit(0);
}
Program: 144681
Project: 144681
Buggy source:
private void parseControlChildren(Element e,QuestionDef question,IFormElement parent,boolean isSelect){
  for (int i=0; i < e.getChildCount(); i++) {
    int type=e.getType(i);
    Element child=(type == Node.ELEMENT ? e.getElement(i) : null);
    String childName=(child != null ? child.getName() : null);
    if (LABEL_ELEMENT.equals(childName) || HINT_ELEMENT.equals(childName) || HELP_ELEMENT.equals(childName)|| CONSTRAINT_ELEMENT.equals(childName)) {
      parseHelperText(question,child);
    }
 else     if (isSelect && "String_Node_Str".equals(childName)) {
      parseItem(question,child);
    }
 else     if (isSelect && "String_Node_Str".equals(childName)) {
      parseItemset(question,child,parent);
    }
 else     if (actionHandlers.contains(childName)) {
      actionHandlers.get(childName).handle(this,child,question);
    }
  }
}

Fixed version (ground truth):
private void parseControlChildren(Element e,QuestionDef question,IFormElement parent,boolean isSelect){
  for (int i=0; i < e.getChildCount(); i++) {
    int type=e.getType(i);
    Element child=(type == Node.ELEMENT ? e.getElement(i) : null);
    String childName=(child != null ? child.getName() : null);
    if (LABEL_ELEMENT.equals(childName) || HINT_ELEMENT.equals(childName) || HELP_ELEMENT.equals(childName)|| CONSTRAINT_ELEMENT.equals(childName)) {
      parseHelperText(question,child);
    }
 else     if (isSelect && "String_Node_Str".equals(childName)) {
      parseItem(question,child);
    }
 else     if (isSelect && "String_Node_Str".equals(childName)) {
      parseItemset(question,child,parent);
    }
 else     if (actionHandlers.containsKey(childName)) {
      actionHandlers.get(childName).handle(this,child,question);
    }
  }
}
Program: 144682
Project: 144682
Buggy source:
/** 
 * Test triggers fired from inserting a new repeat entry. Triggers fired during insert action don't need to be fired again when all triggers rooted by that repeat entry are fired.
 */
@Test public void testRepeatInsertTriggering() throws Exception {
  FormParseInit fpi=new FormParseInit("String_Node_Str");
  FormEntryController fec=fpi.getFormEntryController();
  fpi.getFormDef().initialize(true,null);
  fec.jumpToIndex(FormIndex.createBeginningOfFormIndex());
  do {
  }
 while (fec.stepToNextEvent() != FormEntryController.EVENT_END_OF_FORM);
  EvaluationContext evalCtx=fpi.getFormDef().getEvaluationContext();
  ExprEvalUtils.assertEqualsXpathEval("String_Node_Str","String_Node_Str","String_Node_Str",evalCtx);
  ExprEvalUtils.assertEqualsXpathEval("String_Node_Str","String_Node_Str","String_Node_Str",evalCtx);
  ExprEvalUtils.assertEqualsXpathEval("String_Node_Str","String_Node_Str","String_Node_Str",evalCtx);
}

Fixed version (ground truth):
/** 
 * Test triggers fired from inserting a new repeat entry. Triggers fired during insert action don't need to be fired again when all triggers rooted by that repeat entry are fired.
 */
@Test public void testRepeatInsertTriggering() throws Exception {
  FormParseInit fpi=new FormParseInit("String_Node_Str");
  FormEntryController fec=initFormEntry(fpi);
  stepThroughEntireForm(fec);
  EvaluationContext evalCtx=fpi.getFormDef().getEvaluationContext();
  ExprEvalUtils.assertEqualsXpathEval("String_Node_Str","String_Node_Str","String_Node_Str",evalCtx);
  ExprEvalUtils.assertEqualsXpathEval("String_Node_Str","String_Node_Str","String_Node_Str",evalCtx);
  ExprEvalUtils.assertEqualsXpathEval("String_Node_Str","String_Node_Str","String_Node_Str",evalCtx);
}
Program: 144683
Project: 144683
Buggy source:
/** 
 * Test nested form repeat triggers and actions
 */
@Test public void testNestedRepeatActions() throws Exception {
  FormParseInit fpi=new FormParseInit("String_Node_Str");
  FormEntryController fec=fpi.getFormEntryController();
  fpi.getFormDef().initialize(true,null);
  fec.jumpToIndex(FormIndex.createBeginningOfFormIndex());
  do {
  }
 while (fec.stepToNextEvent() != FormEntryController.EVENT_END_OF_FORM);
  ExprEvalUtils.assertEqualsXpathEval("String_Node_Str",30.0,"String_Node_Str",fpi.getFormDef().getEvaluationContext());
}

Fixed version (ground truth):
/** 
 * Test nested form repeat triggers and actions
 */
@Test public void testNestedRepeatActions() throws Exception {
  FormParseInit fpi=new FormParseInit("String_Node_Str");
  FormEntryController fec=initFormEntry(fpi);
  stepThroughEntireForm(fec);
  ExprEvalUtils.assertEqualsXpathEval("String_Node_Str",30.0,"String_Node_Str",fpi.getFormDef().getEvaluationContext());
}
Program: 144684
Project: 144684
Buggy source:
/** 
 * Tests trigger caching related to cascading relevancy calculations to children.
 */
@Test public void testTriggerCaching() throws Exception {
  FormParseInit fpi=new FormParseInit("String_Node_Str");
  FormEntryController fec=fpi.getFormEntryController();
  fpi.getFormDef().initialize(true,null);
  fec.jumpToIndex(FormIndex.createBeginningOfFormIndex());
  do {
  }
 while (fec.stepToNextEvent() != FormEntryController.EVENT_END_OF_FORM);
  EvaluationContext evalCtx=fpi.getFormDef().getEvaluationContext();
  ExprEvalUtils.assertEqualsXpathEval("String_Node_Str",400.0,"String_Node_Str",evalCtx);
  ExprEvalUtils.assertEqualsXpathEval("String_Node_Str",100.0,"String_Node_Str",evalCtx);
  ExprEvalUtils.assertEqualsXpathEval("String_Node_Str","String_Node_Str","String_Node_Str",evalCtx);
  Object weighTimeResult=ExprEvalUtils.xpathEval(evalCtx,"String_Node_Str");
  if ("String_Node_Str".equals(weighTimeResult) || "String_Node_Str".equals(weighTimeResult)) {
    fail("String_Node_Str");
  }
  ExprEvalUtils.assertEqualsXpathEval("String_Node_Str",1.0,"String_Node_Str",evalCtx);
  ExprEvalUtils.assertEqualsXpathEval("String_Node_Str","String_Node_Str","String_Node_Str",evalCtx);
  ExprEvalUtils.assertEqualsXpathEval("String_Node_Str","String_Node_Str","String_Node_Str",evalCtx);
  ExprEvalUtils.assertEqualsXpathEval("String_Node_Str","String_Node_Str","String_Node_Str",evalCtx);
}

Fixed version (ground truth):
/** 
 * Tests trigger caching related to cascading relevancy calculations to children.
 */
@Test public void testTriggerCaching() throws Exception {
  FormParseInit fpi=new FormParseInit("String_Node_Str");
  FormEntryController fec=initFormEntry(fpi);
  stepThroughEntireForm(fec);
  EvaluationContext evalCtx=fpi.getFormDef().getEvaluationContext();
  ExprEvalUtils.assertEqualsXpathEval("String_Node_Str",400.0,"String_Node_Str",evalCtx);
  ExprEvalUtils.assertEqualsXpathEval("String_Node_Str",100.0,"String_Node_Str",evalCtx);
  ExprEvalUtils.assertEqualsXpathEval("String_Node_Str","String_Node_Str","String_Node_Str",evalCtx);
  Object weighTimeResult=ExprEvalUtils.xpathEval(evalCtx,"String_Node_Str");
  if ("String_Node_Str".equals(weighTimeResult) || "String_Node_Str".equals(weighTimeResult)) {
    fail("String_Node_Str");
  }
  ExprEvalUtils.assertEqualsXpathEval("String_Node_Str",1.0,"String_Node_Str",evalCtx);
  ExprEvalUtils.assertEqualsXpathEval("String_Node_Str","String_Node_Str","String_Node_Str",evalCtx);
  ExprEvalUtils.assertEqualsXpathEval("String_Node_Str","String_Node_Str","String_Node_Str",evalCtx);
  ExprEvalUtils.assertEqualsXpathEval("String_Node_Str","String_Node_Str","String_Node_Str",evalCtx);
}
Program: 144685
Project: 144685
Buggy source:
/** 
 * Make sure that 'current()' expands correctly when used in conditionals such as in 'relevant' tags. The test answers a question and expects the correct elements to be re-evaluated and set to not relevant.
 */
@Test public void testCurrentFuncInTriggers(){
  FormParseInit fpi=new FormParseInit("String_Node_Str");
  FormEntryController fec=fpi.getFormEntryController();
  fec.jumpToIndex(FormIndex.createBeginningOfFormIndex());
  do {
    QuestionDef q=fpi.getCurrentQuestion();
    if (q == null) {
      continue;
    }
    TreeReference qRef=(TreeReference)(q.getBind()).getReference();
    if (qRef.toString().equals("String_Node_Str")) {
      int response=fec.answerQuestion(new StringData("String_Node_Str"));
      if (response != FormEntryController.ANSWER_OK) {
        fail("String_Node_Str");
      }
    }
 else     if (q.getID() == 2) {
      fail("String_Node_Str");
    }
  }
 while (fec.stepToNextEvent() != FormEntryController.EVENT_END_OF_FORM);
}

Fixed version (ground truth):
/** 
 * Make sure that 'current()' expands correctly when used in conditionals such as in 'relevant' tags. The test answers a question and expects the correct elements to be re-evaluated and set to not relevant.
 */
@Test public void testCurrentFuncInTriggers(){
  FormParseInit fpi=new FormParseInit("String_Node_Str");
  FormEntryController fec=initFormEntry(fpi);
  do {
    QuestionDef q=fpi.getCurrentQuestion();
    if (q == null) {
      continue;
    }
    TreeReference qRef=(TreeReference)(q.getBind()).getReference();
    if (qRef.toString().equals("String_Node_Str")) {
      int response=fec.answerQuestion(new StringData("String_Node_Str"));
      if (response != FormEntryController.ANSWER_OK) {
        fail("String_Node_Str");
      }
    }
 else     if (q.getID() == 2) {
      fail("String_Node_Str");
    }
  }
 while (fec.stepToNextEvent() != FormEntryController.EVENT_END_OF_FORM);
}
Program: 144687
Project: 144687
Buggy source:
/** 
 * Regressions around complex repeat behaviors
 */
@Test public void testLoopedRepeatIndexFetches() throws Exception {
  FormParseInit fpi=new FormParseInit("String_Node_Str");
  FormEntryController fec=fpi.getFormEntryController();
  fpi.getFormDef().initialize(true,null);
  fec.jumpToIndex(FormIndex.createBeginningOfFormIndex());
  fec.stepToNextEvent();
  fec.stepToNextEvent();
  fec.answerQuestion(new IntegerData(2));
  while (fec.stepToNextEvent() != FormEntryController.EVENT_QUESTION)   ;
  fec.answerQuestion(new UncastData("String_Node_Str"));
  while (fec.stepToNextEvent() != FormEntryController.EVENT_QUESTION)   ;
  fec.getNextIndex(fec.getModel().getFormIndex(),true);
  fec.answerQuestion(new IntegerData(2));
  fec.getNextIndex(fec.getModel().getFormIndex(),true);
}

Fixed version (ground truth):
/** 
 * Regressions around complex repeat behaviors
 */
@Test public void testLoopedRepeatIndexFetches() throws Exception {
  FormParseInit fpi=new FormParseInit("String_Node_Str");
  FormEntryController fec=initFormEntry(fpi);
  fec.stepToNextEvent();
  fec.stepToNextEvent();
  fec.answerQuestion(new IntegerData(2));
  while (fec.stepToNextEvent() != FormEntryController.EVENT_QUESTION)   ;
  fec.answerQuestion(new UncastData("String_Node_Str"));
  while (fec.stepToNextEvent() != FormEntryController.EVENT_QUESTION)   ;
  fec.getNextIndex(fec.getModel().getFormIndex(),true);
  fec.answerQuestion(new IntegerData(2));
  fec.getNextIndex(fec.getModel().getFormIndex(),true);
}
Program: 144688
Project: 144688
Buggy source:
@Test public void testAnswerConstraint(){
  IntegerData ans=new IntegerData(13);
  FormParseInit fpi=new FormParseInit("String_Node_Str");
  FormEntryController fec=fpi.getFormEntryController();
  fec.jumpToIndex(FormIndex.createBeginningOfFormIndex());
  do {
    QuestionDef q=fpi.getCurrentQuestion();
    if (q == null || q.getTextID() == null || "String_Node_Str".equals(q.getTextID())) {
      continue;
    }
    if (q.getTextID().equals("String_Node_Str")) {
      int response=fec.answerQuestion(ans);
      if (response == FormEntryController.ANSWER_CONSTRAINT_VIOLATED) {
        fail("String_Node_Str");
      }
 else       if (response == FormEntryController.ANSWER_OK) {
        break;
      }
 else {
        fail("String_Node_Str");
      }
    }
  }
 while (fec.stepToNextEvent() != FormEntryController.EVENT_END_OF_FORM);
}

Fixed version (ground truth):
@Test public void testAnswerConstraint(){
  FormParseInit fpi=new FormParseInit("String_Node_Str");
  FormEntryController fec=initFormEntry(fpi);
  do {
    QuestionDef q=fpi.getCurrentQuestion();
    if (q == null || q.getTextID() == null || "String_Node_Str".equals(q.getTextID())) {
      continue;
    }
    if (q.getTextID().equals("String_Node_Str")) {
      int response=fec.answerQuestion(new IntegerData(13));
      if (response == FormEntryController.ANSWER_CONSTRAINT_VIOLATED) {
        fail("String_Node_Str");
      }
 else       if (response == FormEntryController.ANSWER_OK) {
        break;
      }
 else {
        fail("String_Node_Str");
      }
    }
  }
 while (fec.stepToNextEvent() != FormEntryController.EVENT_END_OF_FORM);
}
Program: 144689
Project: 144689
Buggy source:
/** 
 * Test setvalue expressions which have predicate references
 */
@Test public void testSetValuePredicate(){
  FormParseInit fpi=new FormParseInit("String_Node_Str");
  FormEntryController fec=fpi.getFormEntryController();
  fpi.getFormDef().initialize(true,null);
  fec.jumpToIndex(FormIndex.createBeginningOfFormIndex());
  boolean testPassed=false;
  do {
    if (fec.getModel().getEvent() != FormEntryController.EVENT_QUESTION) {
      continue;
    }
    String text=fec.getModel().getQuestionPrompt().getQuestionText();
    if (text.contains("String_Node_Str") && text.contains("String_Node_Str")) {
      testPassed=true;
    }
  }
 while (fec.stepToNextEvent() != FormEntryController.EVENT_END_OF_FORM);
  if (!testPassed) {
    fail("String_Node_Str");
  }
}

Fixed version (ground truth):
/** 
 * Test setvalue expressions which have predicate references
 */
@Test public void testSetValuePredicate(){
  FormParseInit fpi=new FormParseInit("String_Node_Str");
  FormEntryController fec=initFormEntry(fpi);
  boolean testPassed=false;
  do {
    if (fec.getModel().getEvent() != FormEntryController.EVENT_QUESTION) {
      continue;
    }
    String text=fec.getModel().getQuestionPrompt().getQuestionText();
    if (text.contains("String_Node_Str") && text.contains("String_Node_Str")) {
      testPassed=true;
    }
  }
 while (fec.stepToNextEvent() != FormEntryController.EVENT_END_OF_FORM);
  if (!testPassed) {
    fail("String_Node_Str");
  }
}
Program: 144690
Project: 144690
Buggy source:
/** 
 * Remove from the graph the node at this index, and remove all nodes that are made invalid by the non-existence of that node (i.e. all of its child and extension cases). Also accumulate a list of edges that need to be removed as a result of this method call. Actual edge removal should then be done all at once by the caller, to avoid ConcurrentModificationException
 */
private void removeNodeAndPropagate(String indexOfRemovedNode,Vector<String[]> accumulatedEdgesToRemove){
  Vector<Edge<String,String>> childCases=internalCaseDAG.getParents(indexOfRemovedNode);
  for (  Edge<String,String> child : childCases) {
    accumulatedEdgesToRemove.addElement(new String[]{child.i,indexOfRemovedNode});
    removeNodeAndPropagate(child.i,accumulatedEdgesToRemove);
  }
  Vector<Edge<String,String>> parentCases=internalCaseDAG.getChildren(indexOfRemovedNode);
  for (  Edge<String,String> parent : parentCases) {
    accumulatedEdgesToRemove.addElement(new String[]{indexOfRemovedNode,parent.i});
  }
  int storageIdOfRemovedNode=internalCaseDAG.removeNode(indexOfRemovedNode)[1];
  idsToRemove.addElement(new Integer(storageIdOfRemovedNode));
  casesRemovedDueToMissingCases.add(indexOfRemovedNode);
}

Fixed version (ground truth):
/** 
 * Remove from the graph the node at this index, and remove all nodes that are made invalid by the non-existence of that node (i.e. all of its child and extension cases). Also accumulate a list of edges that need to be removed as a result of this method call. Actual edge removal should then be done all at once by the caller, to avoid ConcurrentModificationException
 */
private void removeNodeAndPropagate(String indexOfRemovedNode,Vector<String[]> accumulatedEdgesToRemove){
  Vector<Edge<String,String>> childCases=internalCaseDAG.getParents(indexOfRemovedNode);
  for (  Edge<String,String> child : childCases) {
    accumulatedEdgesToRemove.addElement(new String[]{child.i,indexOfRemovedNode});
    removeNodeAndPropagate(child.i,accumulatedEdgesToRemove);
  }
  Vector<Edge<String,String>> parentCases=internalCaseDAG.getChildren(indexOfRemovedNode);
  for (  Edge<String,String> parent : parentCases) {
    accumulatedEdgesToRemove.addElement(new String[]{indexOfRemovedNode,parent.i});
  }
  int storageIdOfRemovedNode=internalCaseDAG.removeNode(indexOfRemovedNode)[1];
  idsToRemove.addElement(new Integer(storageIdOfRemovedNode));
  casesRemovedDueToMissingCases.addElement(indexOfRemovedNode);
}
Program: 144691
Project: 144691
Buggy source:
/** 
 * Traverse the graph to accumulate a list of any edges to empty nodes (which are created when a child makes a placeholder index to a parent, but then the parent does not actually exist on the phone for some reason). Then remove any nodes that are made invalid by that parent node not existing, which further accumulates the list of invalid edges
 * @return Whether or not this method invocation removed any invalid edges from the DAG
 */
private Vector<String[]> getInvalidEdges(){
  Hashtable<String,Vector<Edge<String,String>>> allEdges=internalCaseDAG.getEdges();
  Vector<String> childOfNonexistentParent=new Vector<String>();
  Vector<String[]> edgesToRemove=new Vector<String[]>();
  Enumeration edgeOriginIndices=allEdges.keys();
  while (edgeOriginIndices.hasMoreElements()) {
    String originIndex=(String)edgeOriginIndices.nextElement();
    Vector<Edge<String,String>> edgeListForOrigin=allEdges.get(originIndex);
    for (    Edge<String,String> edge : edgeListForOrigin) {
      String targetIndex=edge.i;
      if (internalCaseDAG.getNode(targetIndex) == null) {
        missingCases.add(targetIndex);
        edgesToRemove.addElement(new String[]{originIndex,targetIndex});
        childOfNonexistentParent.addElement(originIndex);
      }
    }
  }
  for (  String index : childOfNonexistentParent) {
    removeNodeAndPropagate(index,edgesToRemove);
  }
  invalidEdgesWereRemoved=edgesToRemove.size() > 0;
  return edgesToRemove;
}

Fixed version (ground truth):
/** 
 * Traverse the graph to accumulate a list of any edges to empty nodes (which are created when a child makes a placeholder index to a parent, but then the parent does not actually exist on the phone for some reason). Then remove any nodes that are made invalid by that parent node not existing, which further accumulates the list of invalid edges
 * @return Whether or not this method invocation removed any invalid edges from the DAG
 */
private Vector<String[]> getInvalidEdges(){
  Hashtable<String,Vector<Edge<String,String>>> allEdges=internalCaseDAG.getEdges();
  Vector<String> childOfNonexistentParent=new Vector<String>();
  Vector<String[]> edgesToRemove=new Vector<String[]>();
  Enumeration edgeOriginIndices=allEdges.keys();
  while (edgeOriginIndices.hasMoreElements()) {
    String originIndex=(String)edgeOriginIndices.nextElement();
    Vector<Edge<String,String>> edgeListForOrigin=allEdges.get(originIndex);
    for (    Edge<String,String> edge : edgeListForOrigin) {
      String targetIndex=edge.i;
      if (internalCaseDAG.getNode(targetIndex) == null) {
        missingCases.addElement(targetIndex);
        edgesToRemove.addElement(new String[]{originIndex,targetIndex});
        childOfNonexistentParent.addElement(originIndex);
      }
    }
  }
  for (  String index : childOfNonexistentParent) {
    removeNodeAndPropagate(index,edgesToRemove);
  }
  invalidEdgesWereRemoved=edgesToRemove.size() > 0;
  return edgesToRemove;
}
Program: 144692
Project: 144692
Buggy source:
public void registerModule(){
  String[] classes={"String_Node_Str","String_Node_Str"};
  PrototypeManager.registerPrototypes(classes);
  PrototypeManager.registerPrototypes(XPathParseTool.xpathClasses);
  RestoreUtils.xfFact=new IXFormyFactory(){
    public TreeReference ref(    String refStr){
      return FormInstance.unpackReference(new XPathReference(refStr));
    }
    public IDataPayload serializeInstance(    FormInstance dm){
      try {
        return (new XFormSerializingVisitor()).createSerializedPayload(dm);
      }
 catch (      IOException e) {
        return null;
      }
    }
    public FormInstance parseRestore(    byte[] data,    Class restorableType){
      return XFormParser.restoreDataModel(data,restorableType);
    }
    public IConditionExpr refToPathExpr(    TreeReference ref){
      return new XPathConditional(XPathPathExpr.fromRef(ref));
    }
  }
;
}

Fixed version (ground truth):
public void registerModule(){
  String[] classes={"String_Node_Str","String_Node_Str"};
  PrototypeManager.registerPrototypes(classes);
  PrototypeManager.registerPrototypes(XPathParseTool.xpathClasses);
  RestoreUtils.xfFact=new IXFormyFactory(){
    public TreeReference ref(    String refStr){
      return FormInstance.unpackReference(new XPathReference(refStr));
    }
    public IDataPayload serializeInstance(    FormInstance dm){
      try {
        return (new XFormSerializingVisitor()).createSerializedPayload(dm);
      }
 catch (      IOException e) {
        return null;
      }
    }
    public IConditionExpr refToPathExpr(    TreeReference ref){
      return new XPathConditional(XPathPathExpr.fromRef(ref));
    }
  }
;
}
Program: 144693
Project: 144693
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();
  }
  String refId=ref.substring(ref.lastIndexOf('/') + 1,ref.length());
  try {
    FormInstance fixture=SandboxUtils.loadFixture(mSandbox,refId,userId);
    if (fixture == null) {
      throw new RuntimeException("String_Node_Str" + ref);
    }
    TreeElement root=fixture.getRoot();
    root.setParent(instance.getBase());
    return root;
  }
 catch (  IllegalStateException ise) {
    throw new RuntimeException("String_Node_Str" + ref);
  }
}

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();
  }
  String refId=ref.substring(ref.lastIndexOf('/') + 1,ref.length());
  try {
    FormInstance fixture=SandboxUtils.loadFixture(mSandbox,refId,userId);
    if (fixture == null) {
      throw new FixtureInitializationException("String_Node_Str" + ref);
    }
    TreeElement root=fixture.getRoot();
    root.setParent(instance.getBase());
    return root;
  }
 catch (  IllegalStateException ise) {
    throw new FixtureInitializationException("String_Node_Str" + ref);
  }
}
Program: 144696
Project: 144696
Buggy source:
public static FormInstance loadFixtureForUser(String refId,String userId){
  IStorageUtilityIndexed storage=(IStorageUtilityIndexed)StorageManager.getStorage("String_Node_Str");
  FormInstance fixture=null;
  Vector<Integer> relevantFixtures=storage.getIDsForValue(FormInstance.META_ID,refId);
  if (relevantFixtures.size() == 1) {
    fixture=(FormInstance)storage.read(relevantFixtures.elementAt(0).intValue());
  }
 else   if (relevantFixtures.size() > 1) {
    Vector<Integer> relevantUserFixtures=storage.getIDsForValue(FormInstance.META_XMLNS,userId);
    if (relevantUserFixtures.size() != 0) {
      Integer userFixture=ArrayUtilities.intersectSingle(relevantFixtures,relevantUserFixtures);
      if (userFixture != null) {
        fixture=(FormInstance)storage.read(userFixture.intValue());
      }
    }
    if (fixture == null) {
      Integer globalFixture=ArrayUtilities.intersectSingle(storage.getIDsForValue(FormInstance.META_XMLNS,"String_Node_Str"),relevantFixtures);
      if (globalFixture == null) {
        return null;
      }
      fixture=(FormInstance)storage.read(globalFixture.intValue());
    }
  }
 else {
    return null;
  }
  return fixture;
}

Fixed version (ground truth):
public static FormInstance loadFixtureForUser(String refId,String userId){
  IStorageUtilityIndexed storage=(IStorageUtilityIndexed)StorageManager.getStorage(FormInstance.STORAGE_KEY);
  FormInstance fixture=null;
  Vector<Integer> relevantFixtures=storage.getIDsForValue(FormInstance.META_ID,refId);
  if (relevantFixtures.size() == 1) {
    fixture=(FormInstance)storage.read(relevantFixtures.elementAt(0).intValue());
  }
 else   if (relevantFixtures.size() > 1) {
    Vector<Integer> relevantUserFixtures=storage.getIDsForValue(FormInstance.META_XMLNS,userId);
    if (relevantUserFixtures.size() != 0) {
      Integer userFixture=ArrayUtilities.intersectSingle(relevantFixtures,relevantUserFixtures);
      if (userFixture != null) {
        fixture=(FormInstance)storage.read(userFixture.intValue());
      }
    }
    if (fixture == null) {
      Integer globalFixture=ArrayUtilities.intersectSingle(storage.getIDsForValue(FormInstance.META_XMLNS,"String_Node_Str"),relevantFixtures);
      if (globalFixture == null) {
        return null;
      }
      fixture=(FormInstance)storage.read(globalFixture.intValue());
    }
  }
 else {
    return null;
  }
  return fixture;
}
Program: 144697
Project: 144697
Buggy source:
protected IStorageUtilityIndexed<FormInstance> getFixtureStorage(){
  return (IStorageUtilityIndexed<FormInstance>)StorageManager.getStorage("String_Node_Str");
}

Fixed version (ground truth):
protected IStorageUtilityIndexed<FormInstance> getFixtureStorage(){
  return (IStorageUtilityIndexed<FormInstance>)StorageManager.getStorage(FormInstance.STORAGE_KEY);
}
Program: 144698
Project: 144698
Buggy source:
public IStorageUtilityIndexed<FormInstance> storage(){
  if (fixtureStorage == null) {
    fixtureStorage=CommCareTransactionParserFactory.this.sandbox.getUserFixtureStorage();
  }
  return fixtureStorage;
}

Fixed version (ground truth):
public IStorageUtilityIndexed<FormInstance> storage(){
  if (fixtureStorage == null) {
    fixtureStorage=sandbox.getUserFixtureStorage();
  }
  return fixtureStorage;
}
Program: 144699
Project: 144699
Buggy source:
public void initFixtureParser(){
  fixtureParser=new TransactionParserFactory(){
    FixtureXmlParser created=null;
    public TransactionParser getParser(    KXmlParser parser){
      if (created == null) {
        created=new FixtureXmlParser(parser){
          private IStorageUtilityIndexed<FormInstance> fixtureStorage;
          public IStorageUtilityIndexed<FormInstance> storage(){
            if (fixtureStorage == null) {
              fixtureStorage=CommCareTransactionParserFactory.this.sandbox.getUserFixtureStorage();
            }
            return fixtureStorage;
          }
        }
;
      }
      return created;
    }
  }
;
}

Fixed version (ground truth):
public void initFixtureParser(){
  fixtureParser=new TransactionParserFactory(){
    FixtureXmlParser created=null;
    public TransactionParser getParser(    KXmlParser parser){
      if (created == null) {
        created=new FixtureXmlParser(parser){
          private IStorageUtilityIndexed<FormInstance> fixtureStorage;
          public IStorageUtilityIndexed<FormInstance> storage(){
            if (fixtureStorage == null) {
              fixtureStorage=sandbox.getUserFixtureStorage();
            }
            return fixtureStorage;
          }
        }
;
      }
      return created;
    }
  }
;
}