nus-yam/ex-repair huggingface dataset:
Program: 147017
Project: 147017
Buggy source:
private static void listQuestion(FormDef f,QuestionDef q,FormEntryController fec,int indent,StringBuffer sb){
  FormEntryModel femodel=fec.getModel();
  TreeElement instanceNode=getInstanceNode(f.getInstance(),q.getBind());
  String caption="String_Node_Str";
  FormEntryPrompt fep=femodel.getQuestionPrompt();
  caption=getAppropriateTextForm(fep,fep.getTextID());
  int type=instanceNode.dataType;
  if (q.getControlType() != Constants.CONTROL_TRIGGER) {
    println(sb,indent,"String_Node_Str" + caption + "String_Node_Str");
    println(sb,indent + 1,"String_Node_Str" + printType(type));
  }
 else {
    println(sb,indent,"String_Node_Str" + caption + "String_Node_Str");
  }
  if (q.getControlType() == Constants.CONTROL_SELECT_ONE || q.getControlType() == Constants.CONTROL_SELECT_MULTI) {
    printChoices(f,q,fec,indent + 1,sb);
  }
  printProperty("String_Node_Str",f,instanceNode,indent + 1,sb);
  printProperty("String_Node_Str",f,instanceNode,indent + 1,sb);
  printProperty("String_Node_Str",f,instanceNode,indent + 1,sb);
  String defaultValue=printDefault(instanceNode);
  if (defaultValue != null) {
    println(sb,indent + 1,"String_Node_Str" + defaultValue);
  }
  if (instanceNode.getConstraint() != null) {
    println(sb,indent + 1,"String_Node_Str" + printCondition(instanceNode.getConstraint().constraint));
  }
  println(sb);
}

Fixed version (ground truth):
private static void listQuestion(FormDef f,QuestionDef q,FormEntryController fec,int indent,StringBuffer sb){
  FormEntryModel femodel=fec.getModel();
  TreeElement instanceNode=getInstanceNode(f.getInstance(),q.getBind());
  String caption="String_Node_Str";
  FormEntryPrompt fep=femodel.getQuestionPrompt();
  caption=fep.getLongText();
  int type=instanceNode.dataType;
  if (q.getControlType() != Constants.CONTROL_TRIGGER) {
    println(sb,indent,"String_Node_Str" + caption + "String_Node_Str");
    println(sb,indent + 1,"String_Node_Str" + printType(type));
  }
 else {
    println(sb,indent,"String_Node_Str" + caption + "String_Node_Str");
  }
  if (q.getControlType() == Constants.CONTROL_SELECT_ONE || q.getControlType() == Constants.CONTROL_SELECT_MULTI) {
    printChoices(f,q,fec,indent + 1,sb);
  }
  printProperty("String_Node_Str",f,instanceNode,indent + 1,sb);
  printProperty("String_Node_Str",f,instanceNode,indent + 1,sb);
  printProperty("String_Node_Str",f,instanceNode,indent + 1,sb);
  String defaultValue=printDefault(instanceNode);
  if (defaultValue != null) {
    println(sb,indent + 1,"String_Node_Str" + defaultValue);
  }
  if (instanceNode.getConstraint() != null) {
    println(sb,indent + 1,"String_Node_Str" + printCondition(instanceNode.getConstraint().constraint));
  }
  println(sb);
}
Program: 147018
Project: 147018
Buggy source:
/** 
 * Get the Itext for a specific SelectChoice and specific itext form
 * @param s
 * @param form
 * @return
 */
public String getSelectChoiceText(SelectChoice sel,String form){
  return getText(sel.getTextID(),form);
}

Fixed version (ground truth):
/** 
 * Get the Itext for a specific SelectChoice and specific itext form, returns null if the form requested is not available for the select choice
 * @param s
 * @param form
 * @return
 */
public String getSelectChoiceText(SelectChoice sel,String form){
  if (getSelectTextForms(sel).contains(form)) {
    return getText(sel.getTextID(),form);
  }
 else {
    return null;
  }
}
Program: 147019
Project: 147019
Buggy source:
public XPathNodeset eval(FormInstance m,EvaluationContext evalContext){
  TreeReference genericRef=getReference();
  if (m.getTemplatePath(genericRef) == null) {
    throw new XPathTypeMismatchException("String_Node_Str" + genericRef.toString() + "String_Node_Str");
  }
  TreeReference ref=genericRef.contextualize(evalContext.getContextRef());
  Vector<TreeReference> nodesetRefs=m.expandReference(ref);
  for (int i=0; i < nodesetRefs.size(); i++) {
    if (!m.resolveReference((TreeReference)nodesetRefs.elementAt(i)).isRelevant()) {
      nodesetRefs.removeElementAt(i);
      i--;
    }
  }
  return new XPathNodeset(nodesetRefs,m,evalContext);
}

Fixed version (ground truth):
public XPathNodeset eval(FormInstance m,EvaluationContext evalContext){
  TreeReference genericRef=getReference();
  if (genericRef.isAbsolute() && m.getTemplatePath(genericRef) == null) {
    throw new XPathTypeMismatchException("String_Node_Str" + genericRef.toString() + "String_Node_Str");
  }
  TreeReference ref=genericRef.contextualize(evalContext.getContextRef());
  Vector<TreeReference> nodesetRefs=m.expandReference(ref);
  for (int i=0; i < nodesetRefs.size(); i++) {
    if (!m.resolveReference((TreeReference)nodesetRefs.elementAt(i)).isRelevant()) {
      nodesetRefs.removeElementAt(i);
      i--;
    }
  }
  return new XPathNodeset(nodesetRefs,m,evalContext);
}
Program: 147020
Project: 147020
Buggy source:
private static String getLabel(Element e,FormDef f){
  boolean outputFound=false;
  boolean otherStuffFound=false;
  Vector outputs=new Vector();
  for (int i=0; i < e.getChildCount(); i++) {
    if (e.getType(i) != Node.TEXT) {
      if (e.getType(i) == Node.ELEMENT && "String_Node_Str".equals(e.getElement(i).getName())) {
        outputFound=true;
        outputs.addElement(new Integer(i));
      }
 else {
        otherStuffFound=true;
      }
    }
  }
  if (outputFound && !otherStuffFound) {
    StringBuffer sb=new StringBuffer();
    for (int i=0; i < outputs.size() + 1; i++) {
      int ixStart=(i == 0 ? 0 : ((Integer)outputs.elementAt(i - 1)).intValue() + 1);
      if (ixStart < e.getChildCount()) {
        String piece=getXMLText(e,ixStart,false);
        if (piece != null) {
          sb.append(piece);
        }
      }
      if (i < outputs.size()) {
        int ix=((Integer)outputs.elementAt(i)).intValue();
        sb.append("String_Node_Str" + parseOutput(e.getElement(ix),f) + "String_Node_Str");
      }
    }
    return sb.toString().trim();
  }
 else {
    return getXMLText(e,true);
  }
}

Fixed version (ground truth):
private static String getLabel(Element e,FormDef f){
  if (e.getChildCount() == 0)   return null;
  recurseForOutput(e,f);
  StringBuffer sb=new StringBuffer();
  for (int i=0; i < e.getChildCount(); i++) {
    if (e.getType(i) != Node.TEXT && !(e.getChild(i) instanceof String)) {
      Object b=e.getChild(i);
      if (b instanceof String)       System.out.println("String_Node_Str");
      sb.append(XFormSerializer.elementToString((Element)b));
    }
 else {
      sb.append(e.getText(i));
    }
  }
  String s=sb.toString().trim();
  return s;
}
Program: 147021
Project: 147021
Buggy source:
/** 
 * get value of attribute with namespace:name' in the vector
 * @param index
 * @return String
 */
public String getAttributeValue(String namespace,String name){
  return getAttributeValue(getAttribute(namespace,name));
}

Fixed version (ground truth):
/** 
 * get value of attribute with namespace:name' in the vector
 * @param index
 * @return String
 */
public String getAttributeValue(String namespace,String name){
  TreeElement element=getAttribute(namespace,name);
  return element == null ? null : getAttributeValue(element);
}
Program: 147022
Project: 147022
Buggy source:
/** 
 * Sets the given attribute; a value of null removes the attribute
 */
public void setAttribute(String namespace,String name,String value){
  if (namespace == null)   namespace="String_Node_Str";
  for (int i=attributes.size() - 1; i >= 0; i--) {
    TreeElement attribut=attributes.elementAt(i);
    if (attribut.name.equals(name) && namespace == null || namespace.equals(attribut.namespace)) {
      if (value == null) {
        attributes.removeElementAt(i);
      }
 else {
        attribut.setValue(new UncastData(value));
      }
      return;
    }
  }
  TreeElement attr=TreeElement.constructAttributeElement(namespace,name);
  attr.setValue(new UncastData(value));
  attr.setParent(this);
  attributes.addElement(attr);
}

Fixed version (ground truth):
/** 
 * Sets the given attribute; a value of null removes the attribute
 */
public void setAttribute(String namespace,String name,String value){
  for (int i=attributes.size() - 1; i >= 0; i--) {
    TreeElement attribut=attributes.elementAt(i);
    if (attribut.name.equals(name) && (namespace == null || namespace.equals(attribut.namespace))) {
      if (value == null) {
        attributes.removeElementAt(i);
      }
 else {
        attribut.setValue(new UncastData(value));
      }
      return;
    }
  }
  if (namespace == null) {
    namespace="String_Node_Str";
  }
  TreeElement attr=TreeElement.constructAttributeElement(namespace,name);
  attr.setValue(new UncastData(value));
  attr.setParent(this);
  attributes.addElement(attr);
}
Program: 147023
Project: 147023
Buggy source:
/** 
 * Retrieves the TreeElement representing the attribute at the provided namespace and name, or null if none exists. If 'null' is provided for the namespace, it will match the first attribute with the matching name.
 * @param index
 * @return TreeElement
 */
public TreeElement getAttribute(String namespace,String name){
  for (  TreeElement attribute : attributes) {
    if (attribute.getName().equals(name) && namespace == null || namespace.equals(attribute)) {
      return attribute;
    }
  }
  return null;
}

Fixed version (ground truth):
/** 
 * Retrieves the TreeElement representing the attribute at the provided namespace and name, or null if none exists. If 'null' is provided for the namespace, it will match the first attribute with the matching name.
 * @param index
 * @return TreeElement
 */
public TreeElement getAttribute(String namespace,String name){
  for (  TreeElement attribute : attributes) {
    if (attribute.getName().equals(name) && (namespace == null || namespace.equals(attribute.namespace))) {
      return attribute;
    }
  }
  return null;
}
Program: 147024
Project: 147024
Buggy source:
/** 
 * true if the answer to this question yields xml tree data, not a simple string value
 */
public boolean isComplex(){
  return (dynamicChoices != null && dynamicChoices.copyMode);
}

Fixed version (ground truth):
/** 
 * true if the answer to this question yields xml tree data, not a simple string value
 */
public boolean isComplex(){
  System.out.println("String_Node_Str" + dynamicChoices);
  if (dynamicChoices != null)   System.out.println("String_Node_Str" + dynamicChoices.copyMode);
  return (dynamicChoices != null && dynamicChoices.copyMode);
}
Program: 147025
Project: 147025
Buggy source:
/** 
 * Attempts to save the answer at the specified FormIndex into the datamodel.
 * @param index
 * @param data
 * @return OK if save was successful, error if a constraint was violated.
 */
public int answerQuestion(FormIndex index,IAnswerData data){
  QuestionDef q=model.getQuestionPrompt(index).getQuestion();
  if (model.getEvent() != FormEntryController.EVENT_QUESTION) {
    throw new RuntimeException("String_Node_Str");
  }
  TreeElement element=model.getTreeElement(index);
  boolean complexQuestion=q.isComplex();
  if (element.required && data == null) {
    return ANSWER_REQUIRED_BUT_EMPTY;
  }
 else   if (!complexQuestion && !model.getForm().evaluateConstraint(index.getReference(),data)) {
    throw new RuntimeException("String_Node_Str");
  }
 else   if (!complexQuestion) {
    commitAnswer(element,index,data);
    return ANSWER_OK;
  }
 else {
    try {
      model.getForm().copyItemsetAnswer(q,element,data);
    }
 catch (    InvalidReferenceException ire) {
      ire.printStackTrace();
      throw new RuntimeException("String_Node_Str" + ire.getMessage());
    }
    return ANSWER_OK;
  }
}

Fixed version (ground truth):
/** 
 * Attempts to save the answer at the specified FormIndex into the datamodel.
 * @param index
 * @param data
 * @return OK if save was successful, error if a constraint was violated.
 */
public int answerQuestion(FormIndex index,IAnswerData data){
  QuestionDef q=model.getQuestionPrompt(index).getQuestion();
  if (model.getEvent() != FormEntryController.EVENT_QUESTION) {
    throw new RuntimeException("String_Node_Str");
  }
  TreeElement element=model.getTreeElement(index);
  boolean complexQuestion=q.isComplex();
  if (element.required && data == null) {
    return ANSWER_REQUIRED_BUT_EMPTY;
  }
 else   if (!complexQuestion && !model.getForm().evaluateConstraint(index.getReference(),data)) {
    return ANSWER_CONSTRAINT_VIOLATED;
  }
 else   if (!complexQuestion) {
    commitAnswer(element,index,data);
    return ANSWER_OK;
  }
 else   if (complexQuestion) {
    throw new RuntimeException("String_Node_Str");
  }
 else {
    try {
      model.getForm().copyItemsetAnswer(q,element,data);
    }
 catch (    InvalidReferenceException ire) {
      ire.printStackTrace();
      throw new RuntimeException("String_Node_Str" + ire.getMessage());
    }
    return ANSWER_OK;
  }
}
Program: 147026
Project: 147026
Buggy source:
public Externalizable getRecordForValue(String fieldName,Object value) throws NoSuchElementException, InvalidIndexException {
  return indexedStorage().getRecordForValue(fieldName,value);
}

Fixed version (ground truth):
public Externalizable getRecordForValue(String fieldName,Object value) throws NoSuchElementException, InvalidIndexException {
  return ((SerializationWrapper)indexedStorage().getRecordForValue(fieldName,value)).getData();
}
Program: 147027
Project: 147027
Buggy source:
public void configureApp(MIDlet m){
  failsafeInit(m);
  Logger.log("String_Node_Str","String_Node_Str");
  this.midlet=m;
  J2MEDisplay.init(m);
  loadModules();
  setProperties();
  registerAddtlStorage();
  StorageManager.repairAll();
  manager=new CommCareManager();
  manager.init(CommCareUtil.getProfileReference());
  UserUtility.populateAdminUser();
  inDemoMode=false;
  purgeScheduler();
  manager.initialize();
  LanguageUtils.initializeLanguage(true,"String_Node_Str");
}

Fixed version (ground truth):
public void configureApp(MIDlet m){
  failsafeInit(m);
  Logger.log("String_Node_Str","String_Node_Str");
  this.midlet=m;
  J2MEDisplay.init(m);
  loadModules();
  setProperties();
  registerAddtlStorage();
  StorageManager.repairAll();
  manager=new CommCareManager();
  manager.init(CommCareUtil.getProfileReference());
  UserUtility.populateAdminUser();
  inDemoMode=false;
  purgeScheduler();
  Localization.setLocale("String_Node_Str");
  manager.initialize();
  LanguageUtils.initializeLanguage(true,"String_Node_Str");
}
Program: 147028
Project: 147028
Buggy source:
public CommCareHomeScreen(CommCareHomeController controller,Vector<Suite> suites,boolean adminMode,boolean reviewEnabled){
  super("String_Node_Str",List.IMPLICIT);
  this.controller=controller;
  Enumeration en=suites.elements();
  while (en.hasMoreElements()) {
    Suite suite=(Suite)en.nextElement();
    for (    Menu m : suite.getMenus()) {
      if ("String_Node_Str".equals(m.getId())) {
        for (        String id : m.getCommandIds()) {
          Entry e=suite.getEntries().get(id);
          int location=append(e.getText().evaluate(),null);
          suiteTable.put(new Integer(location),suite);
          entryTable.put(new Integer(location),e);
        }
      }
 else       if (m.getRoot().equals("String_Node_Str")) {
        int location=append(m.getName().evaluate(),null);
        suiteTable.put(new Integer(location),suite);
        menuTable.put(new Integer(location),m);
      }
    }
  }
  if (reviewEnabled) {
    append(reviewRecent);
  }
  append(sendAllUnsent);
  setSendUnsent();
  setCommandListener(controller);
  setSelectCommand(select);
  addCommand(exit);
  if (adminMode) {
    addCommand(admSettings);
    addCommand(admNewUser);
    addCommand(admEditUsers);
    addCommand(admBackupRestore);
    addCommand(admResetDemo);
    addCommand(admUpgrade);
  }
}

Fixed version (ground truth):
public CommCareHomeScreen(CommCareHomeController controller,Vector<Suite> suites,boolean adminMode,boolean reviewEnabled){
  super("String_Node_Str",List.IMPLICIT);
  this.controller=controller;
  Enumeration en=suites.elements();
  while (en.hasMoreElements()) {
    Suite suite=(Suite)en.nextElement();
    for (    Menu m : suite.getMenus()) {
      if ("String_Node_Str".equals(m.getId())) {
        for (        String id : m.getCommandIds()) {
          Entry e=suite.getEntries().get(id);
          int location=append(e.getText().evaluate(),null);
          suiteTable.put(new Integer(location),suite);
          entryTable.put(new Integer(location),e);
        }
      }
 else       if (m.getRoot().equals("String_Node_Str")) {
        int location=append(m.getName().evaluate(),null);
        suiteTable.put(new Integer(location),suite);
        menuTable.put(new Integer(location),m);
      }
    }
  }
  if (reviewEnabled) {
    reviewRecent=new ChoiceItem(Localization.get("String_Node_Str"),null,List.IMPLICIT);
    append(reviewRecent);
  }
  append(sendAllUnsent);
  setSendUnsent();
  setCommandListener(controller);
  setSelectCommand(select);
  addCommand(exit);
  if (adminMode) {
    addCommand(admSettings);
    addCommand(admNewUser);
    addCommand(admEditUsers);
    addCommand(admBackupRestore);
    addCommand(admResetDemo);
    addCommand(admUpgrade);
  }
}
Program: 147029
Project: 147029
Buggy source:
public void writeExternal(DataOutputStream out) throws IOException {
  ExtUtil.writeString(out,id);
  ExtUtil.write(out,title);
  ExtUtil.write(out,filter);
  ExtUtil.write(out,context);
  ExtUtil.write(out,new ExtWrapList(headers));
  ExtUtil.write(out,new ExtWrapList(templates));
}

Fixed version (ground truth):
public void writeExternal(DataOutputStream out) throws IOException {
  ExtUtil.writeString(out,id);
  ExtUtil.write(out,title);
  ExtUtil.write(out,filter);
  ExtUtil.write(out,context);
  ExtUtil.write(out,new ExtWrapList(headers));
  ExtUtil.write(out,new ExtWrapList(templates));
  ExtUtil.writeInts(out,headerHints);
  ExtUtil.writeInts(out,templateHints);
}
Program: 147030
Project: 147030
Buggy source:
public void readExternal(DataInputStream in,PrototypeFactory pf) throws IOException, DeserializationException {
  id=ExtUtil.readString(in);
  title=(Text)ExtUtil.read(in,Text.class,pf);
  filter=(Filter)ExtUtil.read(in,Filter.class,pf);
  context=(FormInstance)ExtUtil.read(in,FormInstance.class,pf);
  headers=(Vector<Text>)ExtUtil.read(in,new ExtWrapList(Text.class),pf);
  templates=(Vector<Text>)ExtUtil.read(in,new ExtWrapList(Text.class),pf);
}

Fixed version (ground truth):
public void readExternal(DataInputStream in,PrototypeFactory pf) throws IOException, DeserializationException {
  id=ExtUtil.readString(in);
  title=(Text)ExtUtil.read(in,Text.class,pf);
  filter=(Filter)ExtUtil.read(in,Filter.class,pf);
  context=(FormInstance)ExtUtil.read(in,FormInstance.class,pf);
  headers=(Vector<Text>)ExtUtil.read(in,new ExtWrapList(Text.class),pf);
  templates=(Vector<Text>)ExtUtil.read(in,new ExtWrapList(Text.class),pf);
  headerHints=(int[])ExtUtil.readInts(in);
  templateHints=(int[])ExtUtil.readInts(in);
}
Program: 147031
Project: 147031
Buggy source:
public Detail(String id,Text title,FormInstance context,Vector<Text> headers,Vector<Text> templates,Filter filter){
  this.id=id;
  this.title=title;
  this.context=context;
  this.headers=headers;
  this.templates=templates;
  this.filter=filter;
}

Fixed version (ground truth):
public Detail(String id,Text title,FormInstance context,Vector<Text> headers,Vector<Text> templates,Filter filter,int[] headerHints,int[] templateHints){
  this.id=id;
  this.title=title;
  this.context=context;
  this.headers=headers;
  this.templates=templates;
  this.filter=filter;
  this.headerHints=headerHints;
  this.templateHints=templateHints;
}
Program: 147032
Project: 147032
Buggy source:
public Detail parse() throws InvalidStructureException, IOException, XmlPullParserException {
  checkNode("String_Node_Str");
  String id=parser.getAttributeValue(null,"String_Node_Str");
  getNextTagInBlock("String_Node_Str");
  checkNode("String_Node_Str");
  getNextTagInBlock("String_Node_Str");
  Text title=new TextParser(parser).parse();
  getNextTagInBlock("String_Node_Str");
  Filter filter=Filter.EmptyFilter();
  if (parser.getName().toLowerCase().equals("String_Node_Str")) {
    filter=new FilterParser(parser).parse();
    getNextTagInBlock("String_Node_Str");
  }
  FormInstance model=parseModel();
  Vector<Text> headers=new Vector<Text>();
  ;
  Vector<Text> templates=new Vector<Text>();
  while (nextTagInBlock("String_Node_Str")) {
    checkNode("String_Node_Str");
    if (nextTagInBlock("String_Node_Str")) {
      checkNode("String_Node_Str");
      parser.nextTag();
      checkNode("String_Node_Str");
      Text header=new TextParser(parser).parse();
      headers.addElement(header);
    }
    if (nextTagInBlock("String_Node_Str")) {
      checkNode("String_Node_Str");
      parser.nextTag();
      checkNode("String_Node_Str");
      Text template=new TextParser(parser).parse();
      templates.addElement(template);
    }
  }
  Detail d=new Detail(id,title,model,headers,templates,filter);
  return d;
}

Fixed version (ground truth):
public Detail parse() throws InvalidStructureException, IOException, XmlPullParserException {
  checkNode("String_Node_Str");
  String id=parser.getAttributeValue(null,"String_Node_Str");
  getNextTagInBlock("String_Node_Str");
  checkNode("String_Node_Str");
  getNextTagInBlock("String_Node_Str");
  Text title=new TextParser(parser).parse();
  getNextTagInBlock("String_Node_Str");
  Filter filter=Filter.EmptyFilter();
  if (parser.getName().toLowerCase().equals("String_Node_Str")) {
    filter=new FilterParser(parser).parse();
    getNextTagInBlock("String_Node_Str");
  }
  FormInstance model=parseModel();
  Vector<Text> headers=new Vector<Text>();
  Vector<Text> templates=new Vector<Text>();
  Vector<Integer> headerHints=new Vector<Integer>();
  Vector<Integer> templateHints=new Vector<Integer>();
  while (nextTagInBlock("String_Node_Str")) {
    checkNode("String_Node_Str");
    if (nextTagInBlock("String_Node_Str")) {
      checkNode("String_Node_Str");
      headerHints.addElement(new Integer(getWidth()));
      parser.nextTag();
      checkNode("String_Node_Str");
      Text header=new TextParser(parser).parse();
      headers.addElement(header);
    }
    if (nextTagInBlock("String_Node_Str")) {
      checkNode("String_Node_Str");
      templateHints.addElement(new Integer(getWidth()));
      parser.nextTag();
      checkNode("String_Node_Str");
      Text template=new TextParser(parser).parse();
      templates.addElement(template);
    }
  }
  Detail d=new Detail(id,title,model,headers,templates,filter,toArray(headerHints),toArray(templateHints));
  return d;
}
Program: 147033
Project: 147033
Buggy source:
public void populateDynamicChoices(ItemsetBinding itemset,TreeElement questionElement){
  Vector<SelectChoice> choices=new Vector<SelectChoice>();
  TreeReference contextRef=questionElement.getParent().getRef();
  Vector<TreeReference> matches=itemset.nodesetExpr.evalNodeset(this.getInstance(),new EvaluationContext(exprEvalContext,contextRef));
  for (int i=0; i < matches.size(); i++) {
    TreeReference item=matches.elementAt(i);
    String label=itemset.labelExpr.evalReadable(this.getInstance(),new EvaluationContext(exprEvalContext,item));
    String value=null;
    TreeElement copyNode=null;
    if (itemset.copyMode) {
      copyNode=this.getInstance().resolveReference(itemset.copyRef.contextualize(item));
    }
 else {
      value=itemset.valueExpr.evalReadable(this.getInstance(),new EvaluationContext(exprEvalContext,item));
    }
    SelectChoice choice=new SelectChoice(label,value != null ? value : "String_Node_Str" + i,itemset.labelIsItext);
    choice.setIndex(i);
    if (itemset.copyMode)     choice.copyNode=copyNode;
    choices.addElement(choice);
  }
  itemset.setChoices(choices,this.getLocalizer());
}

Fixed version (ground truth):
public void populateDynamicChoices(ItemsetBinding itemset){
  Vector<SelectChoice> choices=new Vector<SelectChoice>();
  Vector<TreeReference> matches=itemset.nodesetExpr.evalNodeset(this.getInstance(),new EvaluationContext(exprEvalContext,itemset.contextRef));
  for (int i=0; i < matches.size(); i++) {
    TreeReference item=matches.elementAt(i);
    String label=itemset.labelExpr.evalReadable(this.getInstance(),new EvaluationContext(exprEvalContext,item));
    String value=null;
    TreeElement copyNode=null;
    if (itemset.copyMode) {
      copyNode=this.getInstance().resolveReference(itemset.copyRef.contextualize(item));
    }
 else {
      value=itemset.valueExpr.evalReadable(this.getInstance(),new EvaluationContext(exprEvalContext,item));
    }
    SelectChoice choice=new SelectChoice(label,value != null ? value : "String_Node_Str" + i,itemset.labelIsItext);
    choice.setIndex(i);
    if (itemset.copyMode)     choice.copyNode=copyNode;
    choices.addElement(choice);
  }
  if (choices.size() == 0) {
    throw new RuntimeException("String_Node_Str" + itemset.nodesetRef + "String_Node_Str");
  }
  itemset.setChoices(choices,this.getLocalizer());
}
Program: 147034
Project: 147034
Buggy source:
public void writeExternal(DataOutputStream out) throws IOException {
  ExtUtil.write(out,nodesetRef);
  ExtUtil.write(out,new ExtWrapTagged(nodesetExpr));
  ExtUtil.write(out,labelRef);
  ExtUtil.write(out,new ExtWrapTagged(labelExpr));
  ExtUtil.write(out,new ExtWrapNullable(valueRef));
  ExtUtil.write(out,new ExtWrapNullable(valueExpr == null ? null : new ExtWrapTagged(valueExpr)));
  ExtUtil.write(out,new ExtWrapNullable(copyRef));
  ExtUtil.writeBool(out,labelIsItext);
  ExtUtil.writeBool(out,copyMode);
}

Fixed version (ground truth):
public void writeExternal(DataOutputStream out) throws IOException {
  ExtUtil.write(out,nodesetRef);
  ExtUtil.write(out,new ExtWrapTagged(nodesetExpr));
  ExtUtil.write(out,contextRef);
  ExtUtil.write(out,labelRef);
  ExtUtil.write(out,new ExtWrapTagged(labelExpr));
  ExtUtil.write(out,new ExtWrapNullable(valueRef));
  ExtUtil.write(out,new ExtWrapNullable(valueExpr == null ? null : new ExtWrapTagged(valueExpr)));
  ExtUtil.write(out,new ExtWrapNullable(copyRef));
  ExtUtil.writeBool(out,labelIsItext);
  ExtUtil.writeBool(out,copyMode);
}
Program: 147035
Project: 147035
Buggy source:
public void readExternal(DataInputStream in,PrototypeFactory pf) throws IOException, DeserializationException {
  nodesetRef=(TreeReference)ExtUtil.read(in,TreeReference.class,pf);
  nodesetExpr=(IConditionExpr)ExtUtil.read(in,new ExtWrapTagged(),pf);
  labelRef=(TreeReference)ExtUtil.read(in,TreeReference.class,pf);
  labelExpr=(IConditionExpr)ExtUtil.read(in,new ExtWrapTagged(),pf);
  valueRef=(TreeReference)ExtUtil.read(in,new ExtWrapNullable(TreeReference.class),pf);
  valueExpr=(IConditionExpr)ExtUtil.read(in,new ExtWrapNullable(new ExtWrapTagged()),pf);
  copyRef=(TreeReference)ExtUtil.read(in,new ExtWrapNullable(TreeReference.class),pf);
  labelIsItext=ExtUtil.readBool(in);
  copyMode=ExtUtil.readBool(in);
}

Fixed version (ground truth):
public void readExternal(DataInputStream in,PrototypeFactory pf) throws IOException, DeserializationException {
  nodesetRef=(TreeReference)ExtUtil.read(in,TreeReference.class,pf);
  nodesetExpr=(IConditionExpr)ExtUtil.read(in,new ExtWrapTagged(),pf);
  contextRef=(TreeReference)ExtUtil.read(in,TreeReference.class,pf);
  labelRef=(TreeReference)ExtUtil.read(in,TreeReference.class,pf);
  labelExpr=(IConditionExpr)ExtUtil.read(in,new ExtWrapTagged(),pf);
  valueRef=(TreeReference)ExtUtil.read(in,new ExtWrapNullable(TreeReference.class),pf);
  valueExpr=(IConditionExpr)ExtUtil.read(in,new ExtWrapNullable(new ExtWrapTagged()),pf);
  copyRef=(TreeReference)ExtUtil.read(in,new ExtWrapNullable(TreeReference.class),pf);
  labelIsItext=ExtUtil.readBool(in);
  copyMode=ExtUtil.readBool(in);
}
Program: 147036
Project: 147036
Buggy source:
public Vector<SelectChoice> getSelectChoices(){
  QuestionDef q=getQuestion();
  ItemsetBinding itemset=q.getDynamicChoices();
  if (itemset != null) {
    if (!dynamicChoicesPopulated) {
      form.populateDynamicChoices(itemset,mTreeElement);
      dynamicChoicesPopulated=true;
    }
    Vector<SelectChoice> choices=itemset.getChoices();
    if (choices.size() == 0) {
      throw new RuntimeException("String_Node_Str");
    }
    return choices;
  }
 else {
    return getQuestion().getChoices();
  }
}

Fixed version (ground truth):
public Vector<SelectChoice> getSelectChoices(){
  QuestionDef q=getQuestion();
  ItemsetBinding itemset=q.getDynamicChoices();
  if (itemset != null) {
    if (!dynamicChoicesPopulated) {
      form.populateDynamicChoices(itemset);
      dynamicChoicesPopulated=true;
    }
    return itemset.getChoices();
  }
 else {
    return getQuestion().getChoices();
  }
}
Program: 147038
Project: 147038
Buggy source:
public String[] getHeaders(boolean detailed){
  Text[] text;
  text=shortDetail.getHeaders();
  String[] output=new String[text.length];
  for (int i=0; i < output.length; ++i) {
    output[i]=text[i].evaluate(instance);
  }
  return output;
}

Fixed version (ground truth):
public String[] getHeaders(boolean detailed){
  Text[] text;
  if (!detailed) {
    text=shortDetail.getHeaders();
  }
 else {
    text=longDetail.getHeaders();
  }
  String[] output=new String[text.length];
  for (int i=0; i < output.length; ++i) {
    output[i]=text[i].evaluate(instance);
  }
  return output;
}
Program: 147039
Project: 147039
Buggy source:
public String[] getLongFields(E e){
  Text[] text=shortDetail.getTemplates();
  String[] output=new String[text.length];
  for (int i=0; i < output.length; ++i) {
    output[i]=text[i].evaluate(instance);
  }
  return output;
}

Fixed version (ground truth):
public String[] getLongFields(E e){
  loader.prepare(e);
  FormInstance specificInstance=loader.loadInstance(longDetail.getInstance());
  Text[] text=longDetail.getTemplates();
  String[] output=new String[text.length];
  for (int i=0; i < output.length; ++i) {
    output[i]=text[i].evaluate(specificInstance);
  }
  return output;
}
Program: 147040
Project: 147040
Buggy source:
public void prepare(PatientReferral r){
  this.r=r;
  this.c=null;
}

Fixed version (ground truth):
public void prepare(PatientReferral r){
  this.r=r;
  preloader=new PatientReferralPreloader(r);
  this.c=null;
}
Program: 147041
Project: 147041
Buggy source:
protected Object resolveReferenceData(String reference,String key){
  String refType=references.get(reference).toLowerCase();
  if (refType.equals("String_Node_Str")) {
  }
 else   if (refType.equals("String_Node_Str")) {
    return getCase().getProperty(key);
  }
  return null;
}

Fixed version (ground truth):
protected Object resolveReferenceData(String reference,String key){
  String refType=references.get(reference).toLowerCase();
  if (refType.equals("String_Node_Str")) {
    return preloader.handlePreload(key);
  }
 else   if (refType.equals("String_Node_Str")) {
    return getCase().getProperty(key);
  }
  return null;
}
Program: 147042
Project: 147042
Buggy source:
public String evaluate(FormInstance context){
switch (type) {
case TEXT_TYPE_FLAT:
    return argument;
case TEXT_TYPE_LOCALE:
  String id=argument;
if (argument == null) {
  id=arguments.get("String_Node_Str").evaluate(context);
}
return Localization.get(id);
case TEXT_TYPE_XPATH:
try {
XPathExpression expression=XPathParseTool.parseXPath(argument);
EvaluationContext temp=new EvaluationContext(new EvaluationContext(),context.getRoot().getRef());
return (String)expression.eval(context,temp);
}
 catch (XPathSyntaxException e) {
e.printStackTrace();
}
return argument;
case TEXT_TYPE_COMPOSITE:
String ret="String_Node_Str";
for (Enumeration en=arguments.elements(); en.hasMoreElements(); ) {
ret+=((Text)en.nextElement()).evaluate() + "String_Node_Str";
}
return ret;
default :
return argument;
}
}

Fixed version (ground truth):
public String evaluate(FormInstance context){
switch (type) {
case TEXT_TYPE_FLAT:
    return argument;
case TEXT_TYPE_LOCALE:
  String id=argument;
if (argument.equals("String_Node_Str")) {
  id=arguments.get("String_Node_Str").evaluate(context);
}
return Localization.get(id);
case TEXT_TYPE_XPATH:
try {
XPathExpression expression=XPathParseTool.parseXPath(argument);
EvaluationContext temp=new EvaluationContext(new EvaluationContext(),context.getRoot().getRef());
for (Enumeration en=arguments.keys(); en.hasMoreElements(); ) {
String key=(String)en.nextElement();
temp.setVariable(key,arguments.get(key));
}
return (String)expression.eval(context,temp);
}
 catch (XPathSyntaxException e) {
e.printStackTrace();
}
return argument;
case TEXT_TYPE_COMPOSITE:
String ret="String_Node_Str";
for (Enumeration en=arguments.elements(); en.hasMoreElements(); ) {
ret+=((Text)en.nextElement()).evaluate() + "String_Node_Str";
}
return ret;
default :
return argument;
}
}
Program: 147043
Project: 147043
Buggy source:
public static Long toInt(Object o){
  Double val=toNumeric(o);
  return new Long((long)Math.floor(val.doubleValue()));
}

Fixed version (ground truth):
public static Double toInt(Object o){
  Double val=toNumeric(o);
  if (val.isInfinite() || val.isNaN()) {
    return val;
  }
 else   if (val.doubleValue() >= Long.MAX_VALUE || val.doubleValue() <= Long.MIN_VALUE) {
    return val;
  }
 else {
    long l=val.longValue();
    Double dbl=new Double(l);
    if (l == 0 && (val.doubleValue() < 0. || val.equals(new Double(-0.)))) {
      dbl=new Double(-0.);
    }
    return dbl;
  }
}
Program: 147044
Project: 147044
Buggy source:
public static Date toDate(Object o){
  if (o instanceof Double) {
    double d=((Double)o).doubleValue();
    if (Math.abs(d - (int)d) > 1.0e-12) {
      throw new XPathTypeMismatchException("String_Node_Str");
    }
    o=toInt(o);
  }
  if (o instanceof Long) {
    Date dt=DateUtils.getDate(1970,1,1);
    dt.setTime(dt.getTime() + ((Long)o).longValue() * 86400000l + 43200000l);
    return DateUtils.roundDate(dt);
  }
 else   if (o instanceof String) {
    Date d=DateUtils.parseDate((String)o);
    if (d == null) {
      throw new XPathTypeMismatchException("String_Node_Str");
    }
 else {
      return d;
    }
  }
 else   if (o instanceof Date) {
    return DateUtils.roundDate((Date)o);
  }
 else {
    throw new XPathTypeMismatchException("String_Node_Str");
  }
}

Fixed version (ground truth):
public static Date toDate(Object o){
  if (o instanceof Double) {
    Double n=toInt(o);
    if (n.isInfinite() || n.isNaN() || n.doubleValue() > Integer.MAX_VALUE || n.doubleValue() < Integer.MIN_VALUE) {
      throw new XPathTypeMismatchException("String_Node_Str");
    }
    return DateUtils.dateAdd(DateUtils.getDate(1970,1,1),n.intValue());
  }
 else   if (o instanceof String) {
    Date d=DateUtils.parseDate((String)o);
    if (d == null) {
      throw new XPathTypeMismatchException("String_Node_Str");
    }
 else {
      return d;
    }
  }
 else   if (o instanceof Date) {
    return DateUtils.roundDate((Date)o);
  }
 else {
    throw new XPathTypeMismatchException("String_Node_Str");
  }
}
Program: 147045
Project: 147045
Buggy source:
public TreeReference getRef(){
  TreeElement elem=this;
  TreeReference ref=TreeReference.selfRef();
  while (elem != null) {
    TreeReference step;
    if (name != null) {
      step=TreeReference.selfRef();
      step.add(this.name,this.multiplicity);
    }
 else {
      step=TreeReference.rootRef();
    }
    ref=ref.parent(step);
    elem=elem.parent;
  }
  return ref;
}

Fixed version (ground truth):
public TreeReference getRef(){
  TreeElement elem=this;
  TreeReference ref=TreeReference.selfRef();
  while (elem != null) {
    TreeReference step;
    if (elem.name != null) {
      step=TreeReference.selfRef();
      step.add(elem.name,elem.multiplicity);
    }
 else {
      step=TreeReference.rootRef();
    }
    ref=ref.parent(step);
    elem=elem.parent;
  }
  return ref;
}
Program: 147046
Project: 147046
Buggy source:
public static Object getRefValue(FormInstance model,TreeReference ref){
  TreeElement node=((FormInstance)model).resolveReference(ref);
  if (node == null) {
    throw new XPathTypeMismatchException("String_Node_Str" + ref.toString() + "String_Node_Str");
  }
  return unpackValue(node.isRelevant() ? node.getValue() : null);
}

Fixed version (ground truth):
public static Object getRefValue(FormInstance model,TreeReference ref){
  TreeElement node=model.resolveReference(ref);
  if (node == null) {
    throw new XPathTypeMismatchException("String_Node_Str" + ref.toString() + "String_Node_Str");
  }
  return unpackValue(node.isRelevant() ? node.getValue() : null);
}
Program: 147047
Project: 147047
Buggy source:
public String substituteStringArgs(String templateStr){
  return form.fillTemplateString(templateStr,index.getReference());
}

Fixed version (ground truth):
public String substituteStringArgs(String templateStr){
  if (templateStr == null) {
    return null;
  }
  return form.fillTemplateString(templateStr,index.getReference());
}
Program: 147048
Project: 147048
Buggy source:
public void removeAll(){
  storage.removeAll();
}

Fixed version (ground truth):
public void removeAll(EntityFilter ef){
  storage.removeAll(ef);
}
Program: 147050
Project: 147050
Buggy source:
public Object getMetaData(String fieldName){
  if (fieldName.equals("String_Node_Str")) {
    return name;
  }
  if (fieldName.equals("String_Node_Str")) {
    return model.schema;
  }
 else {
    throw new IllegalArgumentException();
  }
}

Fixed version (ground truth):
public Object getMetaData(String fieldName){
  if (fieldName.equals("String_Node_Str")) {
    return name;
  }
  if (fieldName.equals("String_Node_Str")) {
    return ExtUtil.emptyIfNull(model.schema);
  }
 else {
    throw new IllegalArgumentException();
  }
}
Program: 147051
Project: 147051
Buggy source:
public IFormEntryView getFormEntryView(String viewType,FormEntryModel model,FormEntryController controller){
  return new Chatterbox(viewType,model,controller);
}

Fixed version (ground truth):
public IFormEntryView getFormEntryView(FormEntryModel model,FormEntryController controller){
  return new Chatterbox(title,model,controller);
}
Program: 147052
Project: 147052
Buggy source:
/** 
 * Write an object to the store. Will either add a new record, or update the existing record (if one exists) for the object's ID. This function should never be used in conjunction with add() and update() within the same StorageUtility
 * @param p object to store
 * @throws StorageFullException if there is not enough room to store the object
 */
public void write(Persistable p) throws StorageFullException {
  typeCheck(p);
  RMSRecordLoc newLoc=null;
synchronized (getAccessLock()) {
    RMSStorageInfo info=getInfoRecord();
    int id=p.getID();
    if (id == -1 && allocateIDs) {
      id=info.nextRecordID;
      p.setID(id);
      info.nextRecordID++;
    }
    byte[] data=ExtUtil.serialize(p);
    Hashtable idIndex=getIDIndexRecord();
    boolean recordExists=idIndex.containsKey(new Integer(id));
    setDirty();
    int bytesNeededEstimate=(recordExists ? 20 : 40);
    if (!setReserveBuffer(bytesNeededEstimate)) {
      setClean();
      throw new StorageFullException();
    }
    if (recordExists) {
      RMSRecordLoc loc=(RMSRecordLoc)idIndex.get(new Integer(id));
      newLoc=updateRecord(loc,data,info);
    }
 else {
      newLoc=addRecord(data,info);
      if (newLoc != null) {
        info.numRecords++;
      }
    }
    setReserveBuffer(0);
    if (newLoc == null) {
      setClean();
      throw new StorageFullException();
    }
    idIndex.put(new Integer(id),newLoc);
    commitIndex(info,idIndex);
    setClean();
    storageModified();
  }
}

Fixed version (ground truth):
/** 
 * Write an object to the store. Will either add a new record, or update the existing record (if one exists) for the object's ID. This function should never be used in conjunction with add() and update() within the same StorageUtility
 * @param p object to store
 * @throws StorageFullException if there is not enough room to store the object
 */
public void write(Persistable p) throws StorageFullException {
  typeCheck(p);
  RMSRecordLoc newLoc=null;
synchronized (getAccessLock()) {
    RMSStorageInfo info=getInfoRecord();
    int id=p.getID();
    if (allocateIDs) {
      if (id == -1) {
        id=info.nextRecordID;
        p.setID(id);
        info.nextRecordID++;
      }
 else       if (id >= info.nextRecordID) {
        info.nextRecordID=id + 1;
      }
    }
    byte[] data=ExtUtil.serialize(p);
    Hashtable idIndex=getIDIndexRecord();
    boolean recordExists=idIndex.containsKey(new Integer(id));
    setDirty();
    int bytesNeededEstimate=(recordExists ? 20 : 40);
    if (!setReserveBuffer(bytesNeededEstimate)) {
      setClean();
      throw new StorageFullException();
    }
    if (recordExists) {
      RMSRecordLoc loc=(RMSRecordLoc)idIndex.get(new Integer(id));
      newLoc=updateRecord(loc,data,info);
    }
 else {
      newLoc=addRecord(data,info);
      if (newLoc != null) {
        info.numRecords++;
      }
    }
    setReserveBuffer(0);
    if (newLoc == null) {
      setClean();
      throw new StorageFullException();
    }
    idIndex.put(new Integer(id),newLoc);
    commitIndex(info,idIndex);
    setClean();
    storageModified();
  }
}
Program: 147053
Project: 147053
Buggy source:
public static Alert showError(String title,String message,Displayable next,CommandListener customListener){
  final Alert alert=new Alert(title,message,null,AlertType.ERROR);
  alert.setTimeout(Alert.FOREVER);
  if (customListener != null) {
    if (next != null) {
      System.err.println("String_Node_Str");
    }
    alert.setCommandListener(customListener);
  }
  if (next == null) {
    display.setCurrent(alert);
  }
 else {
    throw new RuntimeException("String_Node_Str");
  }
  return alert;
}

Fixed version (ground truth):
public static Alert showError(String title,String message,Displayable next,CommandListener customListener){
  final Alert alert=new Alert(title,message,null,AlertType.ERROR);
  alert.setTimeout(Alert.FOREVER);
  if (customListener != null) {
    if (next != null) {
      System.err.println("String_Node_Str");
    }
    alert.setCommandListener(customListener);
  }
  if (next == null) {
    display.setCurrent(alert);
  }
 else {
    display.setCurrent(alert,next);
  }
  return alert;
}
Program: 147054
Project: 147054
Buggy source:
private static Selection getSelection(String choice,QuestionDef q){
  Selection s=new Selection(choice);
  if (q != null) {
    q.localizeSelectMap(null);
    int index=q.getSelectedItemIndex(choice);
    s.attachQuestionDef(q);
    return (index != -1 ? s : null);
  }
  return s;
}

Fixed version (ground truth):
private static Selection getSelection(String choice,QuestionDef q){
  Selection s=new Selection(choice);
  if (q != null) {
    if (q.getSelectItems() == null)     q.localizeSelectMap(null);
    int index=q.getSelectedItemIndex(choice);
    s.attachQuestionDef(q);
    return (index != -1 ? s : null);
  }
  return s;
}
Program: 147055
Project: 147055
Buggy source:
public String getName(){
  return null;
}

Fixed version (ground truth):
public String getName(){
  return getType();
}
Program: 147060
Project: 147060
Buggy source:
public void registerService(IService service){
  services.put(service,service.getName());
}

Fixed version (ground truth):
public void registerService(IService service){
  services.put(service.getName(),service);
}
Program: 147061
Project: 147061
Buggy source:
public void readExternal(DataInputStream in,PrototypeFactory pf) throws IOException, DeserializationException {
  ExtUtil.read(in,new ExtWrapTagged());
}

Fixed version (ground truth):
public void readExternal(DataInputStream in,PrototypeFactory pf) throws IOException, DeserializationException {
  pointer=(IDataPointer)ExtUtil.read(in,new ExtWrapTagged());
}
Program: 147062
Project: 147062
Buggy source:
public void writeExternal(DataOutputStream out) throws IOException {
  ExtUtil.write(out,new ExtWrapList(payloads));
}

Fixed version (ground truth):
public void writeExternal(DataOutputStream out) throws IOException {
  ExtUtil.write(out,new ExtWrapListPoly(payloads));
}
Program: 147063
Project: 147063
Buggy source:
public void readExternal(DataInputStream in,PrototypeFactory pf) throws IOException, DeserializationException {
  payloads=(Vector)ExtUtil.read(in,new ExtWrapList(new ExtWrapTagged()),pf);
}

Fixed version (ground truth):
public void readExternal(DataInputStream in,PrototypeFactory pf) throws IOException, DeserializationException {
  payloads=(Vector)ExtUtil.read(in,new ExtWrapListPoly(),pf);
}
Program: 147064
Project: 147064
Buggy source:
public int read() throws IOException {
  if (currentStream == -1) {
    throw new IOException("String_Node_Str");
  }
  InputStream cur=((InputStream)streams.elementAt(currentStream));
  int next=cur.read();
  if (next != -1) {
    return next;
  }
  while (next != -1 && currentStream + 1 < streams.size()) {
    currentStream++;
    cur=((InputStream)streams.elementAt(currentStream));
    next=cur.read();
  }
  return next;
}

Fixed version (ground truth):
public int read() throws IOException {
  if (currentStream == -1) {
    throw new IOException("String_Node_Str");
  }
  InputStream cur=((InputStream)streams.elementAt(currentStream));
  int next=cur.read();
  if (next != -1) {
    return next;
  }
  while (next == -1 && currentStream + 1 < streams.size()) {
    currentStream++;
    cur=((InputStream)streams.elementAt(currentStream));
    next=cur.read();
  }
  return next;
}
Program: 147065
Project: 147065
Buggy source:
public static PrototypeFactory convertPrototypeFactory(PrototypeFactoryDeprecated pfd){
  PrototypeFactory pf=new PrototypeFactory();
  for (Enumeration e=pfd.prototypes.keys(); e.hasMoreElements(); ) {
    pf.addClass((Class)pfd.prototypes.get(e.nextElement()));
  }
  return pf;
}

Fixed version (ground truth):
public static PrototypeFactory convertPrototypeFactory(PrototypeFactoryDeprecated pfd){
  PrototypeFactory pf=ExtUtil.defaultPrototypes();
  for (Enumeration e=pfd.prototypes.keys(); e.hasMoreElements(); ) {
    pf.addClass((Class)pfd.prototypes.get(e.nextElement()));
  }
  return pf;
}
Program: 147066
Project: 147066
Buggy source:
/** 
 * (non-Javadoc)
 * @see org.javarosa.core.util.clforms.storage.Externalizable#readExternal(DataInputStream)
 */
public void readExternal(DataInputStream in) throws IOException {
  this.name=in.readUTF();
}

Fixed version (ground truth):
/** 
 * (non-Javadoc)
 * @see org.javarosa.core.util.clforms.storage.Externalizable#readExternal(DataInputStream)
 */
public void readExternal(DataInputStream in) throws IOException, InstantiationException, IllegalAccessException, UnavailableExternalizerException {
  this.name=in.readUTF();
}
Program: 147067
Project: 147067
Buggy source:
public void readExternal(DataInputStream in) throws IOException {
  this.recordId=in.readInt();
  this.size=in.readInt();
}

Fixed version (ground truth):
public void readExternal(DataInputStream in) throws IOException, InstantiationException, IllegalAccessException, UnavailableExternalizerException {
  this.recordId=in.readInt();
  this.size=in.readInt();
}
Program: 147068
Project: 147068
Buggy source:
/** 
 */
public IAnswerData handlePreload(String preloadParams){
  IAnswerData returnVal=null;
  if (preloadParams == "String_Node_Str") {
    returnVal=new IntegerData(12);
  }
 else {
    int selectorStart=preloadParams.indexOf("String_Node_Str");
    if (selectorStart == -1) {
      returnVal=(IAnswerData)patient.getRecord(preloadParams);
    }
 else {
      String type=preloadParams.substring(0,selectorStart);
      String selector=preloadParams.substring(selectorStart,preloadParams.length());
      Vector data=patient.getRecordSet(type,selector);
      returnVal=new NumericListData();
      returnVal.setValue(data);
    }
  }
  return returnVal;
}

Fixed version (ground truth):
/** 
 */
public IAnswerData handlePreload(String preloadParams){
  IAnswerData returnVal=null;
  if (preloadParams == "String_Node_Str") {
    returnVal=new IntegerData(12);
  }
 else   if ("String_Node_Str".equals(preloadParams)) {
    returnVal=new ImmunizationAnswerData(patient.getVaccinations());
  }
 else {
    int selectorStart=preloadParams.indexOf("String_Node_Str");
    if (selectorStart == -1) {
      returnVal=(IAnswerData)patient.getRecord(preloadParams);
    }
 else {
      String type=preloadParams.substring(0,selectorStart);
      String selector=preloadParams.substring(selectorStart,preloadParams.length());
      Vector data=patient.getRecordSet(type,selector);
      returnVal=new NumericListData();
      returnVal.setValue(data);
    }
  }
  return returnVal;
}