Buggy code:
public class streamingColumn { static String [ ] fileName ; static long [ ] fileLength ; public static void main ( String [ ] args ) { } private static void streamTest1 ( Connection conn ) { } static void streamTest2 ( Connection conn , long length ) throws Exception { } static void streamTest3 ( Connection conn , long length ) throws Exception { } private static void streamTest4 ( Connection conn ) { } static void streamTest5 ( Connection conn , long length ) throws Exception { } static void streamTest6 ( Connection conn , long length ) throws Exception { } static void streamTest7 ( Connection conn ) throws Exception { } static void streamTest8 ( Connection conn , int stream1_len , int stream2_len ) { } static void streamTest9 ( Connection conn , int stream1_len , int stream2_len ) { } private static void streamTest10 ( Connection conn ) { ResultSetMetaData met ; ResultSet rs ; Statement stmt ; System . out . println ( "Testing<seq2seq4repair_space>10<seq2seq4repair_space>starts<seq2seq4repair_space>from<seq2seq4repair_space>here" ) ; try { stmt = conn . createStatement ( ) ; stmt . executeUpdate ( "call<seq2seq4repair_space>SYSCS_UTIL.SYSCS_SET_DATABASE_PROPERTY('derby.storage.pageSize',<seq2seq4repair_space>'1024')" ) ; stmt . execute ( "create<seq2seq4repair_space>table<seq2seq4repair_space>tab10<seq2seq4repair_space>(a<seq2seq4repair_space>int,<seq2seq4repair_space>b<seq2seq4repair_space>int,<seq2seq4repair_space>c<seq2seq4repair_space>long<seq2seq4repair_space>varchar)" ) ; stmt . executeUpdate ( "call<seq2seq4repair_space>SYSCS_UTIL.SYSCS_SET_DATABASE_PROPERTY('derby.storage.pageSize',<seq2seq4repair_space>NULL)" ) ; stmt . executeUpdate ( "call<seq2seq4repair_space>SYSCS_UTIL.SYSCS_SET_DATABASE_PROPERTY('derby.storage.pageSize',<seq2seq4repair_space>'4096')" ) ; stmt . execute ( "create<seq2seq4repair_space>index<seq2seq4repair_space>i_a<seq2seq4repair_space>on<seq2seq4repair_space>tab10<seq2seq4repair_space>(a)" ) ; stmt . execute ( "create<seq2seq4repair_space>index<seq2seq4repair_space>i_ab<seq2seq4repair_space>on<seq2seq4repair_space>tab10<seq2seq4repair_space>(a,<seq2seq4repair_space>b)" ) ; stmt . executeUpdate ( "call<seq2seq4repair_space>SYSCS_UTIL.SYSCS_SET_DATABASE_PROPERTY('derby.storage.pageSize',<seq2seq4repair_space>NULL)" ) ; stmt . execute ( "insert<seq2seq4repair_space>into<seq2seq4repair_space>tab10<seq2seq4repair_space>values(1,<seq2seq4repair_space>1,<seq2seq4repair_space>'')" ) ; stmt . execute ( "insert<seq2seq4repair_space>into<seq2seq4repair_space>tab10<seq2seq4repair_space>values(2,<seq2seq4repair_space>2,<seq2seq4repair_space>'test<seq2seq4repair_space>data:<seq2seq4repair_space>a<seq2seq4repair_space>string<seq2seq4repair_space>column<seq2seq4repair_space>inserted<seq2seq4repair_space>as<seq2seq4repair_space>an<seq2seq4repair_space>object')" ) ; for ( int i = 0 ; i < ( streamingColumn . fileName . length ) ; i ++ ) { File file = new File ( streamingColumn . fileName [ i ] ) ; streamingColumn . fileLength [ i ] = file . length ( ) ; InputStream fileIn = new FileInputStream ( file ) ; System . out . println ( ( ( ( "===><seq2seq4repair_space>testing<seq2seq4repair_space>" + ( streamingColumn . fileName [ i ] ) ) + "<seq2seq4repair_space>length<seq2seq4repair_space>=<seq2seq4repair_space>" ) + ( streamingColumn . fileLength [ i ] ) ) ) ; PreparedStatement ps = conn . prepareStatement ( "insert<seq2seq4repair_space>into<seq2seq4repair_space>tab10<seq2seq4repair_space>values(?,<seq2seq4repair_space>?,<seq2seq4repair_space>?)" ) ; ps . setInt ( 1 , ( 100 + i ) ) ; ps . setInt ( 2 , ( 100 + i ) ) ; ps . setAsciiStream ( 3 , fileIn , ( ( int ) ( streamingColumn . fileLength [ i ] ) ) ) ; try { ps . executeUpdate ( ) ; System . out . println ( "No<seq2seq4repair_space>truncation<seq2seq4repair_space>and<seq2seq4repair_space>hence<seq2seq4repair_space>no<seq2seq4repair_space>error" ) ; } catch ( SQLException e ) { if ( ( ( streamingColumn . fileLength [ i ] ) > ( Limits . DB2_LONGVARCHAR_MAXWIDTH ) ) && ( e . getSQLState ( ) . equals ( "22001" ) ) ) System . out . println ( ( ( "expected<seq2seq4repair_space>exception<seq2seq4repair_space>for<seq2seq4repair_space>data<seq2seq4repair_space>><seq2seq4repair_space>" + ( Limits . DB2_LONGVARCHAR_MAXWIDTH ) ) + "<seq2seq4repair_space>in<seq2seq4repair_space>length" ) ) ; else streamingColumn . dumpSQLExceptions ( e ) ; } fileIn . close ( ) ; } CallableStatement cs = conn . prepareCall ( "CALL<seq2seq4repair_space>SYSCS_UTIL.SYSCS_COMPRESS_TABLE(?,<seq2seq4repair_space>?,<seq2seq4repair_space>?)" ) ; cs . setString ( 1 , "APP" ) ; <START_BUG> cs . setString ( 2 , "testLongVarChar" ) ; <END_BUG> cs . setInt ( 3 , 0 ) ; cs . execute ( ) ; stmt . execute ( "CREATE<seq2seq4repair_space>FUNCTION<seq2seq4repair_space>ConsistencyChecker()<seq2seq4repair_space>RETURNS<seq2seq4repair_space>VARCHAR(128)<seq2seq4repair_space>EXTERNAL<seq2seq4repair_space>NAME<seq2seq4repair_space>'org.apache.derbyTesting.functionTests.util.T_ConsistencyChecker.runConsistencyChecker'<seq2seq4repair_space>LANGUAGE<seq2seq4repair_space>JAVA<seq2seq4repair_space>PARAMETER<seq2seq4repair_space>STYLE<seq2seq4repair_space>JAVA" ) ; stmt . execute ( "VALUES<seq2seq4repair_space>ConsistencyChecker()" ) ; stmt . close ( ) ; } catch ( SQLException e ) { streamingColumn . dumpSQLExceptions ( e ) ; } catch ( Throwable e ) { System . out . println ( ( "FAIL<seq2seq4repair_space>--<seq2seq4repair_space>unexpected<seq2seq4repair_space>exception:" + ( e . toString ( ) ) ) ) ; } System . out . println ( "Testing<seq2seq4repair_space>10<seq2seq4repair_space>ends<seq2seq4repair_space>in<seq2seq4repair_space>here" ) ; } private static void streamTest11 ( Connection conn ) { } private static void streamTest12 ( Connection conn ) { } private static void streamTest13 ( Connection conn ) { } private static void derby500Test ( Connection conn ) { } private static void derby500_verifyVarcharStreams ( Connection conn ) { } private static void verifyDerby500Test ( PreparedStatement ps , byte [ ] buf , char [ ] cbuf , int startId , int endId , boolean binaryType ) throws Exception { } private static void compareCharArray ( Reader stream , char [ ] compare , int length ) throws Exception { } private static void expectedException ( SQLException sqle ) { } private static void streamTestDataVerification ( ResultSet rs , int maxValueAllowed ) throws Exception { } private static void insertDataUsingConcat ( Statement stmt , int intValue , int maxValueAllowed , boolean blankPadding , boolean forLongVarChar ) throws Exception { } private static void insertDataUsingStringOrObject ( PreparedStatement ps , int intValue , int maxValueAllowed , boolean blankPadding , boolean testUsingString ) throws Exception { } private static void insertDataUsingCharacterStream ( PreparedStatement ps , int intValue , String fileName , int maxValueAllowed ) throws Exception { } private static void insertDataUsingAsciiStream ( PreparedStatement ps , int intValue , String fileName , int maxValueAllowed ) throws Exception { } static void verifyLength ( int a , int columnSize , long [ ] fileLength ) { } static void verifyExistence ( Connection conn , int key , String base , long length ) throws Exception { } static String getLongString ( Connection conn , int key ) throws Exception { } static String pad ( String base , long length ) { } static int insertLongString ( Connection conn , int key , String data , boolean binaryColumn ) throws Exception { } static int updateLongString ( Connection conn , int oldkey , int newkey ) throws Exception { } static int streamInStringCol ( PreparedStatement ps , String data , boolean binaryColumn ) throws Exception { } public static int streamInLongCol ( PreparedStatement ps , Object data ) throws Exception { } private static boolean byteArrayEquals ( byte [ ] a , int aOffset , int aLength , byte [ ] b , int bOffset , int bLength ) { } private static void dumpSQLExceptions ( SQLException se ) { } }

Fix:
cs . setString ( 2 , "TESTLONGVARCHAR" ) ;