Program: 184341
Project: 184341
Buggy source:
public SqlHelper(final DbConfiguration config,Type type){
  try {
    this.config=config;
    this.clz=type;
    tableName=decodeTypeName(type.getName());
    List<DefaultFieldSerializer<?>> fieldSerializer=new ArrayList<>();
    List<Field> fl=type.getFields();
    ArrayList<DatabaseColumn> listUserColumns=new ArrayList<DatabaseColumn>();
    for (    Field f : fl) {
      Type rT;
switch (f.getRefer()) {
case ByVal:
        addColumn(listUserColumns,f.getName(),f,f.isKey());
      fieldSerializer.add(new BasicTypeFieldSerializer(f.getName(),toColumnName(f.getName()),f.isArray(),f.getType().getRawType()));
    break;
case Inline:
  rT=f.getType();
if (f.isArray()) {
  List<ListTypeAdapter<?>> adapteres=new ArrayList<>();
  List<String> subFieldNames=new ArrayList<>();
  for (  Field rf : rT.getFields()) {
    addColumn(listUserColumns,f.getName(),rf.getName(),f.isArray(),rf,f.isKey() && rf.isKey());
    adapteres.add(ListTypeAdapter.getAdapter(rf.getType().getRawType()));
    subFieldNames.add(rf.getName());
  }
  fieldSerializer.add(new EntityListFieldSerializer(f.getName(),adapteres,subFieldNames));
}
 else {
  for (  Field rf : rT.getFields()) {
    addColumn(listUserColumns,f.getName(),rf.getName(),f.isArray(),rf,f.isKey() && rf.isKey());
    fieldSerializer.add(new BasicTypeFieldSerializer(toColumnName(f.getName(),rf.getName()),toColumnName(f.getName(),rf.getName()),f.isArray(),rf.getType().getRawType()));
  }
}
break;
case ByRef:
rT=f.getType();
for (Field rf : rT.getFields()) {
switch (rf.getImportance()) {
case Key:
case Core:
addColumn(listUserColumns,rT.getName(),rf.getName(),f.isArray(),rf,f.isKey() && rf.isKey());
fieldSerializer.add(new BasicTypeFieldSerializer(toColumnName(f.getName(),rf.getName()),toColumnName(f.getName(),rf.getName()),f.isArray(),rf.getType().getRawType()));
break;
}
}
break;
case Cascade:
rT=f.getType();
for (Field rf : rT.getFields()) {
switch (rf.getImportance()) {
case Key:
case Core:
addColumn(listUserColumns,rT.getName(),rf.getName(),f.isArray(),rf,f.isKey() || rf.isKey());
fieldSerializer.add(new BasicTypeFieldSerializer(toColumnName(f.getName(),rf.getName()),toColumnName(f.getName(),rf.getName()),f.isArray(),rf.getType().getRawType()));
break;
}
}
break;
}
}
StringBuilder sbForSelect=new StringBuilder();
StringBuilder sbForWhere=new StringBuilder();
ArrayList<DatabaseColumn> listKeyColumns=new ArrayList<DatabaseColumn>();
String sql="String_Node_Str";
for (DatabaseColumn column : listUserColumns) {
sbForSelect.append(column.columnName);
sbForSelect.append(',');
sbForWhere.append("String_Node_Str");
if (column.key) {
listKeyColumns.add(column);
sql+=column.columnName + "String_Node_Str";
}
}
ArrayList<DatabaseColumn> listSystemColumns=new ArrayList<DatabaseColumn>();
DatabaseColumn col=new DatabaseColumn("String_Node_Str","String_Node_Str",false,false,false,RawTypes.Timestamp,0,0,0);
listSystemColumns.add(col);
fieldSerializer.add(new SystemTypeFieldSerializer("String_Node_Str","String_Node_Str",false,RawTypes.Timestamp));
this.entitySerializer=new EntityFieldSerializer(fieldSerializer);
this.keyColumns=listKeyColumns.toArray(new DatabaseColumn[0]);
this.wherekeys=sql.substring(0,sql.length() - 4);
this.userColumns=listUserColumns.toArray(new DatabaseColumn[0]);
this.systemColumns=listSystemColumns.toArray(new DatabaseColumn[0]);
this.fieldlist_comma=sbForSelect.substring(0,sbForSelect.length() - 1);
this.fieldlist_questions=sbForWhere.substring(0,sbForWhere.length() - 1);
}
 catch (Exception e) {
throw new RuntimeException(e);
}
}

Fixed version (ground truth):
public SqlHelper(final DbConfiguration config,Type type){
  try {
    this.config=config;
    this.clz=type;
    tableName=decodeTypeName(type.getName());
    List<DefaultFieldSerializer<?>> fieldSerializer=new ArrayList<>();
    List<Field> fl=type.getFields();
    ArrayList<DatabaseColumn> listUserColumns=new ArrayList<DatabaseColumn>();
    for (    Field f : fl) {
      Type rT;
switch (f.getRefer()) {
case ByVal:
        addColumn(listUserColumns,f.getName(),f,f.isKey());
      fieldSerializer.add(new BasicTypeFieldSerializer(toFieldName(f.getName()),toColumnName(f.getName()),f.isArray(),f.getType().getRawType()));
    break;
case Inline:
  rT=f.getType();
if (f.isArray()) {
  List<ListTypeAdapter<?>> adapteres=new ArrayList<>();
  List<String> subFieldNames=new ArrayList<>();
  for (  Field rf : rT.getFields()) {
    addColumn(listUserColumns,f.getName(),rf.getName(),f.isArray(),rf,f.isKey() && rf.isKey());
    adapteres.add(ListTypeAdapter.getAdapter(rf.getType().getRawType()));
    subFieldNames.add(rf.getName());
  }
  fieldSerializer.add(new EntityListFieldSerializer(toFieldName(f.getName()),adapteres,subFieldNames));
}
 else {
  for (  Field rf : rT.getFields()) {
    addColumn(listUserColumns,f.getName(),rf.getName(),f.isArray(),rf,f.isKey() && rf.isKey());
    fieldSerializer.add(new BasicTypeFieldSerializer(toFieldName(f.getName(),rf.getName()),toColumnName(f.getName(),rf.getName()),f.isArray(),rf.getType().getRawType()));
  }
}
break;
case ByRef:
rT=f.getType();
for (Field rf : rT.getFields()) {
switch (rf.getImportance()) {
case Key:
case Core:
addColumn(listUserColumns,rT.getName(),rf.getName(),f.isArray(),rf,f.isKey() && rf.isKey());
fieldSerializer.add(new BasicTypeFieldSerializer(toFieldName(f.getName(),rf.getName()),toColumnName(f.getName(),rf.getName()),f.isArray(),rf.getType().getRawType()));
break;
}
}
break;
case Cascade:
rT=f.getType();
for (Field rf : rT.getFields()) {
switch (rf.getImportance()) {
case Key:
case Core:
addColumn(listUserColumns,rT.getName(),rf.getName(),f.isArray(),rf,f.isKey() || rf.isKey());
fieldSerializer.add(new BasicTypeFieldSerializer(toFieldName(f.getName(),rf.getName()),toColumnName(f.getName(),rf.getName()),f.isArray(),rf.getType().getRawType()));
break;
}
}
break;
}
}
StringBuilder sbForSelect=new StringBuilder();
StringBuilder sbForWhere=new StringBuilder();
ArrayList<DatabaseColumn> listKeyColumns=new ArrayList<DatabaseColumn>();
String sql="String_Node_Str";
for (DatabaseColumn column : listUserColumns) {
sbForSelect.append(column.columnName);
sbForSelect.append(',');
sbForWhere.append("String_Node_Str");
if (column.key) {
listKeyColumns.add(column);
sql+=column.columnName + "String_Node_Str";
}
}
ArrayList<DatabaseColumn> listSystemColumns=new ArrayList<DatabaseColumn>();
DatabaseColumn col=new DatabaseColumn("String_Node_Str","String_Node_Str",false,false,false,RawTypes.Timestamp,0,0,0);
listSystemColumns.add(col);
fieldSerializer.add(new SystemTypeFieldSerializer("String_Node_Str","String_Node_Str",false,RawTypes.Timestamp));
this.entitySerializer=new EntityFieldSerializer(fieldSerializer);
this.keyColumns=listKeyColumns.toArray(new DatabaseColumn[0]);
this.wherekeys=sql.substring(0,sql.length() - 4);
this.userColumns=listUserColumns.toArray(new DatabaseColumn[0]);
this.systemColumns=listSystemColumns.toArray(new DatabaseColumn[0]);
this.fieldlist_comma=sbForSelect.substring(0,sbForSelect.length() - 1);
this.fieldlist_questions=sbForWhere.substring(0,sbForWhere.length() - 1);
}
 catch (Exception e) {
throw new RuntimeException(e);
}
}