Buggy code:
, checkGetTablesODBC ( String catalog , String schema , String table , String [ ] tableTypes ) throws IOException , SQLException { } private int createTablesForTest ( boolean skipXML ) throws SQLException { } public void testGetColumnsNoModify ( ) throws SQLException { } public void testGetColumns ( ) throws SQLException { } private void crossCheckGetColumnsAndResultSetMetaData ( ResultSet rs ) throws SQLException { } public static void crossCheckGetColumnRowAndResultSetMetaData ( ResultSet rs , ResultSetMetaData rsmdt ) throws SQLException { } public void testTableTypes ( ) throws SQLException { } public void testGetTypeInfo ( ) throws SQLException { int BOOLEAN = Types . BOOLEAN ; if ( usingDerbyNetClient ( ) ) BOOLEAN = Types . SMALLINT ; String [ ] JDBC_COLUMN_NAMES = new String [ ] { "TYPE_NAME" , "DATA_TYPE" , "PRECISION" , "LITERAL_PREFIX" , "LITERAL_SUFFIX" , "CREATE_PARAMS" , "NULLABLE" , "CASE_SENSITIVE" , "SEARCHABLE" , "UNSIGNED_ATTRIBUTE" , "FIXED_PREC_SCALE" , "AUTO_INCREMENT" , "LOCAL_TYPE_NAME" , "MINIMUM_SCALE" , "MAXIMUM_SCALE" , "SQL_DATA_TYPE" , "SQL_DATETIME_SUB" , "NUM_PREC_RADIX" } ; int [ ] JDBC_COLUMN_TYPES = new int [ ] { Types . VARCHAR , Types . INTEGER , Types . INTEGER , Types . VARCHAR , Types . VARCHAR , Types . VARCHAR , Types . SMALLINT , BOOLEAN , Types . SMALLINT , BOOLEAN , BOOLEAN , BOOLEAN , Types . VARCHAR , Types . SMALLINT , Types . SMALLINT , Types . INTEGER , Types . INTEGER , Types . INTEGER } ; boolean [ ] JDBC_COLUMN_NULLABILITY = new boolean [ ] { false , false , true , true , true , true , false , false , false , true , false , true , true , true , true , true , true , true } ; boolean [ ] JDBC_COLUMN_NULLABILITY_DERBY_2307 = new boolean [ ] { true , false , true , true , true , true , true , false , true , true , false , true , true , true , true , true , true , true } ; ResultSet rs = getDMD ( ) . getTypeInfo ( ) ; DatabaseMetaDataTest . assertMetaDataResultSet ( rs , JDBC_COLUMN_NAMES , JDBC_COLUMN_TYPES , JDBC_COLUMN_NULLABILITY_DERBY_2307 ) ; int [ ] supportedTypes = new int [ ] { Types . BIGINT , Types . BINARY , Types . BLOB , Types . CHAR , Types . CLOB , Types . DATE , Types . DECIMAL , Types . DOUBLE , Types . FLOAT , Types . INTEGER , Types . LONGVARBINARY , Types . LONGVARCHAR , Types . NUMERIC , Types . REAL , Types . SMALLINT , Types . TIME , Types . TIMESTAMP , Types . VARBINARY , Types . VARCHAR , JDBC . SQLXML } ; Arrays . sort ( supportedTypes ) ; int offset = 0 ; while ( rs . next ( ) ) { String typeName = rs . getString ( "TYPE_NAME" ) ; assertNotNull ( typeName ) ; int type = rs . getInt ( "DATA_TYPE" ) ; assertFalse ( rs . wasNull ( ) ) ; if ( ( supportedTypes [ offset ] ) != type ) { fail ( ( "Unexpected<seq2seq4repair_space>type<seq2seq4repair_space>" + typeName ) ) ; } else { offset ++ ; } int precision = - 1 ; switch ( type ) { case Types . BINARY : case Types . CHAR : precision = 254 ; break ; case Types . BLOB : case Types . CLOB : precision = Integer . MAX_VALUE ; break ; case Types . DATE : precision = 10 ; break ; case Types . TIME : precision = 8 ; break ; case Types . TIMESTAMP : precision = 26 ; break ; case Types . DECIMAL : case Types . NUMERIC : precision = 31 ; break ; case Types . DOUBLE : case Types . FLOAT : precision = 52 ; break ; case Types . REAL : precision = 23 ; break ; case Types . BIGINT : precision = 19 ; break ; case Types . INTEGER : precision = 10 ; break ; case Types . SMALLINT : precision = 5 ; break ; case Types . LONGVARBINARY : case Types . LONGVARCHAR : precision = 32700 ; break ; case Types . VARBINARY : precision = 32672 ; break ; case Types . VARCHAR : precision = 32672 ; break ; case JDBC . SQLXML : precision = 0 ; break ; } assertEquals ( ( "PRECISION<seq2seq4repair_space>" + typeName ) , precision , rs . getInt ( "PRECISION" ) ) ; if ( typeName . equals ( "XML" ) ) assertTrue ( rs . wasNull ( ) ) ; else assertFalse ( rs . wasNull ( ) ) ; String createParams ; switch ( type ) { case Types . CHAR : case Types . VARCHAR : case Types . BLOB : case Types . CLOB : case Types . BINARY : case Types . VARBINARY : createParams = "length" ; break ; case Types . DECIMAL : case Types . NUMERIC : createParams = "precision,scale" ; break ; case Types . FLOAT : createParams = "precision" ; break ; default : createParams = null ; break ; } assertEquals ( ( "CREATE_PARAMS<seq2seq4repair_space>" + typeName ) , createParams , rs . getString ( "CREATE_PARAMS" ) ) ; assertEquals ( ( "NULLABLE<seq2seq4repair_space>" + typeName ) , DatabaseMetaData . typeNullable , rs . getInt ( "NULLABLE" ) ) ; assertFalse ( rs . wasNull ( ) ) ; { int searchable ; switch ( type ) { case Types . LONGVARBINARY : searchable = DatabaseMetaData . typePredNone ; break ; case Types . LONGVARCHAR : searchable = DatabaseMetaData . typePredChar ; break ; case Types . BLOB : searchable = DatabaseMetaData . typePredNone ; break ; case Types . CLOB : searchable = DatabaseMetaData . typePredChar ; break ; case Types . CHAR : case Types . VARCHAR : searchable = DatabaseMetaData . typeSearchable ; break ; case JDBC . SQLXML : searchable = DatabaseMetaData . typePredNone ; break ; default : searchable = DatabaseMetaData . typePredBasic ; break ; } assertEquals ( ( "SEARCHABLE<seq2seq4repair_space>" + typeName ) , searchable , rs . getInt ( "SEARCHABLE" ) ) ; } boolean fixedScale = ( type == ( Types . DECIMAL ) ) || ( type == ( Types . NUMERIC ) ) ; assertEquals ( ( "FIXED_PREC_SCALE<seq2seq4repair_space>" + typeName ) , fixedScale , rs . getBoolean ( "FIXED_PREC_SCALE" ) ) ; assertFalse ( rs . wasNull ( ) ) ; boolean autoIncrement ; switch ( type ) { case Types . BIGINT : case Types . INTEGER : case Types . SMALLINT : autoIncrement = true ; break ; default : autoIncrement = false ; break ; } assertEquals ( ( "AUTO_INCREMENT<seq2seq4repair_space>" + typeName ) , autoIncrement , rs . getBoolean ( "AUTO_INCREMENT" ) ) ; assertEquals ( ( "LOCAL_TYPE_NAME<seq2seq4repair_space>" + typeName ) , typeName , rs . getString ( "LOCAL_TYPE_NAME" ) ) ; int maxScale ; boolean hasScale = true ; switch ( type ) { case Types . DECIMAL : case Types . NUMERIC : <START_BUG> maxScale = 32767 ; <END_BUG>

Fix:
maxScale = 31 ;