Source:
<code>protected TableModel parametrizeAndQuery( final DataRow parameters, final String translatedQuery, final String[] preparedParameterNames ) throws SQLException { final boolean callableStatementQuery = isCallableStatementQuery( translatedQuery ); final boolean callableStatementUsed = callableStatementQuery || isCallableStatement( translatedQuery ); final Statement statement = initStatement( parameters, translatedQuery, preparedParameterNames, callableStatementUsed ); try { final Object queryLimit = parameters.get( DataFactory.QUERY_LIMIT ); try { if ( queryLimit instanceof Number ) { final Number i = (Number) queryLimit; final int max = i.intValue(); if ( max > 0 ) { statement.setMaxRows( max ); } } } catch ( SQLException sqle ) { logger.warn( "Driver indicated error: Failed to set query-limit: " + queryLimit, sqle ); } final Object queryTimeout = parameters.get( DataFactory.QUERY_TIMEOUT ); try { if ( queryTimeout instanceof Number ) { final Number i = (Number) queryTimeout; final int seconds = i.intValue(); if ( seconds > 0 ) { statement.setQueryTimeout( seconds ); } } } catch ( SQLException sqle ) { logger.warn( "Driver indicated error: Failed to set query-timeout: " + queryTimeout, sqle ); } final ResultSet res = getRS( translatedQuery, preparedParameterNames, statement ); final RowSetFactory aFactory = RowSetProvider.newFactory(); final CachedRowSet rowset = aFactory.createCachedRowSet(); try { <START> if ( res != null ) { <END> rowset.populate( res ); } } finally { if ( res != null ) { res.close(); } } final boolean simpleMode = "simple".equalsIgnoreCase( getConfiguration().getConfigProperty( ResultSetTableModelFactory.RESULTSET_FACTORY_MODE ) ); if ( simpleMode ) { return ResultSetTableModelFactory.getInstance().generateDefaultTableModel( rowset, columnNameMapping ); } return ResultSetTableModelFactory.getInstance().createTableModel( rowset, columnNameMapping, true ); } finally { if ( statement != null ) { statement.close(); } } }</code><technical_language>"getRS" method returns null. check away. Statement#executeQuery prepared-statement equivalent guaranteed return a result set throw exception</technical_language>

Target:
protected TableModel parametrizeAndQuery( final DataRow parameters, final String translatedQuery, final String[] preparedParameterNames ) throws SQLException { final boolean callableStatementQuery = isCallableStatementQuery( translatedQuery ); final boolean callableStatementUsed = callableStatementQuery || isCallableStatement( translatedQuery ); final Statement statement = initStatement( parameters, translatedQuery, preparedParameterNames, callableStatementUsed ); try { final Object queryLimit = parameters.get( DataFactory.QUERY_LIMIT ); try { if ( queryLimit instanceof Number ) { final Number i = (Number) queryLimit; final int max = i.intValue(); if ( max > 0 ) { statement.setMaxRows( max ); } } } catch ( SQLException sqle ) { logger.warn( "Driver indicated error: Failed to set query-limit: " + queryLimit, sqle ); } final Object queryTimeout = parameters.get( DataFactory.QUERY_TIMEOUT ); try { if ( queryTimeout instanceof Number ) { final Number i = (Number) queryTimeout; final int seconds = i.intValue(); if ( seconds > 0 ) { statement.setQueryTimeout( seconds ); } } } catch ( SQLException sqle ) { logger.warn( "Driver indicated error: Failed to set query-timeout: " + queryTimeout, sqle ); } final ResultSet res = executeQuery( translatedQuery, preparedParameterNames, statement ); final CachedRowSet rowset = RowSetProvider.newFactory().createCachedRowSet(); try { rowset.populate( res ); } finally { if ( res != null ) { res.close(); } } final boolean simpleMode = "simple".equalsIgnoreCase( getConfiguration().getConfigProperty( ResultSetTableModelFactory.RESULTSET_FACTORY_MODE ) ); if ( simpleMode ) { return ResultSetTableModelFactory.getInstance().generateDefaultTableModel( rowset, columnNameMapping ); } return ResultSetTableModelFactory.getInstance().createTableModel( rowset, columnNameMapping, true ); } finally { if ( statement != null ) { statement.close(); } } }