Program: 17967
Project: 17967
Buggy source:
@Override public QueryNode createQNode(AqpANTLRNode node) throws QueryNodeException {
  String label=node.getTokenLabel();
  if (label.equals("String_Node_Str")) {
    List<QueryNode> children=node.getChildren();
    ArrayList<String> vals=new ArrayList<String>();
    QueryConfigHandler config=getQueryConfigHandler();
    String dummy=config.get(AqpAdsabsQueryConfigHandler.ConfigurationKeys.DUMMY_VALUE);
    QueryNode targetNode=null;
    QueryNode valueNode=null;
    OriginalInput input;
    OriginalInput lastInput=null;
    for (    QueryNode child : children) {
      AqpANTLRNode fldNode=((AqpANTLRNode)child).findChild("String_Node_Str");
      QueryNode valNode=fldNode.getChildren().get(fldNode.getChildren().size() - 1);
      input=getOriginalInput((AqpANTLRNode)valNode,null);
      if (!dummy.equals(input.value)) {
        if (lastInput != null) {
          if (lastInput.end + 2 == input.start) {
            vals.add("String_Node_Str");
          }
 else {
            vals.add("String_Node_Str");
          }
        }
        vals.add(input.value);
        lastInput=input;
        if (targetNode == null) {
          targetNode=child;
          valueNode=valNode;
        }
      }
    }
    StringBuilder sb=new StringBuilder();
    for (    String v : vals) {
      sb.append(v);
    }
    if (targetNode == null) {
      throw new ParseException(new MessageImpl("String_Node_Str"));
    }
    modifyTargetNode(valueNode,sb.toString());
    return targetNode;
  }
  return super.createQNode(node);
}

Fixed version (ground truth):
@Override public QueryNode createQNode(AqpANTLRNode node) throws QueryNodeException {
  String label=node.getTokenLabel();
  if (label.equals("String_Node_Str")) {
    List<QueryNode> children=node.getChildren();
    ArrayList<String> vals=new ArrayList<String>();
    QueryConfigHandler config=getQueryConfigHandler();
    String dummy=config.get(AqpAdsabsQueryConfigHandler.ConfigurationKeys.DUMMY_VALUE);
    QueryNode targetNode=null;
    QueryNode valueNode=null;
    OriginalInput input;
    OriginalInput lastInput=null;
    for (    QueryNode child : children) {
      AqpANTLRNode fldNode=((AqpANTLRNode)child).findChild("String_Node_Str");
      QueryNode valNode=fldNode.getChildren().get(fldNode.getChildren().size() - 1);
      if (!(valNode instanceof AqpANTLRNode)) {
        return super.createQNode(node);
      }
      input=getOriginalInput((AqpANTLRNode)valNode,null);
      if (!dummy.equals(input.value)) {
        if (lastInput != null) {
          if (lastInput.end + 2 == input.start) {
            vals.add("String_Node_Str");
          }
 else {
            vals.add("String_Node_Str");
          }
        }
        vals.add(input.value);
        lastInput=input;
        if (targetNode == null) {
          targetNode=child;
          valueNode=valNode;
        }
      }
    }
    StringBuilder sb=new StringBuilder();
    for (    String v : vals) {
      sb.append(v);
    }
    if (targetNode == null) {
      throw new ParseException(new MessageImpl("String_Node_Str"));
    }
    modifyTargetNode(valueNode,sb.toString());
    return targetNode;
  }
  return super.createQNode(node);
}