Program: 145477
Project: 145477
Buggy source:
protected Map<String,Fields> readTablesColumns(Rowset colsRs,String aSchema,SqlDriver sqlDriver) throws Exception {
  Map<String,Fields> tabledFields=new HashMap<>();
  if (colsRs != null) {
    Fields colsMd=colsRs.getFields();
    Map<String,Integer> colIndicies=new HashMap<>();
    for (int i=1; i <= colsMd.getFieldsCount(); i++) {
      colIndicies.put(colsMd.get(i).getName().toUpperCase(),i);
    }
    int JDBCCOLS_TABLE_INDEX=colIndicies.get(ClientConstants.JDBCCOLS_TABLE_NAME);
    int JDBCCOLS_COLUMN_INDEX=colIndicies.get(ClientConstants.JDBCCOLS_COLUMN_NAME);
    int JDBCCOLS_DATA_TYPE_INDEX=colIndicies.get(ClientConstants.JDBCCOLS_DATA_TYPE);
    int JDBCCOLS_TYPE_NAME_INDEX=colIndicies.get(ClientConstants.JDBCCOLS_TYPE_NAME);
    int JDBCCOLS_COLUMN_SIZE_INDEX=colIndicies.get(ClientConstants.JDBCCOLS_COLUMN_SIZE);
    int JDBCCOLS_DECIMAL_DIGITS_INDEX=colIndicies.get(ClientConstants.JDBCCOLS_DECIMAL_DIGITS);
    int JDBCCOLS_NUM_PREC_RADIX_INDEX=colIndicies.get(ClientConstants.JDBCCOLS_NUM_PREC_RADIX);
    int JDBCCOLS_NULLABLE_INDEX=colIndicies.get(ClientConstants.JDBCCOLS_NULLABLE);
    colsRs.beforeFirst();
    while (colsRs.next()) {
      String fTableName=colsRs.getString(JDBCCOLS_TABLE_INDEX);
      Fields fields=tabledFields.get(fTableName);
      if (fields == null) {
        fields=new Fields();
        tabledFields.put(fTableName,fields);
      }
      String fName=colsRs.getString(JDBCCOLS_COLUMN_INDEX);
      Field field=new Field(fName);
      field.setOriginalName(fName);
      String rdbmsTypeName=colsRs.getString(JDBCCOLS_TYPE_NAME_INDEX);
      Integer correctType=sqlDriver.getJdbcTypeByRDBMSTypename(rdbmsTypeName);
      if (correctType != null) {
        field.getTypeInfo().setSqlType(correctType);
      }
 else {
        field.getTypeInfo().setSqlType(colsRs.getInt(JDBCCOLS_DATA_TYPE_INDEX));
      }
      field.getTypeInfo().setSqlTypeName(rdbmsTypeName);
      Integer iSize=colsRs.getInt(JDBCCOLS_COLUMN_SIZE_INDEX);
      if (iSize != null) {
        field.setSize(iSize);
      }
      Integer iScale=colsRs.getInt(JDBCCOLS_DECIMAL_DIGITS_INDEX);
      if (iScale != null) {
        field.setScale(iScale);
      }
      Integer iPrecision=colsRs.getInt(JDBCCOLS_NUM_PREC_RADIX_INDEX);
      if (iPrecision != null) {
        field.setPrecision(iPrecision);
      }
      Integer iNullable=colsRs.getInt(JDBCCOLS_NULLABLE_INDEX);
      if (iNullable != null) {
        field.setNullable(iNullable == ResultSetMetaData.columnNullable);
      }
      field.setSchemaName(aSchema);
      field.setTableName(fTableName);
      sqlDriver.getTypesResolver().resolve2Application(field);
      field.getTypeInfo().setSqlTypeName(rdbmsTypeName);
      fields.add(field);
    }
  }
  return tabledFields;
}

Fixed version (ground truth):
protected Map<String,Fields> readTablesColumns(Rowset colsRs,String aSchema,SqlDriver sqlDriver) throws Exception {
  Map<String,Fields> tabledFields=new HashMap<>();
  if (colsRs != null) {
    Fields colsMd=colsRs.getFields();
    Map<String,Integer> colIndicies=new HashMap<>();
    for (int i=1; i <= colsMd.getFieldsCount(); i++) {
      colIndicies.put(colsMd.get(i).getName().toUpperCase(),i);
    }
    int JDBCCOLS_TABLE_INDEX=colIndicies.get(ClientConstants.JDBCCOLS_TABLE_NAME);
    int JDBCCOLS_COLUMN_INDEX=colIndicies.get(ClientConstants.JDBCCOLS_COLUMN_NAME);
    int JDBCCOLS_DATA_TYPE_INDEX=colIndicies.get(ClientConstants.JDBCCOLS_DATA_TYPE);
    int JDBCCOLS_TYPE_NAME_INDEX=colIndicies.get(ClientConstants.JDBCCOLS_TYPE_NAME);
    int JDBCCOLS_COLUMN_SIZE_INDEX=colIndicies.get(ClientConstants.JDBCCOLS_COLUMN_SIZE);
    int JDBCCOLS_DECIMAL_DIGITS_INDEX=colIndicies.get(ClientConstants.JDBCCOLS_DECIMAL_DIGITS);
    int JDBCCOLS_NUM_PREC_RADIX_INDEX=colIndicies.get(ClientConstants.JDBCCOLS_NUM_PREC_RADIX);
    int JDBCCOLS_NULLABLE_INDEX=colIndicies.get(ClientConstants.JDBCCOLS_NULLABLE);
    colsRs.beforeFirst();
    while (colsRs.next()) {
      String fTableName=colsRs.getString(JDBCCOLS_TABLE_INDEX);
      Fields fields=tabledFields.get(fTableName);
      if (fields == null) {
        fields=new Fields();
        tabledFields.put(fTableName,fields);
      }
      String fName=colsRs.getString(JDBCCOLS_COLUMN_INDEX);
      Field field=new Field(fName.toLowerCase());
      field.setOriginalName(fName);
      String rdbmsTypeName=colsRs.getString(JDBCCOLS_TYPE_NAME_INDEX);
      Integer correctType=sqlDriver.getJdbcTypeByRDBMSTypename(rdbmsTypeName);
      if (correctType != null) {
        field.getTypeInfo().setSqlType(correctType);
      }
 else {
        field.getTypeInfo().setSqlType(colsRs.getInt(JDBCCOLS_DATA_TYPE_INDEX));
      }
      field.getTypeInfo().setSqlTypeName(rdbmsTypeName);
      Integer iSize=colsRs.getInt(JDBCCOLS_COLUMN_SIZE_INDEX);
      if (iSize != null) {
        field.setSize(iSize);
      }
      Integer iScale=colsRs.getInt(JDBCCOLS_DECIMAL_DIGITS_INDEX);
      if (iScale != null) {
        field.setScale(iScale);
      }
      Integer iPrecision=colsRs.getInt(JDBCCOLS_NUM_PREC_RADIX_INDEX);
      if (iPrecision != null) {
        field.setPrecision(iPrecision);
      }
      Integer iNullable=colsRs.getInt(JDBCCOLS_NULLABLE_INDEX);
      if (iNullable != null) {
        field.setNullable(iNullable == ResultSetMetaData.columnNullable);
      }
      field.setSchemaName(aSchema);
      field.setTableName(fTableName);
      sqlDriver.getTypesResolver().resolve2Application(field);
      field.getTypeInfo().setSqlTypeName(rdbmsTypeName);
      fields.add(field);
    }
  }
  return tabledFields;
}