Program: 8997
Project: 8997
Buggy source:
private List<RDBRow> dbQuery(Connection connection,String tableName,String minId,String maxId,String indexedProperty,long startValue,int limit) throws SQLException {
  String t="String_Node_Str" + tableName + "String_Node_Str";
  if (indexedProperty != null) {
    if (MODIFIED.equals(indexedProperty)) {
      t+="String_Node_Str";
    }
 else     if (NodeDocument.HAS_BINARY_FLAG.equals(indexedProperty)) {
      if (startValue != NodeDocument.HAS_BINARY_VAL) {
        throw new DocumentStoreException("String_Node_Str" + NodeDocument.HAS_BINARY_FLAG);
      }
      t+="String_Node_Str";
    }
  }
  t+="String_Node_Str";
  if (limit != Integer.MAX_VALUE) {
    t+=this.needsConcat ? ("String_Node_Str" + limit) : ("String_Node_Str" + limit + "String_Node_Str");
  }
  PreparedStatement stmt=connection.prepareStatement(t);
  List<RDBRow> result=new ArrayList<RDBRow>();
  try {
    int si=1;
    stmt.setString(si++,minId);
    stmt.setString(si++,maxId);
    if (MODIFIED.equals(indexedProperty)) {
      stmt.setLong(si++,startValue);
    }
    if (limit != Integer.MAX_VALUE) {
      stmt.setFetchSize(limit);
    }
    ResultSet rs=stmt.executeQuery();
    while (rs.next() && result.size() < limit) {
      String id=rs.getString(1);
      if (id.compareTo(minId) < 0 || id.compareTo(maxId) > 0) {
        throw new DocumentStoreException("String_Node_Str" + minId + "String_Node_Str"+ id+ "String_Node_Str"+ maxId+ "String_Node_Str");
      }
      long modified=rs.getLong(2);
      long modcount=rs.getLong(3);
      String data=rs.getString(4);
      byte[] bdata=rs.getBytes(5);
      result.add(new RDBRow(id,modified,modcount,data,bdata));
    }
  }
  finally {
    stmt.close();
  }
  return result;
}

Fixed version (ground truth):
private List<RDBRow> dbQuery(Connection connection,String tableName,String minId,String maxId,String indexedProperty,long startValue,int limit) throws SQLException {
  String t="String_Node_Str" + tableName + "String_Node_Str";
  if (indexedProperty != null) {
    if (MODIFIED.equals(indexedProperty)) {
      t+="String_Node_Str";
    }
 else     if (NodeDocument.HAS_BINARY_FLAG.equals(indexedProperty)) {
      if (startValue != NodeDocument.HAS_BINARY_VAL) {
        throw new DocumentStoreException("String_Node_Str" + NodeDocument.HAS_BINARY_FLAG);
      }
      t+="String_Node_Str";
    }
  }
  t+="String_Node_Str";
  if (limit != Integer.MAX_VALUE) {
    t+=this.needsLimit ? ("String_Node_Str" + limit) : ("String_Node_Str" + limit + "String_Node_Str");
  }
  PreparedStatement stmt=connection.prepareStatement(t);
  List<RDBRow> result=new ArrayList<RDBRow>();
  try {
    int si=1;
    stmt.setString(si++,minId);
    stmt.setString(si++,maxId);
    if (MODIFIED.equals(indexedProperty)) {
      stmt.setLong(si++,startValue);
    }
    if (limit != Integer.MAX_VALUE) {
      stmt.setFetchSize(limit);
    }
    ResultSet rs=stmt.executeQuery();
    while (rs.next() && result.size() < limit) {
      String id=rs.getString(1);
      if (id.compareTo(minId) < 0 || id.compareTo(maxId) > 0) {
        throw new DocumentStoreException("String_Node_Str" + minId + "String_Node_Str"+ id+ "String_Node_Str"+ maxId+ "String_Node_Str");
      }
      long modified=rs.getLong(2);
      long modcount=rs.getLong(3);
      String data=rs.getString(4);
      byte[] bdata=rs.getBytes(5);
      result.add(new RDBRow(id,modified,modcount,data,bdata));
    }
  }
  finally {
    stmt.close();
  }
  return result;
}