nus-yam/ex-repair huggingface dataset:
Program: 38671
Project: 38671
Buggy source:
@Override public int compare(TransactorMetricElement a,TransactorMetricElement b){
  if (a.getAverageExecutionTime() >= b.getAverageExecutionTime()) {
    return 1;
  }
 else {
    return -1;
  }
}

Fixed version (ground truth):
@Override public int compare(TransactorMetricElement a,TransactorMetricElement b){
  if (a.getAverageExecutionTime() >= b.getAverageExecutionTime()) {
    return -1;
  }
 else {
    return 1;
  }
}
Program: 38672
Project: 38672
Buggy source:
public synchronized void addExecution(long executionTime){
  count+=1;
  totalExecutionTime+=executionTime;
}

Fixed version (ground truth):
public void addExecution(long executionTime){
  count+=1;
  totalExecutionTime+=executionTime;
}
Program: 38673
Project: 38673
Buggy source:
synchronized void update(long executionTime,StackTraceElement queryStackTrace){
  if (longestQueriesMap.containsKey(queryStackTrace)) {
    TransactorMetricElement query=longestQueriesMap.get(queryStackTrace);
    longestQueries.remove(query);
    query.addExecution(executionTime);
    longestQueries.add(query);
  }
 else {
    TransactorMetricElement newQuery=new TransactorMetricElement(queryStackTrace,executionTime);
    if (longestQueriesMap.size() < longestQueriesSize) {
      longestQueriesMap.put(queryStackTrace,newQuery);
      longestQueries.add(newQuery);
    }
 else     if (queryComparator.compare(newQuery,longestQueries.peek()) > 0) {
      TransactorMetricElement removedQuery=longestQueries.poll();
      longestQueriesMap.remove(removedQuery.getQueryTrace());
      longestQueriesMap.put(newQuery.getQueryTrace(),newQuery);
      longestQueries.add(newQuery);
    }
  }
}

Fixed version (ground truth):
void update(long executionTime,StackTraceElement queryStackTrace){
  if (longestQueriesMap.containsKey(queryStackTrace)) {
    TransactorMetricElement query=longestQueriesMap.get(queryStackTrace);
    longestQueries.remove(query);
    query.addExecution(executionTime);
    longestQueries.add(query);
  }
 else {
    TransactorMetricElement newQuery=new TransactorMetricElement(queryStackTrace,executionTime);
    if (longestQueriesMap.size() < longestQueriesSize) {
      longestQueriesMap.put(queryStackTrace,newQuery);
      longestQueries.add(newQuery);
    }
 else     if (queryComparator.compare(newQuery,longestQueries.peek()) > 0) {
      TransactorMetricElement removedQuery=longestQueries.poll();
      longestQueriesMap.remove(removedQuery.getQueryTrace());
      longestQueriesMap.put(newQuery.getQueryTrace(),newQuery);
      longestQueries.add(newQuery);
    }
  }
}
Program: 38674
Project: 38674
Buggy source:
TransactorMetricsImpl(int longestQueriesSize){
  this.longestQueriesSize=longestQueriesSize;
  this.longestQueriesMap=new HashMap<>();
  this.queryComparator=new TransactorMetricElementsComparator().reversed();
  this.longestQueries=new PriorityQueue<>(longestQueriesSize,queryComparator);
}

Fixed version (ground truth):
TransactorMetricsImpl(int longestQueriesSize){
  this.longestQueriesSize=longestQueriesSize;
  this.longestQueriesMap=new HashMap<>();
  this.longestQueries=new PriorityQueue<>(longestQueriesSize,queryComparator);
}
Program: 38675
Project: 38675
Buggy source:
@Test public void testTotalQueries() throws Exception {
  TransactorImpl<IDatabase1> transactor=transactorBuilder.get();
  transactor.execute(db -> {
  }
);
  DbMetrics dbMetrics=transactor.getDbMetrics();
  assert(dbMetrics.getTotalQueries() == 1);
}

Fixed version (ground truth):
@Test public void testTotalQueries() throws Exception {
  TransactorImpl<IDatabase1> transactor=transactorBuilder.get();
  transactor.execute(db -> {
  }
);
  DbMetrics dbMetrics=transactor.getDbMetrics();
  assertTrue(dbMetrics.getTotalQueries() == 1);
}
Program: 38676
Project: 38676
Buggy source:
@Test public void testAverageIdleConnections() throws Exception {
  TransactorImpl<IDatabase1> transactor=transactorBuilder.setMaxTotalConnections(2).setMinIdleConnections(1).setKeepAliveTime(Duration.millis(50)).get();
  transactor.execute(a -> {
    sleepMillis(100);
  }
);
  long startIdleTime=stopwatch.elapsedMillis();
  sleepMillis(100);
  long idleTime=stopwatch.elapsedMillis() - startIdleTime;
  DbMetrics dbMetrics=transactor.getDbMetrics();
  long lifeTime=dbMetrics.getLifeTime();
  double expectedAverageIdleConnections=(double)idleTime / (double)lifeTime;
  double averageIdleConnectionsMaxValue=dbMetrics.getAverageIdleConnectionsMaxValue();
  double averageIdleConnectionsMinValue=dbMetrics.getAverageIdleConnectionsMinValue();
  transactor.close();
  assert((expectedAverageIdleConnections - .1 <= averageIdleConnectionsMaxValue) && (expectedAverageIdleConnections + .1 >= averageIdleConnectionsMinValue));
}

Fixed version (ground truth):
@Test public void testAverageIdleConnections() throws Exception {
  TransactorImpl<IDatabase1> transactor=transactorBuilder.setMaxTotalConnections(2).setMinIdleConnections(1).setKeepAliveTime(Duration.millis(50)).get();
  transactor.execute(a -> {
    sleepMillis(100);
  }
);
  long startIdleTime=stopwatch.elapsedMillis();
  sleepMillis(100);
  long idleTime=stopwatch.elapsedMillis() - startIdleTime;
  DbMetrics dbMetrics=transactor.getDbMetrics();
  long lifeTime=dbMetrics.getLifeTime();
  double expectedAverageIdleConnections=(double)idleTime / (double)lifeTime;
  double averageIdleConnectionsMaxValue=dbMetrics.getAverageIdleConnectionsMaxValue();
  double averageIdleConnectionsMinValue=dbMetrics.getAverageIdleConnectionsMinValue();
  transactor.close();
  assertTrue((expectedAverageIdleConnections - .1 <= averageIdleConnectionsMaxValue) && (expectedAverageIdleConnections + .1 >= averageIdleConnectionsMinValue));
}
Program: 38677
Project: 38677
Buggy source:
@After public void cleanup() throws Exception {
  executorService=null;
  stopwatch.reset();
}

Fixed version (ground truth):
@After public void cleanup() throws Exception {
  executorService.shutdown();
  stopwatch.reset();
}
Program: 38678
Project: 38678
Buggy source:
@Test public void testOpenedConnectionsNumber() throws Exception {
  executorService=Executors.newFixedThreadPool(5);
  TransactorImpl<IDatabase1> transactor=transactorBuilder.setMaxTotalConnections(2).get();
  Future future1=executorService.submit(() -> transactor.execute(a -> {
    sleepMillis(50);
  }
));
  Future future2=executorService.submit(() -> transactor.execute(a -> {
    sleepMillis(50);
  }
));
  Future future3=executorService.submit(() -> transactor.execute(a -> {
    sleepMillis(50);
  }
));
  future1.get();
  future2.get();
  future3.get();
  DbMetrics dbMetrics=transactor.getDbMetrics();
  double openedConnectionsNumber=dbMetrics.getOpenedConnectionsNumber();
  transactor.close();
  assert(openedConnectionsNumber == 2);
}

Fixed version (ground truth):
@Test public void testOpenedConnectionsNumber() throws Exception {
  executorService=Executors.newFixedThreadPool(5);
  TransactorImpl<IDatabase1> transactor=transactorBuilder.setMaxTotalConnections(2).get();
  Future future1=executorService.submit(() -> transactor.execute(a -> {
    sleepMillis(50);
  }
));
  Future future2=executorService.submit(() -> transactor.execute(a -> {
    sleepMillis(50);
  }
));
  Future future3=executorService.submit(() -> transactor.execute(a -> {
    sleepMillis(50);
  }
));
  future1.get();
  future2.get();
  future3.get();
  DbMetrics dbMetrics=transactor.getDbMetrics();
  double openedConnectionsNumber=dbMetrics.getOpenedConnectionsNumber();
  transactor.close();
  assertTrue(openedConnectionsNumber == 2);
}
Program: 38679
Project: 38679
Buggy source:
@Test public void testMaxConnectionWaitingTime() throws Exception {
  TransactorImpl<IDatabase1> transactor=transactorBuilder.setMaxTotalConnections(1).get();
  executorService=Executors.newFixedThreadPool(2);
  Future<Long> future1=executorService.submit(() -> transactor.query(a -> {
    sleepMillis(100);
    return stopwatch.elapsedMillis();
  }
));
  final Long[] startingTime2=new Long[1];
  Future future2=executorService.submit(() -> {
    startingTime2[0]=stopwatch.elapsedMillis();
    transactor.execute(a -> {
      sleepMillis(100);
    }
);
  }
);
  long finishingTime1=future1.get();
  future2.get();
  DbMetrics dbMetrics=transactor.getDbMetrics();
  double maxConnectionsWaitingTime=dbMetrics.getMaxConnectionWaitingTime();
  transactor.close();
  double expectedMaxConnectionsWaitingTime=(finishingTime1 - startingTime2[0]);
  expectedMaxConnectionsWaitingTime=(expectedMaxConnectionsWaitingTime > 0) ? expectedMaxConnectionsWaitingTime : 0;
  assertRoughEqual(maxConnectionsWaitingTime,expectedMaxConnectionsWaitingTime,20);
}

Fixed version (ground truth):
@Test public void testMaxConnectionWaitingTime() throws Exception {
  TransactorImpl<IDatabase1> transactor=transactorBuilder.setMaxTotalConnections(1).get();
  executorService=Executors.newFixedThreadPool(2);
  Future<Long> future1=executorService.submit(() -> transactor.query(a -> {
    sleepMillis(100);
    return stopwatch.elapsedMillis();
  }
));
  final Long[] startingTime2=new Long[1];
  Future future2=executorService.submit(() -> {
    startingTime2[0]=stopwatch.elapsedMillis();
    transactor.execute(a -> {
      sleepMillis(100);
    }
);
  }
);
  long finishingTime1=future1.get();
  future2.get();
  DbMetrics dbMetrics=transactor.getDbMetrics();
  double maxConnectionsWaitingTime=dbMetrics.getMaxConnectionWaitingTime();
  transactor.close();
  double expectedMaxConnectionsWaitingTime=finishingTime1 - startingTime2[0];
  expectedMaxConnectionsWaitingTime=(expectedMaxConnectionsWaitingTime > 0) ? expectedMaxConnectionsWaitingTime : 0;
  assertRoughEqual(maxConnectionsWaitingTime,expectedMaxConnectionsWaitingTime,20);
}
Program: 38680
Project: 38680
Buggy source:
@Test public void testQueryOrder() throws Exception {
  TransactorImpl<IDatabase1> transactor=transactorBuilder.get();
  transactor.execute(db -> {
    sleepMillis(200);
  }
);
  transactor.execute(db -> {
    sleepMillis(100);
  }
);
  transactor.execute(db -> {
  }
);
  TransactorMetrics queryMetrics=transactor.getQueryMetrics();
  int lastLine=0;
  transactor.close();
  for (  TransactorMetricElement query : queryMetrics.getLongestQueries()) {
    assert(query.getQueryTrace().getLineNumber() > lastLine);
    lastLine=query.getQueryTrace().getLineNumber();
  }
  transactor.close();
}

Fixed version (ground truth):
@Test public void testQueryOrder() throws Exception {
  TransactorImpl<IDatabase1> transactor=transactorBuilder.get();
  transactor.execute(db -> {
    sleepMillis(200);
  }
);
  transactor.execute(db -> {
    sleepMillis(100);
  }
);
  transactor.execute(db -> {
  }
);
  TransactorMetrics queryMetrics=transactor.getQueryMetrics();
  int lastLine=0;
  transactor.close();
  for (  TransactorMetricElement query : queryMetrics.getLongestQueries()) {
    assertTrue(query.getQueryTrace().getLineNumber() > lastLine);
    lastLine=query.getQueryTrace().getLineNumber();
  }
  transactor.close();
}
Program: 38681
Project: 38681
Buggy source:
@After public void cleanup() throws Exception {
  executorService=null;
  stopwatch.reset();
}

Fixed version (ground truth):
@After public void cleanup() throws Exception {
  executorService.shutdown();
  stopwatch.reset();
}
Program: 38682
Project: 38682
Buggy source:
public static String envVar(String property){
  return envVar(property,"String_Node_Str");
}

Fixed version (ground truth):
public static String envVar(String property){
  return property.replace('.','_').toUpperCase();
}
Program: 38683
Project: 38683
Buggy source:
public T get(){
  if (persistence == null) {
synchronized (this) {
      this.persistence=build(conn,databases);
    }
  }
  if (disableCaching) {
    persistence.disableCaching();
  }
  return persistence;
}

Fixed version (ground truth):
public T get(){
  if (persistence == null) {
synchronized (this) {
      if (persistence == null) {
        this.persistence=build(conn,databases);
      }
    }
  }
  if (disableCaching) {
    persistence.disableCaching();
  }
  return persistence;
}
Program: 38684
Project: 38684
Buggy source:
public Between(V value1,V value2){
  super("String_Node_Str");
  if (!(value1 instanceof Column)) {
    this.parameters.add(value1);
  }
 else {
    this.sqlStatement=StringUtils.replaceOnce(this.sqlStatement,"String_Node_Str",((Column)value2).getSqlKeyword());
  }
  if (!(value2 instanceof Column)) {
    this.parameters.add(value2);
  }
 else {
    this.sqlStatement=StringUtils.replaceOnce(this.sqlStatement,"String_Node_Str","String_Node_Str" + ((Column)value2).getSqlKeyword());
  }
  ensureNoNullParameter();
}

Fixed version (ground truth):
public Between(V value1,V value2){
  super("String_Node_Str");
  if (!(value1 instanceof Column)) {
    this.parameters.add(value1);
  }
 else {
    this.sqlStatement=StringUtils.replaceOnce(this.sqlStatement,"String_Node_Str",((Column)value1).getSqlKeyword());
  }
  if (!(value2 instanceof Column)) {
    this.parameters.add(value2);
  }
 else {
    this.sqlStatement=StringUtils.replaceOnce(this.sqlStatement,"String_Node_Str","String_Node_Str" + ((Column)value2).getSqlKeyword());
  }
  ensureNoNullParameter();
}
Program: 38685
Project: 38685
Buggy source:
protected AbstractTable(String table,String alias){
  Preconditions.checkArgument(Strings.isNullOrEmpty(table),"String_Node_Str");
  Preconditions.checkArgument(Strings.isNullOrEmpty(alias),"String_Node_Str");
  this.table=table;
  this.alias=alias;
  this.allColumns=Sets.newHashSet();
}

Fixed version (ground truth):
protected AbstractTable(String table,String alias){
  Preconditions.checkArgument(!Strings.isNullOrEmpty(table),"String_Node_Str");
  Preconditions.checkArgument(!Strings.isNullOrEmpty(alias),"String_Node_Str");
  this.table=table;
  this.alias=alias;
  this.allColumns=Sets.newHashSet();
}
Program: 38686
Project: 38686
Buggy source:
public String getSqlKeyword(){
  String fieldKeyword=field != null ? field.toString() : DEFAULT_ID_FIELD;
  if (model != null) {
    return Utility.getTableNameFromModel(model) + "String_Node_Str" + fieldKeyword;
  }
 else {
    return fieldKeyword;
  }
}

Fixed version (ground truth):
public String getSqlKeyword(){
  String fieldKeyword=field != null ? field.toString() : DEFAULT_ID_FIELD;
  if (model != null) {
    return Utility.getTableName(model) + "String_Node_Str" + fieldKeyword;
  }
 else {
    return fieldKeyword;
  }
}
Program: 38687
Project: 38687
Buggy source:
private String getSelectClause(){
  StringBuilder clause=new StringBuilder("String_Node_Str");
  if (selectedIModelFields.isEmpty()) {
    clause.append("String_Node_Str");
  }
 else {
    Iterator<ModelField> it=selectedIModelFields.iterator();
    while (it.hasNext()) {
      clause.append(it.next().getSqlKeyword());
      if (it.hasNext()) {
        clause.append("String_Node_Str");
      }
    }
  }
  String tableName=Utility.getTableNameFromModel(mainModel);
  return clause.append("String_Node_Str").append(tableName).append("String_Node_Str").toString();
}

Fixed version (ground truth):
private String getSelectClause(){
  StringBuilder clause=new StringBuilder("String_Node_Str");
  if (selectedIModelFields.isEmpty()) {
    clause.append("String_Node_Str");
  }
 else {
    Iterator<ModelField> it=selectedIModelFields.iterator();
    while (it.hasNext()) {
      clause.append(it.next().getSqlKeyword());
      if (it.hasNext()) {
        clause.append("String_Node_Str");
      }
    }
  }
  String tableName=Utility.getTableName(mainModel);
  return clause.append("String_Node_Str").append(tableName).append("String_Node_Str").toString();
}
Program: 38688
Project: 38688
Buggy source:
@Override public String getSqlStatement(){
  String tableName=Utility.getTableNameFromModel(model);
  return joinType.getSqlKeyword() + "String_Node_Str" + tableName+ "String_Node_Str"+ modelField1.getSqlKeyword()+ "String_Node_Str"+ modelField2.getSqlKeyword();
}

Fixed version (ground truth):
@Override public String getSqlStatement(){
  String tableName=Utility.getTableName(model);
  return joinType.getSqlKeyword() + "String_Node_Str" + tableName+ "String_Node_Str"+ modelField1.getSqlKeyword()+ "String_Node_Str"+ modelField2.getSqlKeyword();
}
Program: 38689
Project: 38689
Buggy source:
private GenericQuery(BaseDatabaseConnection dbConnection){
  this.dbConnection=dbConnection;
  this.mainModel=null;
  this.joinConditions=Lists.newArrayList();
  this.whereConstraints=Lists.newArrayList();
  this.orderCriteria=Sets.newHashSet();
  this.selectedIModelFields=Sets.newHashSet();
  this.limitCondition=Optional.absent();
}

Fixed version (ground truth):
private GenericQuery(BaseDatabaseConnection dbConnection){
  this.dbConnection=dbConnection;
  this.mainModel=null;
  this.joinConditions=Lists.newArrayList();
  this.whereConstraints=Lists.newArrayList();
  this.orderCriteria=Lists.newArrayList();
  this.selectedIModelFields=Sets.newHashSet();
  this.limitCondition=Optional.absent();
}
Program: 38690
Project: 38690
Buggy source:
public GenericQueryBuilder or(Column column,IWhereOperator<Object> operator){
  genericQuery.addWhereCondition(new WhereConstraint<Object>(column,operator,WhereConstraint.Logic.OR));
  return this;
}

Fixed version (ground truth):
public GenericQueryBuilder or(Column column,IWhereOperator operator){
  genericQuery.addWhereCondition(new WhereConstraint(column,operator,WhereConstraint.Logic.OR));
  return this;
}
Program: 38691
Project: 38691
Buggy source:
public GenericQueryBuilder and(Column column,IWhereOperator<Object> operator){
  genericQuery.addWhereCondition(new WhereConstraint<Object>(column,operator,WhereConstraint.Logic.AND));
  return this;
}

Fixed version (ground truth):
public GenericQueryBuilder and(Column column,IWhereOperator operator){
  genericQuery.addWhereCondition(new WhereConstraint(column,operator,WhereConstraint.Logic.AND));
  return this;
}
Program: 38692
Project: 38692
Buggy source:
public GenericQueryBuilder where(Column column,IWhereOperator<Object> operator){
  genericQuery.addWhereCondition(new WhereConstraint<Object>(column,operator,null));
  return this;
}

Fixed version (ground truth):
public GenericQueryBuilder where(Column column,IWhereOperator operator){
  genericQuery.addWhereCondition(new WhereConstraint(column,operator,null));
  return this;
}
Program: 38693
Project: 38693
Buggy source:
@Override public String getSqlStatement(){
  return (logic.isPresent() ? logic.toString() + "String_Node_Str" : "String_Node_Str") + column.getSqlKeyword() + "String_Node_Str"+ operator.getSqlStatement();
}

Fixed version (ground truth):
@Override public String getSqlStatement(){
  return (logic.isPresent() ? logic.get().toString() + "String_Node_Str" : "String_Node_Str") + column.getSqlKeyword() + "String_Node_Str"+ operator.getSqlStatement();
}
Program: 38694
Project: 38694
Buggy source:
public boolean isOnlyIdQuery(){
  return whereConstraints.isEmpty() && selectedFields.isEmpty() && orderCriteria.isEmpty()&& limitCriterion == null;
}

Fixed version (ground truth):
public boolean isOnlyIdQuery(){
  return whereConstraints.isEmpty() && selectedFields.isEmpty() && orderCriteria.isEmpty()&& !limitCriterion.isPresent();
}
Program: 38695
Project: 38695
Buggy source:
@Override public String getSqlStatement(){
  return "String_Node_Str" + Utility.getTableName(model) + "String_Node_Str"+ modelField1.getSqlKeyword()+ "String_Node_Str"+ modelField2.getSqlKeyword();
}

Fixed version (ground truth):
@Override public String getSqlStatement(){
  return joinType.getSqlKeyword() + "String_Node_Str" + Utility.getTableName(model)+ "String_Node_Str"+ modelField1.getSqlKeyword()+ "String_Node_Str"+ modelField2.getSqlKeyword();
}
Program: 38696
Project: 38696
Buggy source:
public JoinCondition(Class<? extends ModelWithId> model,ModelField modelField1,ModelField modelField2){
  this.model=model;
  this.modelField1=modelField1;
  this.modelField2=modelField2;
}

Fixed version (ground truth):
public JoinCondition(JoinType joinType,Class<? extends ModelWithId> model,ModelField modelField1,ModelField modelField2){
  this.joinType=joinType;
  this.model=model;
  this.modelField1=modelField1;
  this.modelField2=modelField2;
}
Program: 38697
Project: 38697
Buggy source:
public static String getTableName(Class<? extends ModelWithId> model){
  return model.getSimpleName().toLowerCase() + "String_Node_Str";
}

Fixed version (ground truth):
public static String getTableName(Class<? extends ModelWithId> model){
  return CaseFormat.UPPER_CAMEL.to(CaseFormat.LOWER_UNDERSCORE,model.getSimpleName()) + "String_Node_Str";
}
Program: 38699
Project: 38699
Buggy source:
public String getSelectClause(){
  StringBuilder sqlClause=new StringBuilder("String_Node_Str");
  if (selectCriteria.isEmpty()) {
    sqlClause.append("String_Node_Str");
    return sqlClause.toString();
  }
  Iterator<SelectCriterion> it=selectCriteria.iterator();
  while (it.hasNext()) {
    sqlClause.append(it.next());
    if (it.hasNext()) {
      sqlClause.append("String_Node_Str");
    }
  }
  return sqlClause.toString();
}

Fixed version (ground truth):
public String getSelectClause(){
  StringBuilder sqlClause=new StringBuilder("String_Node_Str");
  if (selectCriteria.isEmpty()) {
    sqlClause.append("String_Node_Str");
    return sqlClause.toString();
  }
  Iterator<SelectCriterion> it=selectCriteria.iterator();
  while (it.hasNext()) {
    SelectCriterion selectCriterion=it.next();
    sqlClause.append(selectCriterion.getSqlClause());
    if (it.hasNext()) {
      sqlClause.append("String_Node_Str");
    }
  }
  return sqlClause.toString();
}
Program: 38700
Project: 38700
Buggy source:
protected Set<T> realFind(ModelQuery query) throws IOException {
  Set<T> foundSet=new HashSet<T>();
  List<WhereConstraint> constraints=query.getConstraints();
  Set<Long> ids=query.getIdSet();
  if (constraints == null || constraints.isEmpty()) {
    if (ids != null && !ids.isEmpty()) {
      return find(ids);
    }
    return foundSet;
  }
  for (  T record : records.values()) {
    boolean allMatch=true;
    for (    WhereConstraint constraint : constraints) {
      Enum field=constraint.getField();
      IQueryOperator operator=constraint.getOperator();
      allMatch=allMatch && operator.apply(record.getField(field.name()));
    }
    if (ids != null && !ids.isEmpty() && !ids.contains(record.getId())) {
      allMatch=false;
    }
    if (allMatch) {
      if (!query.getSelectCriteria().isEmpty()) {
        for (        Enum field : record.getFieldSet()) {
          if (!query.getSelectCriteria().contains(new SelectCriterion(field))) {
            record.setField(field.name(),null);
          }
        }
      }
      foundSet.add(record);
    }
  }
  return foundSet;
}

Fixed version (ground truth):
protected Set<T> realFind(ModelQuery query) throws IOException {
  Set<T> foundSet=new HashSet<T>();
  List<WhereConstraint> constraints=query.getConstraints();
  Set<Long> ids=query.getIdSet();
  if (constraints == null || constraints.isEmpty()) {
    if (ids != null && !ids.isEmpty()) {
      return find(ids);
    }
    return foundSet;
  }
  for (  T record : records.values()) {
    boolean allMatch=true;
    for (    WhereConstraint constraint : constraints) {
      Enum field=constraint.getField();
      IQueryOperator operator=constraint.getOperator();
      allMatch=allMatch && operator.apply(record.getField(field.name()));
    }
    if (ids != null && !ids.isEmpty() && !ids.contains(record.getId())) {
      allMatch=false;
    }
    if (allMatch) {
      if (!query.getSelectCriteria().isEmpty()) {
        for (        Enum field : record.getFieldSet()) {
          if (!query.getSelectCriteria().contains(new SelectCriterion(field))) {
            if (!isPrimitiveOrWrapped(record.getField(field.name()).getClass())) {
              record.setField(field.name(),null);
            }
          }
        }
      }
      foundSet.add(record);
    }
  }
  return foundSet;
}
Program: 38701
Project: 38701
Buggy source:
protected Set<T> realFind(Set<Long> ids,List<QueryConstraint> constraints) throws IOException {
  Set<T> foundSet=new HashSet<T>();
  if (constraints == null || constraints.isEmpty()) {
    if (ids != null && !ids.isEmpty()) {
      return find(ids);
    }
    return foundSet;
  }
  for (  T record : records.values()) {
    boolean allMatch=true;
    for (    QueryConstraint constraint : constraints) {
      Enum field=constraint.getField();
      IQueryOperator operator=constraint.getOperator();
      allMatch=allMatch && operator.apply(record.getField(field.name()));
    }
    if (ids != null && !ids.isEmpty() && !ids.contains(record.getId())) {
      allMatch=false;
    }
    if (allMatch) {
      foundSet.add(record);
    }
  }
  return foundSet;
}

Fixed version (ground truth):
protected Set<T> realFind(ModelQuery query) throws IOException {
  Set<T> foundSet=new HashSet<T>();
  List<QueryConstraint> constraints=query.getConstraints();
  Set<Long> ids=query.getIdSet();
  if (constraints == null || constraints.isEmpty()) {
    if (ids != null && !ids.isEmpty()) {
      return find(ids);
    }
    return foundSet;
  }
  for (  T record : records.values()) {
    boolean allMatch=true;
    for (    QueryConstraint constraint : constraints) {
      Enum field=constraint.getField();
      IQueryOperator operator=constraint.getOperator();
      allMatch=allMatch && operator.apply(record.getField(field.name()));
    }
    if (ids != null && !ids.isEmpty() && !ids.contains(record.getId())) {
      allMatch=false;
    }
    if (allMatch) {
      foundSet.add(record);
    }
  }
  return foundSet;
}
Program: 38703
Project: 38703
Buggy source:
public Set<Image> find(Set<Long> ids,List<QueryConstraint> constraints) throws IOException {
  Set<Image> foundSet=new HashSet<Image>();
  if (constraints == null || constraints.isEmpty()) {
    if (ids != null && !ids.isEmpty()) {
      return find(ids);
    }
    return foundSet;
  }
  StringBuilder statementString=new StringBuilder();
  statementString.append("String_Node_Str");
  Iterator<QueryConstraint> iter=constraints.iterator();
  while (iter.hasNext()) {
    QueryConstraint constraint=iter.next();
    Enum field=constraint.getField();
    IQueryOperator operator=constraint.getOperator();
    statementString.append(field).append(operator.getSqlStatement());
    if (iter.hasNext()) {
      statementString.append("String_Node_Str");
    }
  }
  if (ids != null && !ids.isEmpty())   statementString.append("String_Node_Str" + getIdSetCondition(ids));
  statementString.append("String_Node_Str");
  PreparedStatement preparedStatement=getPreparedStatement(statementString.toString());
  int index=0;
  for (  QueryConstraint constraint : constraints) {
    Image._Fields field=(Image._Fields)constraint.getField();
    for (    Object parameter : constraint.getParameters()) {
      if (parameter == null) {
        continue;
      }
      try {
switch (field) {
case user_id:
          preparedStatement.setInt(++index,(Integer)parameter);
        break;
    }
  }
 catch (  SQLException e) {
    throw new IOException(e);
  }
}
}
executeQuery(foundSet,preparedStatement);
return foundSet;
}

Fixed version (ground truth):
public Set<Image> find(ModelQuery query) throws IOException {
  Set<Image> foundSet=new HashSet<Image>();
  if (query.getConstraints() == null || query.getConstraints().isEmpty()) {
    Set<Long> ids=query.getIdSet();
    if (ids != null && !ids.isEmpty()) {
      return find(ids);
    }
    return foundSet;
  }
  StringBuilder statementString=new StringBuilder();
  statementString.append("String_Node_Str");
  statementString.append(query.getSqlStatement());
  statementString.append("String_Node_Str");
  PreparedStatement preparedStatement=getPreparedStatement(statementString.toString());
  int index=0;
  for (  QueryConstraint constraint : query.getConstraints()) {
    Image._Fields field=(Image._Fields)constraint.getField();
    for (    Object parameter : constraint.getParameters()) {
      if (parameter == null) {
        continue;
      }
      try {
switch (field) {
case user_id:
          preparedStatement.setInt(++index,(Integer)parameter);
        break;
    }
  }
 catch (  SQLException e) {
    throw new IOException(e);
  }
}
}
executeQuery(foundSet,preparedStatement);
return foundSet;
}
Program: 38706
Project: 38706
Buggy source:
public Set<Comment> find(Set<Long> ids,List<QueryConstraint> constraints) throws IOException {
  return super.realFind(ids,constraints);
}

Fixed version (ground truth):
public Set<Comment> find(ModelQuery query) throws IOException {
  return super.realFind(query);
}
Program: 38707
Project: 38707
Buggy source:
public Set<Image> find(Set<Long> ids,List<QueryConstraint> constraints) throws IOException {
  return super.realFind(ids,constraints);
}

Fixed version (ground truth):
public Set<Image> find(ModelQuery query) throws IOException {
  return super.realFind(query);
}
Program: 38708
Project: 38708
Buggy source:
public Set<Post> find(Set<Long> ids,List<QueryConstraint> constraints) throws IOException {
  return super.realFind(ids,constraints);
}

Fixed version (ground truth):
public Set<Post> find(ModelQuery query) throws IOException {
  return super.realFind(query);
}
Program: 38709
Project: 38709
Buggy source:
public Set<User> find(Set<Long> ids,List<QueryConstraint> constraints) throws IOException {
  return super.realFind(ids,constraints);
}

Fixed version (ground truth):
public Set<User> find(ModelQuery query) throws IOException {
  return super.realFind(query);
}
Program: 38710
Project: 38710
Buggy source:
protected Set<T> realFind(Set<Long> ids,List<QueryConstraint> constraints) throws IOException {
  Set<T> foundSet=new HashSet<T>();
  if (constraints == null || constraints.isEmpty()) {
    if (ids != null && !ids.isEmpty()) {
      return find(ids);
    }
    return foundSet;
  }
  for (  T record : records.values()) {
    boolean allMatch=true;
    for (    QueryConstraint constraint : constraints) {
      Enum field=constraint.getField();
      IQueryOperator operator=constraint.getOperator();
      allMatch=allMatch && operator.apply(record.getField(field.name()));
    }
    if (ids != null && !ids.contains(record.getId())) {
      allMatch=false;
    }
    if (allMatch) {
      foundSet.add(record);
    }
  }
  return foundSet;
}

Fixed version (ground truth):
protected Set<T> realFind(Set<Long> ids,List<QueryConstraint> constraints) throws IOException {
  Set<T> foundSet=new HashSet<T>();
  if (constraints == null || constraints.isEmpty()) {
    if (ids != null && !ids.isEmpty()) {
      return find(ids);
    }
    return foundSet;
  }
  for (  T record : records.values()) {
    boolean allMatch=true;
    for (    QueryConstraint constraint : constraints) {
      Enum field=constraint.getField();
      IQueryOperator operator=constraint.getOperator();
      allMatch=allMatch && operator.apply(record.getField(field.name()));
    }
    if (ids != null && !ids.isEmpty() && !ids.contains(record.getId())) {
      allMatch=false;
    }
    if (allMatch) {
      foundSet.add(record);
    }
  }
  return foundSet;
}
Program: 38711
Project: 38711
Buggy source:
private long handleRailsUpdatedAt(T model){
  if (model.hasField("String_Node_Str") && model.getField("String_Node_Str").getClass().equals(Long.class)) {
    long oldUpdatedAt=(Long)model.getField("String_Node_Str");
    model.setField("String_Node_Str",System.currentTimeMillis());
    return oldUpdatedAt;
  }
  return 0;
}

Fixed version (ground truth):
private long handleRailsUpdatedAt(T model){
  if (model.hasField("String_Node_Str")) {
    Object field=model.getField("String_Node_Str");
    if (field != null && field.getClass().equals(Long.class)) {
      long oldUpdatedAt=(Long)field;
      model.setField("String_Node_Str",System.currentTimeMillis());
      return oldUpdatedAt;
    }
  }
  return 0;
}
Program: 38712
Project: 38712
Buggy source:
@Override public boolean save(T model) throws IOException {
  if (model.isCreated()) {
    PreparedStatement saveStmt=getSaveStmt();
    try {
      setAttrs(model,saveStmt);
      saveStmt.execute();
      boolean success=saveStmt.getUpdateCount() == 1;
      saveStmt.close();
      if (success && useCache) {
        cachedById.put(model.getId(),model);
      }
      clearForeignKeyCache();
      return success;
    }
 catch (    SQLException e) {
      throw new IOException(e);
    }
  }
 else {
    PreparedStatement insertStmt=conn.getPreparedStatement(getInsertWithIdStatement(fieldNames));
    try {
      setAttrs(model,insertStmt);
      insertStmt.setLong(fieldNames.size() + 1,model.getId());
      insertStmt.execute();
      boolean success=insertStmt.getUpdateCount() == 1;
      insertStmt.close();
      if (success && useCache) {
        cachedById.put(model.getId(),model);
      }
      clearForeignKeyCache();
      return success;
    }
 catch (    SQLException e) {
      throw new IOException(e);
    }
  }
}

Fixed version (ground truth):
@Override public boolean save(T model) throws IOException {
  if (model.isCreated()) {
    PreparedStatement saveStmt=getSaveStmt();
    try {
      setAttrs(model,saveStmt);
      saveStmt.execute();
      boolean success=saveStmt.getUpdateCount() == 1;
      saveStmt.close();
      if (success && useCache) {
        cachedById.put(model.getId(),model);
      }
      clearForeignKeyCache();
      return success;
    }
 catch (    SQLException e) {
      throw new IOException(e);
    }
  }
 else {
    PreparedStatement insertStmt=conn.getPreparedStatement(getInsertWithIdStatement(fieldNames));
    try {
      setAttrs(model,insertStmt);
      insertStmt.setLong(fieldNames.size() + 1,model.getId());
      insertStmt.execute();
      boolean success=insertStmt.getUpdateCount() == 1;
      insertStmt.close();
      if (success && useCache) {
        cachedById.put(model.getId(),model);
      }
      clearForeignKeyCache();
      model.setCreated(true);
      return success;
    }
 catch (    SQLException e) {
      throw new IOException(e);
    }
  }
}
Program: 38714
Project: 38714
Buggy source:
public Comment create(final long created_at) throws IOException ;

Fixed version (ground truth):
public Comment create(final int commenter_id,final long commented_on_id,final long created_at) throws IOException ;
Program: 38715
Project: 38715
Buggy source:
public Set<Comment> findByCommenterId(Integer value) throws IOException ;

Fixed version (ground truth):
public Set<Comment> findByCommenterId(int value) throws IOException ;
Program: 38716
Project: 38716
Buggy source:
public Set<Comment> findByCommentedOnId(Long value) throws IOException ;

Fixed version (ground truth):
public Set<Comment> findByCommentedOnId(long value) throws IOException ;
Program: 38717
Project: 38717
Buggy source:
public void set(PreparedStatement stmt) throws SQLException {
  stmt.setTimestamp(1,new Timestamp(created_at));
}

Fixed version (ground truth):
public void set(PreparedStatement stmt) throws SQLException {
  stmt.setInt(1,commenter_id);
  stmt.setLong(2,commented_on_id);
  stmt.setTimestamp(3,new Timestamp(created_at));
}
Program: 38718
Project: 38718
Buggy source:
public Comment create(final long created_at) throws IOException {
  long __id=realCreate(new AttrSetter(){
    public void set(    PreparedStatement stmt) throws SQLException {
      stmt.setTimestamp(1,new Timestamp(created_at));
    }
  }
,getInsertStatement(Arrays.asList("String_Node_Str")));
  Comment newInst=new Comment(__id,null,null,null,created_at,databases);
  cachedById.put(__id,newInst);
  clearForeignKeyCache();
  return newInst;
}

Fixed version (ground truth):
public Comment create(final int commenter_id,final long commented_on_id,final long created_at) throws IOException {
  long __id=realCreate(new AttrSetter(){
    public void set(    PreparedStatement stmt) throws SQLException {
      stmt.setInt(1,commenter_id);
      stmt.setLong(2,commented_on_id);
      stmt.setTimestamp(3,new Timestamp(created_at));
    }
  }
,getInsertStatement(Arrays.asList("String_Node_Str","String_Node_Str","String_Node_Str")));
  Comment newInst=new Comment(__id,null,commenter_id,commented_on_id,created_at,databases);
  cachedById.put(__id,newInst);
  clearForeignKeyCache();
  return newInst;
}
Program: 38719
Project: 38719
Buggy source:
@Override protected void setAttrs(Comment model,PreparedStatement stmt) throws SQLException {
  if (model.getContent() == null) {
    stmt.setNull(1,java.sql.Types.CHAR);
  }
 else {
    stmt.setString(1,model.getContent());
  }
  if (model.getCommenterId() == null) {
    stmt.setNull(2,java.sql.Types.INTEGER);
  }
 else {
    stmt.setInt(2,model.getCommenterId());
  }
  if (model.getCommentedOnId() == null) {
    stmt.setNull(3,java.sql.Types.INTEGER);
  }
 else {
    stmt.setLong(3,model.getCommentedOnId());
  }
{
    stmt.setTimestamp(4,new Timestamp(model.getCreatedAt()));
  }
  stmt.setLong(5,model.getId());
}

Fixed version (ground truth):
@Override protected void setAttrs(Comment model,PreparedStatement stmt) throws SQLException {
  if (model.getContent() == null) {
    stmt.setNull(1,java.sql.Types.CHAR);
  }
 else {
    stmt.setString(1,model.getContent());
  }
{
    stmt.setInt(2,model.getCommenterId());
  }
{
    stmt.setLong(3,model.getCommentedOnId());
  }
{
    stmt.setTimestamp(4,new Timestamp(model.getCreatedAt()));
  }
  stmt.setLong(5,model.getId());
}
Program: 38720
Project: 38720
Buggy source:
public Set<Comment> findByCommenterId(final Integer value) throws IOException {
  return find(new HashMap<Enum,Object>(){
{
      put(Comment._Fields.commenter_id,value);
    }
  }
);
}

Fixed version (ground truth):
public Set<Comment> findByCommenterId(final int value) throws IOException {
  return find(new HashMap<Enum,Object>(){
{
      put(Comment._Fields.commenter_id,value);
    }
  }
);
}
Program: 38721
Project: 38721
Buggy source:
public Set<Comment> findByCommentedOnId(final Long value) throws IOException {
  return find(new HashMap<Enum,Object>(){
{
      put(Comment._Fields.commented_on_id,value);
    }
  }
);
}

Fixed version (ground truth):
public Set<Comment> findByCommentedOnId(final long value) throws IOException {
  return find(new HashMap<Enum,Object>(){
{
      put(Comment._Fields.commented_on_id,value);
    }
  }
);
}
Program: 38722
Project: 38722
Buggy source:
public Comment create(final long created_at) throws IOException {
  long __id=curId.getAndIncrement();
  Comment newInst=new Comment(__id,null,null,null,created_at,databases);
  records.put(__id,newInst);
  clearForeignKeyCache();
  return newInst;
}

Fixed version (ground truth):
public Comment create(final int commenter_id,final long commented_on_id,final long created_at) throws IOException {
  long __id=curId.getAndIncrement();
  Comment newInst=new Comment(__id,null,commenter_id,commented_on_id,created_at,databases);
  records.put(__id,newInst);
  clearForeignKeyCache();
  return newInst;
}
Program: 38723
Project: 38723
Buggy source:
public Set<Comment> findByCommenterId(final Integer value) throws IOException {
  return find(new HashMap<Enum,Object>(){
{
      put(Comment._Fields.commenter_id,value);
    }
  }
);
}

Fixed version (ground truth):
public Set<Comment> findByCommenterId(final int value) throws IOException {
  return find(new HashMap<Enum,Object>(){
{
      put(Comment._Fields.commenter_id,value);
    }
  }
);
}
Program: 38724
Project: 38724
Buggy source:
public Set<Comment> findByCommentedOnId(final Long value) throws IOException {
  return find(new HashMap<Enum,Object>(){
{
      put(Comment._Fields.commented_on_id,value);
    }
  }
);
}

Fixed version (ground truth):
public Set<Comment> findByCommentedOnId(final long value) throws IOException {
  return find(new HashMap<Enum,Object>(){
{
      put(Comment._Fields.commented_on_id,value);
    }
  }
);
}
Program: 38725
Project: 38725
Buggy source:
public void setCommenterId(Integer newval){
  this.__commenter_id=newval;
}

Fixed version (ground truth):
public void setCommenterId(int newval){
  this.__commenter_id=newval;
}
Program: 38726
Project: 38726
Buggy source:
public Long getCommentedOnId(){
  return __commented_on_id;
}

Fixed version (ground truth):
public long getCommentedOnId(){
  return __commented_on_id;
}
Program: 38727
Project: 38727
Buggy source:
public static Class getFieldType(String fieldName){
  if (fieldName.equals("String_Node_Str")) {
    return String.class;
  }
  if (fieldName.equals("String_Node_Str")) {
    return Integer.class;
  }
  if (fieldName.equals("String_Node_Str")) {
    return Long.class;
  }
  if (fieldName.equals("String_Node_Str")) {
    return long.class;
  }
  throw new IllegalStateException("String_Node_Str" + fieldName);
}

Fixed version (ground truth):
public static Class getFieldType(String fieldName){
  if (fieldName.equals("String_Node_Str")) {
    return String.class;
  }
  if (fieldName.equals("String_Node_Str")) {
    return int.class;
  }
  if (fieldName.equals("String_Node_Str")) {
    return long.class;
  }
  if (fieldName.equals("String_Node_Str")) {
    return long.class;
  }
  throw new IllegalStateException("String_Node_Str" + fieldName);
}
Program: 38728
Project: 38728
Buggy source:
public Integer getCommenterId(){
  return __commenter_id;
}

Fixed version (ground truth):
public int getCommenterId(){
  return __commenter_id;
}
Program: 38729
Project: 38729
Buggy source:
public void setCommentedOnId(Long newval){
  this.__commented_on_id=newval;
}

Fixed version (ground truth):
public void setCommentedOnId(long newval){
  this.__commented_on_id=newval;
}
Program: 38730
Project: 38730
Buggy source:
protected Set<T> realFind(Map fieldsMap) throws IOException {
  Set<T> foundSet=new HashSet<T>();
  if (fieldsMap == null || fieldsMap.isEmpty()) {
    return foundSet;
  }
  for (  T t : records.values()) {
    for (    Map.Entry<Enum,Object> e : ((Map<Enum,Object>)fieldsMap).entrySet()) {
      if (e.getValue().equals(t.getField(e.getKey().name()))) {
        foundSet.add(t);
      }
    }
  }
  return foundSet;
}

Fixed version (ground truth):
protected Set<T> realFind(Map fieldsMap) throws IOException {
  Set<T> foundSet=new HashSet<T>();
  if (fieldsMap == null || fieldsMap.isEmpty()) {
    return foundSet;
  }
  for (  T record : records.values()) {
    boolean allMatch=true;
    for (    Map.Entry<Enum,Object> e : ((Map<Enum,Object>)fieldsMap).entrySet()) {
      Object searchedForValue=e.getValue();
      Object existingValue=record.getField(e.getKey().name());
      if (existingValue == null) {
        if (searchedForValue != null)         allMatch=false;
      }
 else       if (!existingValue.equals(searchedForValue)) {
        allMatch=false;
      }
      if (allMatch)       foundSet.add(record);
    }
  }
  return foundSet;
}
Program: 38731
Project: 38731
Buggy source:
public Set<Comment> find(Map<Enum,Object> fieldsMap) throws IOException {
  Set<Comment> foundSet=new HashSet<Comment>();
  EnumSet<Comment._Fields> dateTimeFields=EnumSet.of(Comment._Fields.created_at);
  if (fieldsMap == null || fieldsMap.isEmpty()) {
    return foundSet;
  }
  StringBuilder statementString=new StringBuilder();
  statementString.append("String_Node_Str");
  statementString.append("String_Node_Str");
  statementString.append("String_Node_Str");
  Iterator<Map.Entry<Enum,Object>> iter=fieldsMap.entrySet().iterator();
  while (iter.hasNext()) {
    Map.Entry<Enum,Object> entry=iter.next();
    Enum field=entry.getKey();
    String queryValue=entry.getValue().toString();
    if (dateTimeFields.contains(field)) {
      queryValue=new Timestamp((Long)entry.getValue()).toString();
    }
    statementString.append(field + "String_Node_Str" + queryValue+ "String_Node_Str");
    if (iter.hasNext()) {
      statementString.append("String_Node_Str");
    }
  }
  statementString.append("String_Node_Str");
  executeQuery(foundSet,statementString);
  return foundSet;
}

Fixed version (ground truth):
public Set<Comment> find(Map<Enum,Object> fieldsMap) throws IOException {
  Set<Comment> foundSet=new HashSet<Comment>();
  EnumSet<Comment._Fields> dateTimeFields=EnumSet.of(Comment._Fields.created_at);
  EnumSet<Comment._Fields> valueRequiresQuotesFields=EnumSet.of(Comment._Fields.content);
  if (fieldsMap == null || fieldsMap.isEmpty()) {
    return foundSet;
  }
  StringBuilder statementString=new StringBuilder();
  statementString.append("String_Node_Str");
  statementString.append("String_Node_Str");
  statementString.append("String_Node_Str");
  Iterator<Map.Entry<Enum,Object>> iter=fieldsMap.entrySet().iterator();
  while (iter.hasNext()) {
    Map.Entry<Enum,Object> entry=iter.next();
    Enum field=entry.getKey();
    Object value=entry.getValue();
    String queryValue;
    if (value != null) {
      queryValue=entry.getValue().toString();
      if (valueRequiresQuotesFields.contains(field))       queryValue="String_Node_Str" + queryValue + "String_Node_Str";
      if (dateTimeFields.contains(field)) {
        queryValue="String_Node_Str" + new Timestamp((Long)entry.getValue()).toString() + "String_Node_Str";
      }
      queryValue="String_Node_Str" + queryValue;
    }
 else {
      queryValue="String_Node_Str";
    }
    statementString.append(field + queryValue);
    if (iter.hasNext()) {
      statementString.append("String_Node_Str");
    }
  }
  statementString.append("String_Node_Str");
  System.out.println(statementString);
  executeQuery(foundSet,statementString);
  return foundSet;
}
Program: 38732
Project: 38732
Buggy source:
public Set<Image> find(Map<Enum,Object> fieldsMap) throws IOException {
  Set<Image> foundSet=new HashSet<Image>();
  if (fieldsMap == null || fieldsMap.isEmpty()) {
    return foundSet;
  }
  StringBuilder statementString=new StringBuilder();
  statementString.append("String_Node_Str");
  statementString.append("String_Node_Str");
  statementString.append("String_Node_Str");
  Iterator<Map.Entry<Enum,Object>> iter=fieldsMap.entrySet().iterator();
  while (iter.hasNext()) {
    Map.Entry<Enum,Object> entry=iter.next();
    Enum field=entry.getKey();
    String queryValue=entry.getValue().toString();
    statementString.append(field + "String_Node_Str" + queryValue+ "String_Node_Str");
    if (iter.hasNext()) {
      statementString.append("String_Node_Str");
    }
  }
  statementString.append("String_Node_Str");
  executeQuery(foundSet,statementString);
  return foundSet;
}

Fixed version (ground truth):
public Set<Image> find(Map<Enum,Object> fieldsMap) throws IOException {
  Set<Image> foundSet=new HashSet<Image>();
  if (fieldsMap == null || fieldsMap.isEmpty()) {
    return foundSet;
  }
  StringBuilder statementString=new StringBuilder();
  statementString.append("String_Node_Str");
  statementString.append("String_Node_Str");
  statementString.append("String_Node_Str");
  Iterator<Map.Entry<Enum,Object>> iter=fieldsMap.entrySet().iterator();
  while (iter.hasNext()) {
    Map.Entry<Enum,Object> entry=iter.next();
    Enum field=entry.getKey();
    Object value=entry.getValue();
    String queryValue;
    if (value != null) {
      queryValue=entry.getValue().toString();
    }
 else {
      queryValue="String_Node_Str";
    }
    statementString.append(field + queryValue);
    if (iter.hasNext()) {
      statementString.append("String_Node_Str");
    }
  }
  statementString.append("String_Node_Str");
  System.out.println(statementString);
  executeQuery(foundSet,statementString);
  return foundSet;
}