Buggy code:
JDBC . assertFullResultSet ( rs , new String [ ] [ ] { new String [ ] { "SYSCOLUMNS" } } ) ; checkPreparedStatementError ( conn , ( "SELECT<seq2seq4repair_space>TABLENAME<seq2seq4repair_space>FROM<seq2seq4repair_space>SYS.SYSTABLES<seq2seq4repair_space>WHERE<seq2seq4repair_space>" + "<seq2seq4repair_space>LTRIM(?)<seq2seq4repair_space>=<seq2seq4repair_space>TABLENAME" ) , "42818" ) ; ps = conn . prepareStatement ( ( "SELECT<seq2seq4repair_space>TABLENAME<seq2seq4repair_space>FROM<seq2seq4repair_space>SYS.SYSTABLES<seq2seq4repair_space>WHERE<seq2seq4repair_space>" + "<seq2seq4repair_space>LTRIM(?)<seq2seq4repair_space>=<seq2seq4repair_space>CAST(TABLENAME<seq2seq4repair_space>AS<seq2seq4repair_space>CHAR(10))" ) ) ; ps . setString ( 1 , "<seq2seq4repair_space>SYSCOLUMNS" ) ; rs = ps . executeQuery ( ) ; JDBC . assertFullResultSet ( rs , new String [ ] [ ] { new String [ ] { "SYSCOLUMNS" } } ) ; checkPreparedStatementError ( conn , ( "SELECT<seq2seq4repair_space>TABLENAME<seq2seq4repair_space>FROM<seq2seq4repair_space>SYS.SYSTABLES<seq2seq4repair_space>WHERE<seq2seq4repair_space>" + "<seq2seq4repair_space>RTRIM(?)<seq2seq4repair_space>=<seq2seq4repair_space>TABLENAME" ) , "42818" ) ; ps = conn . prepareStatement ( ( "SELECT<seq2seq4repair_space>TABLENAME<seq2seq4repair_space>FROM<seq2seq4repair_space>SYS.SYSTABLES<seq2seq4repair_space>WHERE<seq2seq4repair_space>" + "<seq2seq4repair_space>RTRIM(?)<seq2seq4repair_space>=<seq2seq4repair_space>CAST(TABLENAME<seq2seq4repair_space>AS<seq2seq4repair_space>CHAR(10))" ) ) ; ps . setString ( 1 , "SYSCOLUMNS<seq2seq4repair_space>" ) ; rs = ps . executeQuery ( ) ; JDBC . assertFullResultSet ( rs , new String [ ] [ ] { new String [ ] { "SYSCOLUMNS" } } ) ; checkPreparedStatementError ( conn , ( "SELECT<seq2seq4repair_space>TABLENAME<seq2seq4repair_space>FROM<seq2seq4repair_space>SYS.SYSTABLES<seq2seq4repair_space>WHERE<seq2seq4repair_space>" + "<seq2seq4repair_space>TRIM('a'<seq2seq4repair_space>FROM<seq2seq4repair_space>?)<seq2seq4repair_space>=<seq2seq4repair_space>TABLENAME" ) , "42818" ) ; ps = conn . prepareStatement ( ( "SELECT<seq2seq4repair_space>TABLENAME<seq2seq4repair_space>FROM<seq2seq4repair_space>SYS.SYSTABLES<seq2seq4repair_space>WHERE<seq2seq4repair_space>" + "<seq2seq4repair_space>TRIM('a'<seq2seq4repair_space>FROM<seq2seq4repair_space>?)<seq2seq4repair_space>=<seq2seq4repair_space>CAST(TABLENAME<seq2seq4repair_space>AS<seq2seq4repair_space>CHAR(10))" ) ) ; ps . setString ( 1 , "aSYSCOLUMNS" ) ; rs = ps . executeQuery ( ) ; JDBC . assertFullResultSet ( rs , new String [ ] [ ] { new String [ ] { "SYSCOLUMNS" } } ) ; ps = conn . prepareStatement ( ( "SELECT<seq2seq4repair_space>TABLENAME<seq2seq4repair_space>FROM<seq2seq4repair_space>SYS.SYSTABLES<seq2seq4repair_space>WHERE<seq2seq4repair_space>" + "<seq2seq4repair_space>TRIM(LEADING<seq2seq4repair_space>SUBSTR(TABLENAME,<seq2seq4repair_space>LENGTH(TABLENAME))<seq2seq4repair_space>FROM<seq2seq4repair_space>?)<seq2seq4repair_space>=<seq2seq4repair_space>TABLENAME" ) ) ; ps . setString ( 1 , "SYSCOLUMNS" ) ; rs = ps . executeQuery ( ) ; JDBC . assertEmpty ( rs ) ; ps = conn . prepareStatement ( ( "SELECT<seq2seq4repair_space>TABLENAME<seq2seq4repair_space>FROM<seq2seq4repair_space>SYS.SYSTABLES<seq2seq4repair_space>WHERE<seq2seq4repair_space>" + "<seq2seq4repair_space>LOCATE(?,<seq2seq4repair_space>TABLENAME)<seq2seq4repair_space>!=<seq2seq4repair_space>0" ) ) ; ps . setString ( 1 , "ABC" ) ; rs = ps . executeQuery ( ) ; JDBC . assertEmpty ( rs ) ; ps = conn . prepareStatement ( ( "SELECT<seq2seq4repair_space>TABLENAME<seq2seq4repair_space>FROM<seq2seq4repair_space>SYS.SYSTABLES<seq2seq4repair_space>WHERE<seq2seq4repair_space>" + "<seq2seq4repair_space>LOCATE(TABLENAME,<seq2seq4repair_space>?)<seq2seq4repair_space>!=<seq2seq4repair_space>0" ) ) ; ps . setString ( 1 , "ABC" ) ; rs = ps . executeQuery ( ) ; JDBC . assertEmpty ( rs ) ; ps = conn . prepareStatement ( ( "SELECT<seq2seq4repair_space>COUNT(*)<seq2seq4repair_space>FROM<seq2seq4repair_space>CUSTOMER<seq2seq4repair_space>WHERE<seq2seq4repair_space>?<seq2seq4repair_space>IN<seq2seq4repair_space>" + "<seq2seq4repair_space>(SELECT<seq2seq4repair_space>TABLENAME<seq2seq4repair_space>FROM<seq2seq4repair_space>SYS.SYSTABLES)" ) ) ; ps . setString ( 1 , "SYSCOLUMNS" ) ; rs = ps . executeQuery ( ) ; JDBC . assertFullResultSet ( rs , new String [ ] [ ] { new String [ ] { "7" } } ) ; checkPreparedStatementError ( conn , ( "SELECT<seq2seq4repair_space>TABLENAME<seq2seq4repair_space>FROM<seq2seq4repair_space>SYS.SYSTABLES<seq2seq4repair_space>" + ( "<seq2seq4repair_space>WHERE<seq2seq4repair_space>TABLENAME<seq2seq4repair_space>NOT<seq2seq4repair_space>IN<seq2seq4repair_space>(?,<seq2seq4repair_space>'<seq2seq4repair_space>SYSCOLUMNS<seq2seq4repair_space>')<seq2seq4repair_space>AND<seq2seq4repair_space>" + "<seq2seq4repair_space>CAST(TABLENAME<seq2seq4repair_space>AS<seq2seq4repair_space>CHAR(10))<seq2seq4repair_space>=<seq2seq4repair_space>'SYSCOLUMNS'<seq2seq4repair_space>" ) ) , "42818" ) ; s . executeUpdate ( "set<seq2seq4repair_space>schema<seq2seq4repair_space>SYS" ) ; ps = conn . prepareStatement ( ( "SELECT<seq2seq4repair_space>TABLENAME<seq2seq4repair_space>FROM<seq2seq4repair_space>SYS.SYSTABLES<seq2seq4repair_space>" + ( "<seq2seq4repair_space>WHERE<seq2seq4repair_space>TABLENAME<seq2seq4repair_space>NOT<seq2seq4repair_space>IN<seq2seq4repair_space>(?,<seq2seq4repair_space>'<seq2seq4repair_space>SYSCOLUMNS<seq2seq4repair_space>')<seq2seq4repair_space>AND<seq2seq4repair_space>" + "<seq2seq4repair_space>CAST(TABLENAME<seq2seq4repair_space>AS<seq2seq4repair_space>CHAR(10))<seq2seq4repair_space>=<seq2seq4repair_space>'SYSCOLUMNS'<seq2seq4repair_space>" ) ) ) ; ps . setString ( 1 , "aSYSCOLUMNS" ) ; rs = ps . executeQuery ( ) ; JDBC . assertFullResultSet ( rs , new String [ ] [ ] { new String [ ] { "SYSCOLUMNS" } } ) ; s . executeUpdate ( "set<seq2seq4repair_space>schema<seq2seq4repair_space>APP" ) ; ps = conn . prepareStatement ( ( "SELECT<seq2seq4repair_space>TABLENAME<seq2seq4repair_space>FROM<seq2seq4repair_space>SYS.SYSTABLES<seq2seq4repair_space>WHERE<seq2seq4repair_space>" + ( "<seq2seq4repair_space>CAST(TABLENAME<seq2seq4repair_space>AS<seq2seq4repair_space>CHAR(10))<seq2seq4repair_space>NOT<seq2seq4repair_space>IN<seq2seq4repair_space>(?,<seq2seq4repair_space>'<seq2seq4repair_space>SYSCOLUMNS<seq2seq4repair_space>')<seq2seq4repair_space>AND<seq2seq4repair_space>" + "<seq2seq4repair_space>CAST(TABLENAME<seq2seq4repair_space>AS<seq2seq4repair_space>CHAR(10))<seq2seq4repair_space>=<seq2seq4repair_space>'SYSCOLUMNS'<seq2seq4repair_space>" ) ) ) ; ps . setString ( 1 , "aSYSCOLUMNS" ) ; rs = ps . executeQuery ( ) ; JDBC . assertFullResultSet ( rs , new String [ ] [ ] { new String [ ] { "SYSCOLUMNS" } } ) ; s . executeUpdate ( "set<seq2seq4repair_space>schema<seq2seq4repair_space>SYS" ) ; ps = conn . prepareStatement ( "INSERT<seq2seq4repair_space>INTO<seq2seq4repair_space>APP.CUSTOMER(NAME)<seq2seq4repair_space>VALUES(?)" ) ; ps . setString ( 1 , "SYSCOLUMNS" ) ; ps . executeUpdate ( ) ; ps . close ( ) ; s . executeUpdate ( "INSERT<seq2seq4repair_space>INTO<seq2seq4repair_space>APP.CUSTOMER(NAME)<seq2seq4repair_space>VALUES('abc')" ) ; rs = s . executeQuery ( "SELECT<seq2seq4repair_space>COUNT(*)<seq2seq4repair_space>FROM<seq2seq4repair_space>APP.CUSTOMER<seq2seq4repair_space>" ) ; JDBC . assertFullResultSet ( rs , new String [ ] [ ] { new String [ ] { "9" } } ) ; assertStatementError ( "42818" , s , "DELETE<seq2seq4repair_space>FROM<seq2seq4repair_space>APP.CUSTOMER<seq2seq4repair_space>WHERE<seq2seq4repair_space>NAME<seq2seq4repair_space>=<seq2seq4repair_space>'abc'" ) ; s . executeUpdate ( "set<seq2seq4repair_space>schema<seq2seq4repair_space>APP" ) ; s . executeUpdate ( "DELETE<seq2seq4repair_space>FROM<seq2seq4repair_space>APP.CUSTOMER<seq2seq4repair_space>WHERE<seq2seq4repair_space>NAME<seq2seq4repair_space>=<seq2seq4repair_space>'abc'" ) ; rs = s . executeQuery ( "SELECT<seq2seq4repair_space>COUNT(*)<seq2seq4repair_space>FROM<seq2seq4repair_space>APP.CUSTOMER<seq2seq4repair_space>" ) ; JDBC . assertFullResultSet ( rs , new String [ ] [ ] { new String [ ] { "8" } } ) ; s . executeUpdate ( "set<seq2seq4repair_space>schema<seq2seq4repair_space>APP" ) ; assertStatementError ( "42ZA3" , s , ( "CREATE<seq2seq4repair_space>TABLE<seq2seq4repair_space>T<seq2seq4repair_space>AS<seq2seq4repair_space>SELECT<seq2seq4repair_space>TABLENAME<seq2seq4repair_space>" + "<seq2seq4repair_space>FROM<seq2seq4repair_space>SYS.SYSTABLES<seq2seq4repair_space>WITH<seq2seq4repair_space>NO<seq2seq4repair_space>DATA" ) ) ; s . executeUpdate ( ( "CREATE<seq2seq4repair_space>TABLE<seq2seq4repair_space>T<seq2seq4repair_space>AS<seq2seq4repair_space>SELECT<seq2seq4repair_space>COLUMNNUMBER<seq2seq4repair_space>FROM<seq2seq4repair_space>" + "<seq2seq4repair_space>SYS.SYSCOLUMNS<seq2seq4repair_space>WITH<seq2seq4repair_space>NO<seq2seq4repair_space>DATA" ) ) ; s . execute ( ( "create<seq2seq4repair_space>table<seq2seq4repair_space>assoc<seq2seq4repair_space>(x<seq2seq4repair_space>char(10)<seq2seq4repair_space>not<seq2seq4repair_space>null<seq2seq4repair_space>primary<seq2seq4repair_space>key,<seq2seq4repair_space>" + "<seq2seq4repair_space>y<seq2seq4repair_space>char(100))" ) ) ; s . execute ( "create<seq2seq4repair_space>table<seq2seq4repair_space>assocout(x<seq2seq4repair_space>char(10))" ) ; ps = conn . prepareStatement ( "insert<seq2seq4repair_space>into<seq2seq4repair_space>assoc<seq2seq4repair_space>values<seq2seq4repair_space>(?,<seq2seq4repair_space>'hello')" ) ; ps . setString ( 1 , new Integer ( 10 ) . toString ( ) ) ; ps . executeUpdate ( ) ; s . execute ( ( "CREATE<seq2seq4repair_space>TABLE<seq2seq4repair_space>DERBY_2955<seq2seq4repair_space>(EMPNAME<seq2seq4repair_space>CHAR(20),<seq2seq4repair_space>CONSTRAINT<seq2seq4repair_space>" + "<seq2seq4repair_space>STAFF9_EMPNAME<seq2seq4repair_space>CHECK<seq2seq4repair_space>(EMPNAME<seq2seq4repair_space>NOT<seq2seq4repair_space>LIKE<seq2seq4repair_space>'T%'))" ) ) ; s . execute ( "CREATE<seq2seq4repair_space>TABLE<seq2seq4repair_space>DERBY_2960<seq2seq4repair_space>(C<seq2seq4repair_space>CHAR(10),<seq2seq4repair_space>V<seq2seq4repair_space>VARCHAR(50))" ) ; s . execute ( "INSERT<seq2seq4repair_space>INTO<seq2seq4repair_space>DERBY_2960<seq2seq4repair_space>VALUES<seq2seq4repair_space>('duplicate',<seq2seq4repair_space>'is<seq2seq4repair_space>duplicated')" ) ; rs = s . executeQuery ( ( "SELECT<seq2seq4repair_space>SUBSTR(c||v,<seq2seq4repair_space>1,<seq2seq4repair_space>4),<seq2seq4repair_space>COUNT(*)<seq2seq4repair_space>FROM<seq2seq4repair_space>DERBY_2960" + "<seq2seq4repair_space>GROUP<seq2seq4repair_space>BY<seq2seq4repair_space>SUBSTR(c||v,<seq2seq4repair_space>1,<seq2seq4repair_space>4)" ) ) ; JDBC . assertFullResultSet ( rs , new String [ ] [ ] { new String [ ] { "dupl" , "1" } } ) ; ps = conn . prepareStatement ( "SELECT<seq2seq4repair_space>*<seq2seq4repair_space>FROM<seq2seq4repair_space>CUSTOMER<seq2seq4repair_space>FOR<seq2seq4repair_space>UPDATE" , ResultSet . TYPE_FORWARD_ONLY , ResultSet . CONCUR_UPDATABLE ) ; rs = ps . executeQuery ( ) ; rs . moveToInsertRow ( ) ; rs . close ( ) ; ps . close ( ) ; s . execute ( "CREATE<seq2seq4repair_space>TABLE<seq2seq4repair_space>DERBY_2973<seq2seq4repair_space>(V<seq2seq4repair_space>VARCHAR(40))" ) ; s . execute ( "CREATE<seq2seq4repair_space>INDEX<seq2seq4repair_space>DERBY_2973_I1<seq2seq4repair_space>ON<seq2seq4repair_space>DERBY_2973<seq2seq4repair_space>(V)" ) ; s . execute ( "ALTER<seq2seq4repair_space>TABLE<seq2seq4repair_space>DERBY_2973<seq2seq4repair_space>ALTER<seq2seq4repair_space>V<seq2seq4repair_space>SET<seq2seq4repair_space>DATA<seq2seq4repair_space>TYPE<seq2seq4repair_space>VARCHAR(4096)" ) ; s . execute ( "INSERT<seq2seq4repair_space>INTO<seq2seq4repair_space>DERBY_2973<seq2seq4repair_space>VALUES('hello')" ) ; s . executeUpdate ( "set<seq2seq4repair_space>schema<seq2seq4repair_space>APP" ) ; if ( XML . classpathMeetsXMLReqs ( ) ) { <START_BUG> checkLangBasedQuery ( s , ( "SELECT<seq2seq4repair_space>ID,<seq2seq4repair_space>XMLSERIALIZE(V<seq2seq4repair_space>AS<seq2seq4repair_space>CLOB)<seq2seq4repair_space>" + "<seq2seq4repair_space>FROM<seq2seq4repair_space>DERBY_2961<seq2seq4repair_space>ORDER<seq2seq4repair_space>BY<seq2seq4repair_space>1" ) , null ) ; <END_BUG> } s . close ( ) ; } private void setUpTable ( Statement s ) throws SQLException { } private void dropTable ( Statement s ) throws SQLException { } private void checkPreparedStatementError ( Connection con , String query , String error ) { } private void checkLangBasedQuery ( Statement s , String query , String [ ] [ ] expectedResult ) throws SQLException { } public static Test suite ( ) { } private static Test collatedSuite ( String locale , String baseFixture ) { } }

Fix:
checkLangBasedQuery ( s , ( "SELECT<seq2seq4repair_space>ID,<seq2seq4repair_space>XMLSERIALIZE(V<seq2seq4repair_space>AS<seq2seq4repair_space>CLOB)<seq2seq4repair_space>" + "<seq2seq4repair_space>FROM<seq2seq4repair_space>DERBY_2961<seq2seq4repair_space>ORDER<seq2seq4repair_space>BY<seq2seq4repair_space>1" ) , new String [ ] [ ] { new String [ ] { "1" , null } } ) ;