Program: 144952
Project: 144952
Buggy source:
protected QuestionDef parseControl(IFormElement parent,Element e,int controlType){
  QuestionDef question=new QuestionDef();
  question.setID(serialQuestionID++);
  Vector usedAtts=new Vector();
  usedAtts.addElement(REF_ATTR);
  usedAtts.addElement(BIND_ATTR);
  usedAtts.addElement(APPEARANCE_ATTR);
  IDataReference dataRef=null;
  boolean refFromBind=false;
  String ref=e.getAttributeValue(null,REF_ATTR);
  String bind=e.getAttributeValue(null,BIND_ATTR);
  if (bind != null) {
    DataBinding binding=bindingsByID.get(bind);
    if (binding == null) {
      throw new XFormParseException("String_Node_Str" + bind + "String_Node_Str",e);
    }
    dataRef=binding.getReference();
    refFromBind=true;
  }
 else   if (ref != null) {
    dataRef=new XPathReference(ref);
  }
 else {
    if (controlType == Constants.CONTROL_TRIGGER) {
    }
 else {
      throw new XFormParseException("String_Node_Str",e);
    }
  }
  if (dataRef != null) {
    if (!refFromBind) {
      dataRef=getAbsRef(dataRef,parent);
    }
    question.setBind(dataRef);
    if (controlType == Constants.CONTROL_SELECT_ONE) {
      selectOnes.addElement((TreeReference)dataRef.getReference());
    }
 else     if (controlType == Constants.CONTROL_SELECT_MULTI) {
      selectMultis.addElement((TreeReference)dataRef.getReference());
    }
  }
  boolean isSelect=(controlType == Constants.CONTROL_SELECT_MULTI || controlType == Constants.CONTROL_SELECT_ONE);
  question.setControlType(controlType);
  question.setAppearanceAttr(e.getAttributeValue(null,APPEARANCE_ATTR));
  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)) {
      parseQuestionLabel(question,child);
    }
 else     if ("String_Node_Str".equals(childName)) {
      parseHint(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);
    }
  }
  if (isSelect) {
    if (question.getNumChoices() > 0 && question.getDynamicChoices() != null) {
      throw new XFormParseException("String_Node_Str");
    }
 else     if (question.getNumChoices() == 0 && question.getDynamicChoices() == null) {
      throw new XFormParseException("String_Node_Str");
    }
  }
  parent.addChild(question);
  if (XFormUtils.showUnusedAttributeWarning(e,usedAtts)) {
    System.out.println(XFormUtils.unusedAttWarning(e,usedAtts));
  }
  return question;
}

Fixed version (ground truth):
protected QuestionDef parseControl(IFormElement parent,Element e,int controlType){
  QuestionDef question=new QuestionDef();
  question.setID(serialQuestionID++);
  Vector usedAtts=new Vector();
  usedAtts.addElement(REF_ATTR);
  usedAtts.addElement(BIND_ATTR);
  usedAtts.addElement(APPEARANCE_ATTR);
  IDataReference dataRef=null;
  boolean refFromBind=false;
  String ref=e.getAttributeValue(null,REF_ATTR);
  String bind=e.getAttributeValue(null,BIND_ATTR);
  if (bind != null) {
    DataBinding binding=bindingsByID.get(bind);
    if (binding == null) {
      throw new XFormParseException("String_Node_Str" + bind + "String_Node_Str",e);
    }
    dataRef=binding.getReference();
    refFromBind=true;
  }
 else   if (ref != null) {
    try {
      dataRef=new XPathReference(ref);
    }
 catch (    RuntimeException el) {
      System.out.println(this.getVagueLocation(e));
      throw el;
    }
  }
 else {
    if (controlType == Constants.CONTROL_TRIGGER) {
    }
 else {
      throw new XFormParseException("String_Node_Str",e);
    }
  }
  if (dataRef != null) {
    if (!refFromBind) {
      dataRef=getAbsRef(dataRef,parent);
    }
    question.setBind(dataRef);
    if (controlType == Constants.CONTROL_SELECT_ONE) {
      selectOnes.addElement((TreeReference)dataRef.getReference());
    }
 else     if (controlType == Constants.CONTROL_SELECT_MULTI) {
      selectMultis.addElement((TreeReference)dataRef.getReference());
    }
  }
  boolean isSelect=(controlType == Constants.CONTROL_SELECT_MULTI || controlType == Constants.CONTROL_SELECT_ONE);
  question.setControlType(controlType);
  question.setAppearanceAttr(e.getAttributeValue(null,APPEARANCE_ATTR));
  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)) {
      parseQuestionLabel(question,child);
    }
 else     if ("String_Node_Str".equals(childName)) {
      parseHint(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);
    }
  }
  if (isSelect) {
    if (question.getNumChoices() > 0 && question.getDynamicChoices() != null) {
      throw new XFormParseException("String_Node_Str");
    }
 else     if (question.getNumChoices() == 0 && question.getDynamicChoices() == null) {
      throw new XFormParseException("String_Node_Str");
    }
  }
  parent.addChild(question);
  if (XFormUtils.showUnusedAttributeWarning(e,usedAtts)) {
    System.out.println(XFormUtils.unusedAttWarning(e,usedAtts));
  }
  return question;
}