Program: 59506
Project: 59506
Buggy source:
private int buildStatementForInsertUpdate(Object obj,Set<String> ignoreFields,PreparedStatement preparedStatement,Connection connection) throws SQLException, WBSerializerException {
  Class kind=obj.getClass();
  Field[] fields=kind.getDeclaredFields();
  int fieldIndex=0;
  for (int i=0; i < fields.length; i++) {
    Field field=fields[i];
    field.setAccessible(true);
    boolean storeField=(field.getAnnotation(AdminFieldKey.class) != null) || (field.getAnnotation(AdminFieldStore.class) != null) || (field.getAnnotation(AdminFieldTextStore.class) != null);
    if (storeField) {
      String fieldName=field.getName();
      if (ignoreFields != null && ignoreFields.contains(fieldName)) {
        continue;
      }
      fieldIndex=fieldIndex + 1;
      Object value=null;
      try {
        PropertyDescriptor pd=new PropertyDescriptor(fieldName,kind);
        value=pd.getReadMethod().invoke(obj);
      }
 catch (      Exception e) {
        throw new WBSerializerException("String_Node_Str",e);
      }
      if (field.getType() == Long.class) {
        Long valueLong=(Long)value;
        preparedStatement.setLong(fieldIndex,valueLong);
      }
 else       if (field.getType() == String.class) {
        String valueString=(String)value;
        if (field.getAnnotation(AdminFieldStore.class) != null) {
          preparedStatement.setString(fieldIndex,valueString);
        }
 else         if (field.getAnnotation(AdminFieldTextStore.class) != null) {
          Clob clob=connection.createClob();
          clob.setString(1,valueString);
          preparedStatement.setClob(fieldIndex,clob);
        }
      }
 else       if (field.getType() == Integer.class) {
        Integer valueInt=(Integer)value;
        preparedStatement.setInt(fieldIndex,valueInt);
      }
 else       if (field.getType() == Date.class) {
        Date date=(Date)value;
        java.sql.Date sqlDate=new java.sql.Date(date.getTime());
        preparedStatement.setDate(fieldIndex,sqlDate);
      }
    }
  }
  return fieldIndex;
}

Fixed version (ground truth):
private int buildStatementForInsertUpdate(Object obj,Set<String> ignoreFields,PreparedStatement preparedStatement,Connection connection) throws SQLException, WBSerializerException {
  Class kind=obj.getClass();
  Field[] fields=kind.getDeclaredFields();
  int fieldIndex=0;
  for (int i=0; i < fields.length; i++) {
    Field field=fields[i];
    field.setAccessible(true);
    boolean storeField=(field.getAnnotation(AdminFieldKey.class) != null) || (field.getAnnotation(AdminFieldStore.class) != null) || (field.getAnnotation(AdminFieldTextStore.class) != null);
    if (storeField) {
      String fieldName=field.getName();
      if (ignoreFields != null && ignoreFields.contains(fieldName)) {
        continue;
      }
      fieldIndex=fieldIndex + 1;
      Object value=null;
      try {
        PropertyDescriptor pd=new PropertyDescriptor(fieldName,kind);
        value=pd.getReadMethod().invoke(obj);
      }
 catch (      Exception e) {
        throw new WBSerializerException("String_Node_Str",e);
      }
      if (field.getType() == Long.class) {
        Long valueLong=(Long)value;
        preparedStatement.setLong(fieldIndex,valueLong);
      }
 else       if (field.getType() == String.class) {
        String valueString=(String)value;
        if (field.getAnnotation(AdminFieldStore.class) != null) {
          preparedStatement.setString(fieldIndex,valueString);
        }
 else         if (field.getAnnotation(AdminFieldKey.class) != null) {
          preparedStatement.setString(fieldIndex,valueString);
        }
 else         if (field.getAnnotation(AdminFieldTextStore.class) != null) {
          Clob clob=connection.createClob();
          clob.setString(1,valueString);
          preparedStatement.setClob(fieldIndex,clob);
        }
      }
 else       if (field.getType() == Integer.class) {
        Integer valueInt=(Integer)value;
        preparedStatement.setInt(fieldIndex,valueInt);
      }
 else       if (field.getType() == Date.class) {
        Date date=(Date)value;
        java.sql.Date sqlDate=new java.sql.Date(date.getTime());
        preparedStatement.setDate(fieldIndex,sqlDate);
      }
    }
  }
  return fieldIndex;
}