Program: 145143
Project: 145143
Buggy source:
private static void parseItemset(FormDef f,QuestionDef q,Element e,IFormElement qparent){
  ItemsetBinding itemset=new ItemsetBinding();
  Vector usedAtts=new Vector();
  Vector labelUA=new Vector();
  Vector valueUA=new Vector();
  Vector copyUA=new Vector();
  usedAtts.addElement("String_Node_Str");
  labelUA.addElement("String_Node_Str");
  valueUA.addElement("String_Node_Str");
  valueUA.addElement("String_Node_Str");
  copyUA.addElement("String_Node_Str");
  String nodesetStr=e.getAttributeValue("String_Node_Str","String_Node_Str");
  XPathPathExpr path=XPathReference.getPathExpr(nodesetStr);
  itemset.nodesetExpr=new XPathConditional(path);
  itemset.contextRef=getFormElementRef(qparent);
  itemset.nodesetRef=FormInstance.unpackReference(getAbsRef(new XPathReference(path.getReference(true)),itemset.contextRef));
  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 ("String_Node_Str".equals(childName)) {
      String labelXpath=child.getAttributeValue("String_Node_Str","String_Node_Str");
      boolean labelItext=false;
      if (XFormUtils.showUnusedAttributeWarning(child,labelUA)) {
        System.out.println(XFormUtils.unusedAttWarning(child,labelUA));
      }
      if (labelXpath != null) {
        if (labelXpath.startsWith("String_Node_Str") && labelXpath.endsWith("String_Node_Str")) {
          labelXpath=labelXpath.substring("String_Node_Str".length(),labelXpath.indexOf("String_Node_Str"));
          labelItext=true;
        }
      }
 else {
        throw new XFormParseException("String_Node_Str");
      }
      XPathPathExpr labelPath=XPathReference.getPathExpr(labelXpath);
      itemset.labelRef=FormInstance.unpackReference(getAbsRef(new XPathReference(labelPath),itemset.nodesetRef));
      itemset.labelExpr=new XPathConditional(labelPath);
      itemset.labelIsItext=labelItext;
    }
 else     if ("String_Node_Str".equals(childName)) {
      String copyRef=child.getAttributeValue("String_Node_Str","String_Node_Str");
      if (XFormUtils.showUnusedAttributeWarning(child,copyUA)) {
        System.out.println(XFormUtils.unusedAttWarning(child,copyUA));
      }
      if (copyRef == null) {
        throw new XFormParseException("String_Node_Str");
      }
      itemset.copyRef=FormInstance.unpackReference(getAbsRef(new XPathReference(copyRef),itemset.nodesetRef));
      itemset.copyMode=true;
    }
 else     if ("String_Node_Str".equals(childName)) {
      String valueXpath=child.getAttributeValue("String_Node_Str","String_Node_Str");
      if (XFormUtils.showUnusedAttributeWarning(child,valueUA)) {
        System.out.println(XFormUtils.unusedAttWarning(child,valueUA));
      }
      if (valueXpath == null) {
        throw new XFormParseException("String_Node_Str");
      }
      XPathPathExpr valuePath=XPathReference.getPathExpr(valueXpath);
      itemset.valueRef=FormInstance.unpackReference(getAbsRef(new XPathReference(valuePath),itemset.nodesetRef));
      itemset.valueExpr=new XPathConditional(valuePath);
      itemset.copyMode=false;
    }
  }
  if (itemset.labelRef == null) {
    throw new XFormParseException("String_Node_Str");
  }
 else   if (itemset.copyRef == null && itemset.valueRef == null) {
    throw new XFormParseException("String_Node_Str");
  }
  if (itemset.copyRef != null) {
    if (itemset.valueRef == null) {
      System.err.println("String_Node_Str");
    }
 else     if (!itemset.copyRef.isParentOf(itemset.valueRef,false)) {
      throw new XFormParseException("String_Node_Str");
    }
  }
  q.setDynamicChoices(itemset);
  itemsets.addElement(itemset);
  if (XFormUtils.showUnusedAttributeWarning(e,usedAtts)) {
    System.out.println(XFormUtils.unusedAttWarning(e,usedAtts));
  }
}

Fixed version (ground truth):
private static void parseItemset(FormDef f,QuestionDef q,Element e,IFormElement qparent){
  ItemsetBinding itemset=new ItemsetBinding();
  Vector usedAtts=new Vector();
  Vector labelUA=new Vector();
  Vector valueUA=new Vector();
  Vector copyUA=new Vector();
  usedAtts.addElement("String_Node_Str");
  labelUA.addElement("String_Node_Str");
  valueUA.addElement("String_Node_Str");
  valueUA.addElement("String_Node_Str");
  copyUA.addElement("String_Node_Str");
  String nodesetStr=e.getAttributeValue("String_Node_Str","String_Node_Str");
  if (nodesetStr == null)   throw new RuntimeException("String_Node_Str" + e.getName() + "String_Node_Str"+ XFormSerializer.elementToString(e)+ "String_Node_Str");
  XPathPathExpr path=XPathReference.getPathExpr(nodesetStr);
  itemset.nodesetExpr=new XPathConditional(path);
  itemset.contextRef=getFormElementRef(qparent);
  itemset.nodesetRef=FormInstance.unpackReference(getAbsRef(new XPathReference(path.getReference(true)),itemset.contextRef));
  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 ("String_Node_Str".equals(childName)) {
      String labelXpath=child.getAttributeValue("String_Node_Str","String_Node_Str");
      boolean labelItext=false;
      if (XFormUtils.showUnusedAttributeWarning(child,labelUA)) {
        System.out.println(XFormUtils.unusedAttWarning(child,labelUA));
      }
      if (labelXpath != null) {
        if (labelXpath.startsWith("String_Node_Str") && labelXpath.endsWith("String_Node_Str")) {
          labelXpath=labelXpath.substring("String_Node_Str".length(),labelXpath.indexOf("String_Node_Str"));
          labelItext=true;
        }
      }
 else {
        throw new XFormParseException("String_Node_Str");
      }
      XPathPathExpr labelPath=XPathReference.getPathExpr(labelXpath);
      itemset.labelRef=FormInstance.unpackReference(getAbsRef(new XPathReference(labelPath),itemset.nodesetRef));
      itemset.labelExpr=new XPathConditional(labelPath);
      itemset.labelIsItext=labelItext;
    }
 else     if ("String_Node_Str".equals(childName)) {
      String copyRef=child.getAttributeValue("String_Node_Str","String_Node_Str");
      if (XFormUtils.showUnusedAttributeWarning(child,copyUA)) {
        System.out.println(XFormUtils.unusedAttWarning(child,copyUA));
      }
      if (copyRef == null) {
        throw new XFormParseException("String_Node_Str");
      }
      itemset.copyRef=FormInstance.unpackReference(getAbsRef(new XPathReference(copyRef),itemset.nodesetRef));
      itemset.copyMode=true;
    }
 else     if ("String_Node_Str".equals(childName)) {
      String valueXpath=child.getAttributeValue("String_Node_Str","String_Node_Str");
      if (XFormUtils.showUnusedAttributeWarning(child,valueUA)) {
        System.out.println(XFormUtils.unusedAttWarning(child,valueUA));
      }
      if (valueXpath == null) {
        throw new XFormParseException("String_Node_Str");
      }
      XPathPathExpr valuePath=XPathReference.getPathExpr(valueXpath);
      itemset.valueRef=FormInstance.unpackReference(getAbsRef(new XPathReference(valuePath),itemset.nodesetRef));
      itemset.valueExpr=new XPathConditional(valuePath);
      itemset.copyMode=false;
    }
  }
  if (itemset.labelRef == null) {
    throw new XFormParseException("String_Node_Str");
  }
 else   if (itemset.copyRef == null && itemset.valueRef == null) {
    throw new XFormParseException("String_Node_Str");
  }
  if (itemset.copyRef != null) {
    if (itemset.valueRef == null) {
      System.err.println("String_Node_Str");
    }
 else     if (!itemset.copyRef.isParentOf(itemset.valueRef,false)) {
      throw new XFormParseException("String_Node_Str");
    }
  }
  q.setDynamicChoices(itemset);
  itemsets.addElement(itemset);
  if (XFormUtils.showUnusedAttributeWarning(e,usedAtts)) {
    System.out.println(XFormUtils.unusedAttWarning(e,usedAtts));
  }
}