Program: 29238
Project: 29238
Buggy source:
@Override public boolean contains(AtomicEvent atomicEvent,ConditionExecutor conditionExecutor){
  PredicateTreeNode predicate=null;
  if (bloomFiltersEnabled) {
    predicate=conditionExecutor.constructPredicate(atomicEvent,tableDefinition,new SQLPredicateBuilder());
    ArrayList tokenList=new ArrayList();
    predicate.populateTokens(tokenList);
    for (int ops=1; ops < tokenList.size() - 1; ops++) {
      if (tokenList.get(ops).toString().startsWith("String_Node_Str") && tokenList.get(ops).toString().replaceFirst("String_Node_Str","String_Node_Str").trim().equals("String_Node_Str")) {
        String param=tokenList.get(ops - 1).toString();
        String value=tokenList.get(ops + 1).toString();
        if (!param.startsWith("String_Node_Str")) {
          param=value.replaceFirst("String_Node_Str","String_Node_Str").trim();
          value=tokenList.get(ops - 1).toString().replaceFirst("String_Node_Str","String_Node_Str").trim();
        }
 else {
          param=param.replaceFirst("String_Node_Str","String_Node_Str").trim();
          value=value.replaceFirst("String_Node_Str","String_Node_Str").trim();
        }
        for (int i=0; i < attributeList.size(); i++) {
          if (attributeList.get(i).getName().equals(param)) {
            boolean mightContain=bloomFilters[i].mightContain(value.getBytes());
            if (!mightContain) {
              return false;
            }
          }
        }
      }
    }
  }
  if ((cachedTable != null) && cachedTable.contains(atomicEvent,conditionExecutor)) {
    return true;
  }
 else {
    Connection con=null;
    PreparedStatement statement=null;
    try {
      if (predicate == null) {
        predicate=conditionExecutor.constructPredicate(atomicEvent,tableDefinition,new SQLPredicateBuilder());
      }
      con=dataSource.getConnection();
      statement=con.prepareStatement("String_Node_Str" + fullTableName + "String_Node_Str"+ predicate.buildPredicateString()+ "String_Node_Str");
      ArrayList paramList=new ArrayList();
      predicate.populateParameters(paramList);
      for (int i=0; i < paramList.size(); i++) {
        populateStatement(statement,i + 1,paramList.get(i));
      }
      ResultSet resultSet=statement.executeQuery();
      boolean contains=false;
      long timestamp=System.currentTimeMillis();
      while (resultSet.next()) {
        contains=true;
        if (cachedTable != null) {
          Object[] data=new Object[attributeList.size()];
          for (int i=0; i < attributeList.size(); i++) {
switch (attributeList.get(i).getType()) {
case BOOL:
              data[i]=resultSet.getBoolean(attributeList.get(i).getName());
            break;
case DOUBLE:
          data[i]=resultSet.getDouble(attributeList.get(i).getName());
        break;
case FLOAT:
      data[i]=resultSet.getFloat(attributeList.get(i).getName());
    break;
case INT:
  data[i]=resultSet.getInt(attributeList.get(i).getName());
break;
case LONG:
data[i]=resultSet.getLong(attributeList.get(i).getName());
break;
case STRING:
data[i]=resultSet.getString(attributeList.get(i).getName());
break;
default :
data[i]=resultSet.getObject(attributeList.get(i).getName());
}
}
Event event=new InEvent(tableDefinition.getExternalTable().getParameter(PARAM_TABLE_NAME),timestamp,data);
cachedTable.add(event);
}
 else {
break;
}
}
resultSet.close();
return contains;
}
 catch (SQLException e) {
log.error("String_Node_Str" + tableDefinition.getExternalTable().getParameter(PARAM_TABLE_NAME),e);
}
 finally {
cleanUpConnections(statement,con);
}
return false;
}
}

Fixed version (ground truth):
@Override public boolean contains(AtomicEvent atomicEvent,ConditionExecutor conditionExecutor){
  PredicateTreeNode predicate=null;
  if (bloomFiltersEnabled) {
    predicate=conditionExecutor.constructPredicate(atomicEvent,tableDefinition,new SQLPredicateBuilder());
    ArrayList tokenList=new ArrayList();
    predicate.populateTokens(tokenList);
    for (int ops=1; ops < tokenList.size() - 1; ops++) {
      if (tokenList.get(ops).toString().startsWith("String_Node_Str") && tokenList.get(ops).toString().replaceFirst("String_Node_Str","String_Node_Str").trim().equals("String_Node_Str")) {
        String param=tokenList.get(ops - 1).toString();
        String value=tokenList.get(ops + 1).toString();
        if (!param.startsWith("String_Node_Str")) {
          param=value.replaceFirst("String_Node_Str","String_Node_Str").trim();
          value=tokenList.get(ops - 1).toString().replaceFirst("String_Node_Str","String_Node_Str").trim();
        }
 else {
          param=param.replaceFirst("String_Node_Str","String_Node_Str").trim();
          value=value.replaceFirst("String_Node_Str","String_Node_Str").trim();
        }
        for (int i=0; i < attributeList.size(); i++) {
          if (attributeList.get(i).getName().equals(param)) {
            boolean mightContain=bloomFilters[i].mightContain(value.getBytes());
            if (!mightContain) {
              return false;
            }
          }
        }
      }
    }
  }
  if ((cachedTable != null) && cachedTable.contains(atomicEvent,conditionExecutor)) {
    return true;
  }
 else {
    Connection con=null;
    PreparedStatement statement=null;
    try {
      if (predicate == null) {
        predicate=conditionExecutor.constructPredicate(atomicEvent,tableDefinition,new SQLPredicateBuilder());
      }
      if (dataSource != null) {
        con=dataSource.getConnection();
        statement=con.prepareStatement("String_Node_Str" + fullTableName + "String_Node_Str"+ predicate.buildPredicateString()+ "String_Node_Str");
        ArrayList paramList=new ArrayList();
        predicate.populateParameters(paramList);
        for (int i=0; i < paramList.size(); i++) {
          populateStatement(statement,i + 1,paramList.get(i));
        }
        ResultSet resultSet=statement.executeQuery();
        boolean contains=false;
        long timestamp=System.currentTimeMillis();
        while (resultSet.next()) {
          contains=true;
          if (cachedTable != null) {
            Object[] data=new Object[attributeList.size()];
            for (int i=0; i < attributeList.size(); i++) {
switch (attributeList.get(i).getType()) {
case BOOL:
                data[i]=resultSet.getBoolean(attributeList.get(i).getName());
              break;
case DOUBLE:
            data[i]=resultSet.getDouble(attributeList.get(i).getName());
          break;
case FLOAT:
        data[i]=resultSet.getFloat(attributeList.get(i).getName());
      break;
case INT:
    data[i]=resultSet.getInt(attributeList.get(i).getName());
  break;
case LONG:
data[i]=resultSet.getLong(attributeList.get(i).getName());
break;
case STRING:
data[i]=resultSet.getString(attributeList.get(i).getName());
break;
default :
data[i]=resultSet.getObject(attributeList.get(i).getName());
}
}
Event event=new InEvent(tableDefinition.getExternalTable().getParameter(PARAM_TABLE_NAME),timestamp,data);
cachedTable.add(event);
}
 else {
break;
}
}
resultSet.close();
return contains;
}
 else {
log.error("String_Node_Str");
return false;
}
}
 catch (SQLException e) {
log.error("String_Node_Str" + tableDefinition.getExternalTable().getParameter(PARAM_TABLE_NAME),e);
}
 finally {
cleanUpConnections(statement,con);
}
return false;
}
}