Buggy code:
public class SYSSTATEMENTSRowFactory extends CatalogRowFactory { static final String TABLENAME_STRING = "SYSSTATEMENTS" ; public static final int SYSSTATEMENTS_STMTID = 1 ; public static final int SYSSTATEMENTS_STMTNAME = 2 ; public static final int SYSSTATEMENTS_SCHEMAID = 3 ; public static final int SYSSTATEMENTS_TYPE = 4 ; public static final int SYSSTATEMENTS_VALID = 5 ; public static final int SYSSTATEMENTS_TEXT = 6 ; public static final int SYSSTATEMENTS_LASTCOMPILED = 7 ; public static final int SYSSTATEMENTS_COMPILATION_SCHEMAID = 8 ; public static final int SYSSTATEMENTS_USINGTEXT = 9 ; public static final int SYSSTATEMENTS_CONSTANTSTATE = 10 ; public static final int SYSSTATEMENTS_INITIALLY_COMPILABLE = 11 ; public static final int SYSSTATEMENTS_COLUMN_COUNT = SYSSTATEMENTSRowFactory . SYSSTATEMENTS_INITIALLY_COMPILABLE ; public static final int SYSSTATEMENTS_HIDDEN_COLUMN_COUNT = 2 ; protected static final int SYSSTATEMENTS_INDEX1_ID = 0 ; protected static final int SYSSTATEMENTS_INDEX2_ID = 1 ; private static final int [ ] [ ] indexColumnPositions = new int [ ] [ ] { new int [ ] { SYSSTATEMENTSRowFactory . SYSSTATEMENTS_STMTID } , new int [ ] { SYSSTATEMENTSRowFactory . SYSSTATEMENTS_STMTNAME , SYSSTATEMENTSRowFactory . SYSSTATEMENTS_SCHEMAID } } ; private static final boolean [ ] uniqueness = null ; private static final String [ ] uuids = new String [ ] { "80000000-00d1-15f7-ab70-000a0a0b1500" , "80000000-00d1-15fc-60b9-000a0a0b1500" , "80000000-00d1-15fc-eda1-000a0a0b1500" , "80000000-00d1-15fe-bdf8-000a0a0b1500" } ; SYSSTATEMENTSRowFactory ( UUIDFactory uuidf , ExecutionFactory ef , DataValueFactory dvf ) { } public ExecRow makeSYSSTATEMENTSrow ( boolean compileMe , SPSDescriptor spsDescriptor ) throws StandardException { } public TupleDescriptor buildDescriptor ( ExecRow row , TupleDescriptor parentTupleDescriptor , DataDictionary dd ) throws StandardException { DataValueDescriptor col ; SPSDescriptor descriptor ; String name ; String text ; String usingText ; UUID uuid ; UUID compUuid = null ; String uuidStr ; UUID suuid ; String suuidStr ; String typeStr ; char type ; boolean valid ; Timestamp time = null ; ExecPreparedStatement preparedStatement = null ; boolean initiallyCompilable ; DataDescriptorGenerator ddg = dd . getDataDescriptorGenerator ( ) ; if ( SanityManager . DEBUG ) { SanityManager . ASSERT ( ( ( row . nColumns ( ) ) == ( SYSSTATEMENTSRowFactory . SYSSTATEMENTS_COLUMN_COUNT ) ) , "Wrong<seq2seq4repair_space>number<seq2seq4repair_space>of<seq2seq4repair_space>columns<seq2seq4repair_space>for<seq2seq4repair_space>a<seq2seq4repair_space>SYSSTATEMENTS<seq2seq4repair_space>row" ) ; } col = row . getColumn ( 1 ) ; uuidStr = col . getString ( ) ; uuid = getUUIDFactory ( ) . recreateUUID ( uuidStr ) ; col = row . getColumn ( 2 ) ; name = col . getString ( ) ; col = row . getColumn ( 3 ) ; suuidStr = col . getString ( ) ; suuid = getUUIDFactory ( ) . recreateUUID ( suuidStr ) ; col = row . getColumn ( 4 ) ; type = col . getString ( ) . charAt ( 0 ) ; if ( SanityManager . DEBUG ) { if ( ! ( SPSDescriptor . validType ( type ) ) ) { SanityManager . THROWASSERT ( ( ( ( "Bad<seq2seq4repair_space>type<seq2seq4repair_space>value<seq2seq4repair_space>(" + type ) + ")<seq2seq4repair_space>for<seq2seq4repair_space>statement<seq2seq4repair_space>" ) + name ) ) ; } } <START_BUG> if ( ( ( DataDictionaryImpl ) ( dd ) ) . readOnlyUpgrade ) { <END_BUG> valid = false ; } else { col = row . getColumn ( 5 ) ; valid = col . getBoolean ( ) ; } col = row . getColumn ( 6 ) ; text = col . getString ( ) ; col = row . getColumn ( 7 ) ; time = col . getTimestamp ( new GregorianCalendar ( ) ) ; col = row . getColumn ( 8 ) ; uuidStr = col . getString ( ) ; if ( uuidStr != null ) compUuid = getUUIDFactory ( ) . recreateUUID ( uuidStr ) ; col = row . getColumn ( 9 ) ; usingText = col . getString ( ) ; if ( valid ) { col = row . getColumn ( 10 ) ; preparedStatement = ( ( ExecPreparedStatement ) ( col . getObject ( ) ) ) ; } col = row . getColumn ( 11 ) ; if ( col . isNull ( ) ) { initiallyCompilable = true ; } else { initiallyCompilable = col . getBoolean ( ) ; } descriptor = new SPSDescriptor ( dd , name , uuid , suuid , compUuid , type , valid , text , usingText , time , preparedStatement , initiallyCompilable ) ; return descriptor ; } public ExecRow makeEmptyRow ( ) throws StandardException { } public SystemColumn [ ] buildColumnList ( ) throws StandardException { } public Properties getCreateHeapProperties ( ) { } }

Fix:
if ( dd . isReadOnlyUpgrade ( ) ) {