Program: 90493
Project: 90493
Buggy source:
/** 
 * 通过翻身将class转换为DBTable对象
 */
protected DBTable converTo(Class<?> defClass){
  if (defClass == null) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  Class<?> clazz;
  try {
    clazz=defClass.newInstance().getClass();
  }
 catch (  Exception e) {
    throw new RuntimeException(e);
  }
  Table annoTable=clazz.getAnnotation(Table.class);
  if (annoTable == null) {
    throw new IllegalArgumentException(clazz + "String_Node_Str");
  }
  String tableName=ReflectUtil.getTableName(clazz);
  DBTable table=new DBTable(tableName.toLowerCase());
  String cluster=annoTable.cluster();
  if (StringUtils.isBlank(cluster)) {
    throw new IllegalArgumentException(clazz + "String_Node_Str");
  }
  table.setCluster(cluster);
  String shardingBy=annoTable.shardingBy();
  table.setShardingBy(shardingBy);
  int shardingNum=annoTable.shardingNum();
  table.setShardingNum(shardingNum);
  _parseDBIndex(table,clazz);
  DBTableColumn column=null;
  org.pinus.generator.annotation.Field dbField=null;
  PrimaryKey pk=null;
  UpdateTime updateTime=null;
  DateTime datetime=null;
  boolean isSetPrimaryKey=false;
  for (  Field f : clazz.getDeclaredFields()) {
    column=new DBTableColumn();
    datetime=f.getAnnotation(DateTime.class);
    if (datetime != null) {
      if (f.getType() != Date.class) {
        throw new IllegalArgumentException(clazz + "String_Node_Str" + f.getName()+ "String_Node_Str"+ f.getType()+ "String_Node_Str");
      }
      column.setField(f.getName());
      column.setType(DataTypeBind.getEnum(f.getType()).getDBType());
      column.setHasDefault(datetime.hasDefault());
      if (column.isHasDefault())       column.setDefaultValue(DataTypeBind.getEnum(f.getType()).getDefaultValue());
      column.setComment(datetime.comment());
      table.addColumn(column);
    }
    updateTime=f.getAnnotation(UpdateTime.class);
    if (updateTime != null) {
      if (f.getType() != java.sql.Timestamp.class) {
        throw new IllegalArgumentException(clazz + "String_Node_Str" + f.getName()+ "String_Node_Str"+ f.getType()+ "String_Node_Str");
      }
      column.setField(f.getName());
      column.setType(DataTypeBind.UPDATETIME.getDBType());
      column.setHasDefault(true);
      column.setDefaultValue(DataTypeBind.UPDATETIME.getDefaultValue());
      column.setComment(updateTime.comment());
      table.addColumn(column);
    }
    dbField=f.getAnnotation(org.pinus.generator.annotation.Field.class);
    if (dbField != null) {
      if (f.getType() == java.sql.Timestamp.class) {
        throw new IllegalArgumentException(clazz + "String_Node_Str" + f.getName()+ "String_Node_Str");
      }
      String fieldName=f.getName();
      boolean isCanNull=dbField.isCanNull();
      int length=_getLength(f,dbField);
      boolean hasDefault=dbField.hasDefault();
      column.setField(fieldName);
      column.setType(DataTypeBind.getEnum(f.getType()).getDBType());
      column.setCanNull(isCanNull);
      column.setLength(length);
      column.setHasDefault(hasDefault);
      column.setComment(dbField.comment());
      if (column.isHasDefault())       column.setDefaultValue(DataTypeBind.getEnum(f.getType()).getDefaultValue());
      if (column.getType().equals(DataTypeBind.STRING.getDBType()) && column.getLength() > Const.COLUMN_TEXT_LENGTH) {
        column.setType(DataTypeBind.TEXT.getDBType());
        column.setLength(0);
        column.setDefaultValue(DataTypeBind.TEXT.getDefaultValue());
      }
      if (column.getType().equals(DataTypeBind.BOOL.getDBType())) {
        column.setLength(1);
      }
      table.addColumn(column);
    }
    pk=f.getAnnotation(PrimaryKey.class);
    if (pk != null) {
      if (!isSetPrimaryKey) {
        column.setField(f.getName());
        DataTypeBind dbType=DataTypeBind.getEnum(f.getType());
        column.setType(dbType.getDBType());
        column.setPrimaryKey(true);
        column.setAutoIncrement(false);
        column.setCanNull(false);
        int length=_getDbLength(dbType);
        column.setLength(length);
        column.setDefaultValue(null);
        isSetPrimaryKey=true;
        column.setComment(pk.comment());
      }
 else {
        throw new IllegalArgumentException(clazz + "String_Node_Str");
      }
      table.addColumn(column);
    }
  }
  if (table.getColumns().isEmpty()) {
    throw new IllegalStateException(clazz + "String_Node_Str" + defClass);
  }
  return table;
}

Fixed version (ground truth):
/** 
 * 通过翻身将class转换为DBTable对象
 */
protected DBTable converTo(Class<?> defClass){
  if (defClass == null) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  Class<?> clazz;
  try {
    clazz=defClass.newInstance().getClass();
  }
 catch (  Exception e) {
    throw new RuntimeException(e);
  }
  Table annoTable=clazz.getAnnotation(Table.class);
  if (annoTable == null) {
    throw new IllegalArgumentException(clazz + "String_Node_Str");
  }
  String tableName=ReflectUtil.getTableName(clazz);
  DBTable table=new DBTable(tableName.toLowerCase());
  String cluster=annoTable.cluster();
  if (StringUtils.isBlank(cluster)) {
    throw new IllegalArgumentException(clazz + "String_Node_Str");
  }
  table.setCluster(cluster);
  String shardingBy=annoTable.shardingBy();
  table.setShardingBy(shardingBy);
  int shardingNum=annoTable.shardingNum();
  table.setShardingNum(shardingNum);
  _parseDBIndex(table,clazz);
  DBTableColumn column=null;
  org.pinus.generator.annotation.Field dbField=null;
  PrimaryKey pk=null;
  UpdateTime updateTime=null;
  DateTime datetime=null;
  boolean isSetPrimaryKey=false;
  for (  Field f : clazz.getDeclaredFields()) {
    column=new DBTableColumn();
    datetime=f.getAnnotation(DateTime.class);
    if (datetime != null) {
      if (f.getType() != Date.class) {
        throw new IllegalArgumentException(clazz + "String_Node_Str" + f.getName()+ "String_Node_Str"+ f.getType()+ "String_Node_Str");
      }
      column.setField(f.getName());
      column.setType(DataTypeBind.getEnum(f.getType()).getDBType());
      column.setHasDefault(datetime.hasDefault());
      if (column.isHasDefault())       column.setDefaultValue(DataTypeBind.getEnum(f.getType()).getDefaultValue());
      column.setComment(datetime.comment());
      table.addColumn(column);
    }
    updateTime=f.getAnnotation(UpdateTime.class);
    if (updateTime != null) {
      if (f.getType() != java.sql.Timestamp.class) {
        throw new IllegalArgumentException(clazz + "String_Node_Str" + f.getName()+ "String_Node_Str"+ f.getType()+ "String_Node_Str");
      }
      column.setField(f.getName());
      column.setType(DataTypeBind.UPDATETIME.getDBType());
      column.setHasDefault(true);
      column.setDefaultValue(DataTypeBind.UPDATETIME.getDefaultValue());
      column.setComment(updateTime.comment());
      table.addColumn(column);
    }
    dbField=f.getAnnotation(org.pinus.generator.annotation.Field.class);
    if (dbField != null) {
      if (f.getType() == java.sql.Timestamp.class) {
        throw new IllegalArgumentException(clazz + "String_Node_Str" + f.getName()+ "String_Node_Str");
      }
      String fieldName=f.getName();
      boolean isCanNull=dbField.isCanNull();
      int length=_getLength(f,dbField);
      boolean hasDefault=dbField.hasDefault();
      column.setField(fieldName);
      column.setType(DataTypeBind.getEnum(f.getType()).getDBType());
      column.setCanNull(isCanNull);
      column.setLength(length);
      column.setHasDefault(hasDefault);
      column.setComment(dbField.comment());
      if (column.isHasDefault())       column.setDefaultValue(DataTypeBind.getEnum(f.getType()).getDefaultValue());
      if (column.getType().equals(DataTypeBind.STRING.getDBType()) && column.getLength() > Const.COLUMN_TEXT_LENGTH) {
        column.setType(DataTypeBind.TEXT.getDBType());
        column.setHasDefault(false);
        column.setLength(0);
        column.setDefaultValue(DataTypeBind.TEXT.getDefaultValue());
      }
      if (column.getType().equals(DataTypeBind.BOOL.getDBType())) {
        column.setLength(1);
      }
      table.addColumn(column);
    }
    pk=f.getAnnotation(PrimaryKey.class);
    if (pk != null) {
      if (!isSetPrimaryKey) {
        column.setField(f.getName());
        DataTypeBind dbType=DataTypeBind.getEnum(f.getType());
        column.setType(dbType.getDBType());
        column.setPrimaryKey(true);
        column.setAutoIncrement(false);
        column.setCanNull(false);
        int length=_getDbLength(dbType);
        column.setLength(length);
        column.setDefaultValue(null);
        isSetPrimaryKey=true;
        column.setComment(pk.comment());
      }
 else {
        throw new IllegalArgumentException(clazz + "String_Node_Str");
      }
      table.addColumn(column);
    }
  }
  if (table.getColumns().isEmpty()) {
    throw new IllegalStateException(clazz + "String_Node_Str" + defClass);
  }
  return table;
}