Buggy code:
public abstract class AbstractJDBCDataModel extends AbstractJDBCComponent implements JDBCDataModel { private static final Logger log = LoggerFactory . getLogger ( AbstractJDBCDataModel . class ) ; public static final String DEFAULT_PREFERENCE_TABLE = "taste_preferences" ; public static final String DEFAULT_USER_ID_COLUMN = "user_id" ; public static final String DEFAULT_ITEM_ID_COLUMN = "item_id" ; public static final String DEFAULT_PREFERENCE_COLUMN = "preference" ; public static final String DEFAULT_PREFERENCE_TIME_COLUMN = "timestamp" ; private final DataSource dataSource ; private final String preferenceTable ; private final String userIDColumn ; private final String itemIDColumn ; private final String preferenceColumn ; private final String getPreferenceSQL ; private final String getPreferenceTimeSQL ; private final String getUserSQL ; private final String getAllUsersSQL ; private final String getNumItemsSQL ; private final String getNumUsersSQL ; private final String setPreferenceSQL ; private final String removePreferenceSQL ; private final String getUsersSQL ; private final String getItemsSQL ; private final String getPrefsForItemSQL ; private final String getNumPreferenceForItemsSQL ; private final String getMaxPreferenceSQL ; private final String getMinPreferenceSQL ; private int cachedNumUsers ; private int cachedNumItems ; private final Cache < Long , Integer > itemPrefCounts ; private float maxPreference ; private float minPreference ; protected AbstractJDBCDataModel ( DataSource dataSource , String getPreferenceSQL , String getPreferenceTimeSQL , String getUserSQL , String getAllUsersSQL , String getNumItemsSQL , String getNumUsersSQL , String setPreferenceSQL , String removePreferenceSQL , String getUsersSQL , String getItemsSQL , String getPrefsForItemSQL , String getNumPreferenceForItemSQL , String getNumPreferenceForItemsSQL , String getMaxPreferenceSQL , String getMinPreferenceSQL ) { } protected AbstractJDBCDataModel ( DataSource dataSource , String preferenceTable , String userIDColumn , String itemIDColumn , String preferenceColumn , String getPreferenceSQL , String getPreferenceTimeSQL , String getUserSQL , String getAllUsersSQL , String getNumItemsSQL , String getNumUsersSQL , String setPreferenceSQL , String removePreferenceSQL , String getUsersSQL , String getItemsSQL , String getPrefsForItemSQL , String getNumPreferenceForItemSQL , String getNumPreferenceForItemsSQL , String getMaxPreferenceSQL , String getMinPreferenceSQL ) { } @ Override public DataSource getDataSource ( ) { } public String getPreferenceTable ( ) { } public String getUserIDColumn ( ) { } public String getItemIDColumn ( ) { } public String getPreferenceColumn ( ) { } String getSetPreferenceSQL ( ) { } @ Override public LongPrimitiveIterator getUserIDs ( ) throws TasteException { } @ Override public PreferenceArray getPreferencesFromUser ( long userID ) throws TasteException { } @ Override public FastByIDMap < PreferenceArray > exportWithPrefs ( ) throws TasteException { } @ Override public FastByIDMap < FastIDSet > exportWithIDsOnly ( ) throws TasteException { } @ Override public FastIDSet getItemIDsFromUser ( long userID ) throws TasteException { } @ Override public Float getPreferenceValue ( long userID , long itemID ) throws TasteException { } @ Override public Long getPreferenceTime ( long userID , long itemID ) throws TasteException { if ( ( getPreferenceTimeSQL ) == null ) { return null ; } AbstractJDBCDataModel . log . debug ( "Retrieving<seq2seq4repair_space>preference<seq2seq4repair_space>time<seq2seq4repair_space>for<seq2seq4repair_space>item<seq2seq4repair_space>ID<seq2seq4repair_space>'{}'" , itemID ) ; Connection conn = null ; PreparedStatement stmt = null ; ResultSet rs = null ; try { conn = dataSource . getConnection ( ) ; <START_BUG> stmt = conn . prepareStatement ( getPreferenceSQL , ResultSet . TYPE_FORWARD_ONLY , ResultSet . CONCUR_READ_ONLY ) ; <END_BUG> stmt . setFetchDirection ( ResultSet . FETCH_FORWARD ) ; stmt . setFetchSize ( 1 ) ; setLongParameter ( stmt , 1 , userID ) ; setLongParameter ( stmt , 2 , itemID ) ; AbstractJDBCDataModel . log . debug ( "Executing<seq2seq4repair_space>SQL<seq2seq4repair_space>query:<seq2seq4repair_space>{}" , getPreferenceTimeSQL ) ; rs = stmt . executeQuery ( ) ; if ( rs . next ( ) ) { return rs . getLong ( 1 ) ; } else { return null ; } } catch ( SQLException sqle ) { AbstractJDBCDataModel . log . warn ( "Exception<seq2seq4repair_space>while<seq2seq4repair_space>retrieving<seq2seq4repair_space>time<seq2seq4repair_space>for<seq2seq4repair_space>item" , sqle ) ; throw new TasteException ( sqle ) ; } finally { IOUtils . quietClose ( rs , stmt , conn ) ; } } @ Override public LongPrimitiveIterator getItemIDs ( ) throws TasteException { } @ Override public PreferenceArray getPreferencesForItem ( long itemID ) throws TasteException { } protected List < Preference > doGetPreferencesForItem ( long itemID ) throws TasteException { } @ Override public int getNumItems ( ) throws TasteException { } @ Override public int getNumUsers ( ) throws TasteException { } @ Override public int getNumUsersWithPreferenceFor ( long itemID ) throws TasteException { } @ Override public int getNumUsersWithPreferenceFor ( long itemID1 , long itemID2 ) throws TasteException { } private int getNumThings ( String name , String sql , long ... args ) throws TasteException { } @ Override public void setPreference ( long userID , long itemID , float value ) throws TasteException { } @ Override public void removePreference ( long userID , long itemID ) throws TasteException { } @ Override public void refresh ( Collection < Refreshable > alreadyRefreshed ) { } @ Override public boolean hasPreferenceValues ( ) { } @ Override public float getMaxPreference ( ) { } @ Override public float getMinPreference ( ) { } protected Preference buildPreference ( ResultSet rs ) throws SQLException { } protected long getLongColumn ( ResultSet rs , int position ) throws SQLException { } protected void setLongParameter ( PreparedStatement stmt , int position , long value ) throws SQLException { } private final class ResultSetIDIterator extends ResultSetIterator < Long > implements LongPrimitiveIterator { private ResultSetIDIterator ( String sql ) throws SQLException { } @ Override protected Long parseElement ( ResultSet resultSet ) throws SQLException { } @ Override public long nextLong ( ) { } @ Override public long peek ( ) { } } private final class ItemPrefCountRetriever implements Retriever < Long , Integer > { private final String getNumPreferenceForItemSQL ; private ItemPrefCountRetriever ( String getNumPreferenceForItemSQL ) { } @ Override public Integer get ( Long key ) throws TasteException { } } }

Fix:
stmt = conn . prepareStatement ( getPreferenceTimeSQL , ResultSet . TYPE_FORWARD_ONLY , ResultSet . CONCUR_READ_ONLY ) ;