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" ; 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 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 getNumPreferenceForItemSQL ; private final String getNumPreferenceForItemsSQL ; private int cachedNumUsers ; private int cachedNumItems ; private final Cache < Long , Integer > itemPrefCounts ; protected AbstractJDBCDataModel ( DataSource dataSource , String getPreferenceSQL , String getUserSQL , String getAllUsersSQL , String getNumItemsSQL , String getNumUsersSQL , String setPreferenceSQL , String removePreferenceSQL , String getUsersSQL , String getItemsSQL , String getPrefsForItemSQL , String getNumPreferenceForItemSQL , String getNumPreferenceForItemsSQL ) { } protected AbstractJDBCDataModel ( DataSource dataSource , String preferenceTable , String userIDColumn , String itemIDColumn , String preferenceColumn , String getPreferenceSQL , String getUserSQL , String getAllUsersSQL , String getNumItemsSQL , String getNumUsersSQL , String setPreferenceSQL , String removePreferenceSQL , String getUsersSQL , String getItemsSQL , String getPrefsForItemSQL , String getNumPreferenceForItemSQL , String getNumPreferenceForItemsSQL ) { } @ Override public DataSource getDataSource ( ) { } public String getPreferenceTable ( ) { } public String getUserIDColumn ( ) { } public String getItemIDColumn ( ) { } public String getPreferenceColumn ( ) { } @ Override public LongPrimitiveIterator getUserIDs ( ) throws TasteException { } @ Override public PreferenceArray getPreferencesFromUser ( long id ) throws TasteException { } @ Override public FastByIDMap < PreferenceArray > exportWithPrefs ( ) throws TasteException { } @ Override public FastByIDMap < FastIDSet > exportWithIDsOnly ( ) throws TasteException { } @ Override public FastIDSet getItemIDsFromUser ( long id ) throws TasteException { AbstractJDBCDataModel . log . debug ( "Retrieving<seq2seq4repair_space>items<seq2seq4repair_space>for<seq2seq4repair_space>user<seq2seq4repair_space>ID<seq2seq4repair_space>'{}'" , id ) ; Connection conn = null ; PreparedStatement stmt = null ; ResultSet rs = null ; try { conn = dataSource . getConnection ( ) ; stmt = conn . prepareStatement ( getUserSQL , ResultSet . TYPE_FORWARD_ONLY , ResultSet . CONCUR_READ_ONLY ) ; stmt . setFetchDirection ( ResultSet . FETCH_FORWARD ) ; stmt . setFetchSize ( getFetchSize ( ) ) ; stmt . setLong ( 1 , id ) ; AbstractJDBCDataModel . log . debug ( "Executing<seq2seq4repair_space>SQL<seq2seq4repair_space>query:<seq2seq4repair_space>{}" , getUserSQL ) ; rs = stmt . executeQuery ( ) ; FastIDSet result = new FastIDSet ( ) ; while ( rs . next ( ) ) { <START_BUG> result . add ( rs . getLong ( 1 ) ) ; <END_BUG> } if ( result . isEmpty ( ) ) { throw new NoSuchUserException ( ) ; } return result ; } catch ( SQLException sqle ) { AbstractJDBCDataModel . log . warn ( "Exception<seq2seq4repair_space>while<seq2seq4repair_space>retrieving<seq2seq4repair_space>item<seq2seq4repair_space>s" , sqle ) ; throw new TasteException ( sqle ) ; } finally { IOUtils . quietClose ( rs , stmt , conn ) ; } } @ Override public Float getPreferenceValue ( long userID , long itemID ) throws TasteException { } @ 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 ... itemIDs ) 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 ) { } protected Preference buildPreference ( ResultSet rs ) throws SQLException { } private final class ResultSetIDIterator implements LongPrimitiveIterator , SkippingIterator < Long > { private final Connection connection ; private final Statement statement ; private final ResultSet resultSet ; private boolean closed ; private ResultSetIDIterator ( String sql ) throws TasteException { } @ Override public boolean hasNext ( ) { } @ Override public Long next ( ) { } @ Override public long nextLong ( ) { } @ Override public long peek ( ) { } @ Override public void remove ( ) { } private void close ( ) { } @ Override public void skip ( int n ) { } } private class ItemPrefCountRetriever implements Retriever < Long , Integer > { private final String getNumPreferenceForItemSQL ; private ItemPrefCountRetriever ( String getNumPreferenceForItemSQL ) { } @ Override public Integer get ( Long key ) throws TasteException { } } }

Fix:
result . add ( rs . getLong ( 2 ) ) ;