Buggy code:
public class DB_Table { public static final String copyrightNotice = Copyright . SHORT_2004 ; private static PreparedStatement getColumnInfoStmt ; private static PreparedStatement getColumnTypeStmt ; private static PreparedStatement getAutoIncStmt ; public static void doTables ( Connection conn , HashMap tableIdToNameMap ) throws SQLException { DB_Table . getColumnInfoStmt = conn . prepareStatement ( ( "SELECT<seq2seq4repair_space>C.COLUMNNAME,<seq2seq4repair_space>C.REFERENCEID,<seq2seq4repair_space>" + ( "C.COLUMNNUMBER<seq2seq4repair_space>FROM<seq2seq4repair_space>SYS.SYSCOLUMNS<seq2seq4repair_space>C,<seq2seq4repair_space>SYS.SYSTABLES<seq2seq4repair_space>T<seq2seq4repair_space>WHERE<seq2seq4repair_space>T.TABLEID<seq2seq4repair_space>=<seq2seq4repair_space>?<seq2seq4repair_space>" + "AND<seq2seq4repair_space>T.TABLEID<seq2seq4repair_space>=<seq2seq4repair_space>C.REFERENCEID<seq2seq4repair_space>ORDER<seq2seq4repair_space>BY<seq2seq4repair_space>C.COLUMNNUMBER" ) ) ) ; DB_Table . getColumnTypeStmt = conn . prepareStatement ( ( "SELECT<seq2seq4repair_space>COLUMNDATATYPE,<seq2seq4repair_space>COLUMNDEFAULT<seq2seq4repair_space>FROM<seq2seq4repair_space>SYS.SYSCOLUMNS<seq2seq4repair_space>" + "WHERE<seq2seq4repair_space>REFERENCEID<seq2seq4repair_space>=<seq2seq4repair_space>?<seq2seq4repair_space>AND<seq2seq4repair_space>COLUMNNAME<seq2seq4repair_space>=<seq2seq4repair_space>?" ) ) ; DB_Table . getAutoIncStmt = conn . prepareStatement ( ( "SELECT<seq2seq4repair_space>AUTOINCREMENTSTART,<seq2seq4repair_space>" + ( "AUTOINCREMENTINC,<seq2seq4repair_space>COLUMNNAME,<seq2seq4repair_space>REFERENCEID<seq2seq4repair_space>FROM<seq2seq4repair_space>SYS.SYSCOLUMNS<seq2seq4repair_space>" + "WHERE<seq2seq4repair_space>COLUMNNAME<seq2seq4repair_space>=<seq2seq4repair_space>?<seq2seq4repair_space>AND<seq2seq4repair_space>REFERENCEID<seq2seq4repair_space>=<seq2seq4repair_space>?" ) ) ) ; boolean firstTime = true ; Set tableIds = tableIdToNameMap . keySet ( ) ; for ( Iterator itr = tableIds . iterator ( ) ; itr . hasNext ( ) ; ) { String tableId = ( ( String ) ( itr . next ( ) ) ) ; String tableName = ( ( String ) ( tableIdToNameMap . get ( tableId ) ) ) ; if ( dblook . isExcludedTable ( tableName ) ) continue ; if ( firstTime ) { Logs . reportString ( "----------------------------------------------" ) ; <START_BUG> Logs . reportMessage ( "CSLOOK_Header" , "tables" ) ; <END_BUG> Logs . reportString ( "----------------------------------------------\n" ) ; } Logs . writeToNewDDL ( ( ( "CREATE<seq2seq4repair_space>TABLE<seq2seq4repair_space>" + tableName ) + "<seq2seq4repair_space>(" ) ) ; boolean firstCol = true ; DB_Table . getColumnInfoStmt . setString ( 1 , tableId ) ; ResultSet columnRS = DB_Table . getColumnInfoStmt . executeQuery ( ) ; while ( columnRS . next ( ) ) { String colName = dblook . addQuotes ( columnRS . getString ( 1 ) ) ; String createColString = DB_Table . createColumn ( colName , columnRS . getString ( 2 ) , columnRS . getInt ( 3 ) ) ; if ( ! firstCol ) createColString = ",<seq2seq4repair_space>" + createColString ; Logs . writeToNewDDL ( createColString ) ; firstCol = false ; } columnRS . close ( ) ; Logs . writeToNewDDL ( ")" ) ; Logs . writeStmtEndToNewDDL ( ) ; Logs . writeNewlineToNewDDL ( ) ; firstTime = false ; } DB_Table . getColumnInfoStmt . close ( ) ; DB_Table . getColumnTypeStmt . close ( ) ; DB_Table . getAutoIncStmt . close ( ) ; } private static String createColumn ( String colName , String tableId , int colNum ) throws SQLException { } public static void reinstateAutoIncrement ( String colName , String tableId , StringBuffer colDef ) throws SQLException { } }

Fix:
Logs . reportMessage ( "CSLOOK_TablesHeader" ) ;