Buggy code:
public class UserRealm extends JdbcRealm { protected String getUserByEmail = "SELECT<seq2seq4repair_space>`user_id`<seq2seq4repair_space>FROM<seq2seq4repair_space>`user`<seq2seq4repair_space>WHERE<seq2seq4repair_space>`email`<seq2seq4repair_space>=<seq2seq4repair_space>?" ; protected String getUserIdsByGroupId = "SELECT<seq2seq4repair_space>`user_id`<seq2seq4repair_space>FROM<seq2seq4repair_space>`user`<seq2seq4repair_space>WHERE<seq2seq4repair_space>`group`<seq2seq4repair_space>=<seq2seq4repair_space>?" ; protected String newgroupQuery = "INSERT<seq2seq4repair_space>INTO<seq2seq4repair_space>`group`(`group_name`,<seq2seq4repair_space>`professor_id`)<seq2seq4repair_space>VALUES<seq2seq4repair_space>(?,(SELECT<seq2seq4repair_space>`user_id`<seq2seq4repair_space>FROM<seq2seq4repair_space>`user`<seq2seq4repair_space>WHERE<seq2seq4repair_space>`email`<seq2seq4repair_space>=<seq2seq4repair_space>?))" ; protected String newUserQuery = "INSERT<seq2seq4repair_space>INTO<seq2seq4repair_space>`user`(`email`,<seq2seq4repair_space>`last_name`,<seq2seq4repair_space>`first_name`,<seq2seq4repair_space>`password`,<seq2seq4repair_space>`role`,<seq2seq4repair_space>`group`,`gender`)<seq2seq4repair_space>VALUES<seq2seq4repair_space>(?,?,?,?,?,?,?)" ; protected String newProgressQuery = "INSERT<seq2seq4repair_space>INTO<seq2seq4repair_space>`user_progress`<seq2seq4repair_space>VALUES<seq2seq4repair_space>(?,50,50,50,'l000e000')" ; protected String deleteUserQuery = "DELETE<seq2seq4repair_space>FROM<seq2seq4repair_space>`user`<seq2seq4repair_space>WHERE<seq2seq4repair_space>`email`=?" ; protected String deleteGroupQuery = "DELETE<seq2seq4repair_space>FROM<seq2seq4repair_space>`group`<seq2seq4repair_space>WHERE<seq2seq4repair_space>`group_id`=?" ; protected String deleteGroupMembersQuery = "DELETE<seq2seq4repair_space>FROM<seq2seq4repair_space>`user`<seq2seq4repair_space>WHERE<seq2seq4repair_space>`group`=?" ; protected String deleteProfessorQuery = "DELETE<seq2seq4repair_space>FROM<seq2seq4repair_space>`user`<seq2seq4repair_space>WHERE<seq2seq4repair_space>`email`=?" ; protected String getProfessorsQuery = "SELECT<seq2seq4repair_space>`first_name`,<seq2seq4repair_space>`last_name`,<seq2seq4repair_space>`email`<seq2seq4repair_space>FROM<seq2seq4repair_space>`user`<seq2seq4repair_space>WHERE<seq2seq4repair_space>`role`<seq2seq4repair_space>=<seq2seq4repair_space>'professor'" ; protected String updateEmailQuery = "UPDATE<seq2seq4repair_space>`user`SET<seq2seq4repair_space>`email`=?<seq2seq4repair_space>WHERE<seq2seq4repair_space>`email`=?" ; protected String updatePasswordQuery = "UPDATE<seq2seq4repair_space>`user`SET<seq2seq4repair_space>`password`=?<seq2seq4repair_space>WHERE<seq2seq4repair_space>`email`=?" ; protected String setProgressQuery = "UPDATE<seq2seq4repair_space>`user_progress`<seq2seq4repair_space>SET<seq2seq4repair_space>`cost`=?,<seq2seq4repair_space>`quality`=?,<seq2seq4repair_space>`time`=?,<seq2seq4repair_space>`path`=?<seq2seq4repair_space>WHERE<seq2seq4repair_space>`user_id`<seq2seq4repair_space>=<seq2seq4repair_space>?" ; protected String setLvlIdQuery = "UPDATE<seq2seq4repair_space>`user_progress`<seq2seq4repair_space>SET<seq2seq4repair_space>`path`=?<seq2seq4repair_space>WHERE<seq2seq4repair_space>`user_id`<seq2seq4repair_space>=<seq2seq4repair_space>?" ; protected String setCountryTrueQuery = "UPDATE<seq2seq4repair_space>`user_progress`<seq2seq4repair_space>SET<seq2seq4repair_space>%%=true<seq2seq4repair_space>WHERE<seq2seq4repair_space>`user_id`<seq2seq4repair_space>=<seq2seq4repair_space>?" ; protected String getProgressQuery = "SELECT<seq2seq4repair_space>`last_name`,<seq2seq4repair_space>`first_name`,<seq2seq4repair_space>`gender`,`cost`,<seq2seq4repair_space>`quality`,<seq2seq4repair_space>`time`,<seq2seq4repair_space>`path`<seq2seq4repair_space>FROM<seq2seq4repair_space>`user_progress`,<seq2seq4repair_space>`user`<seq2seq4repair_space>WHERE<seq2seq4repair_space>`user_progress`.`user_id`=<seq2seq4repair_space>`user`.`user_id`<seq2seq4repair_space>AND<seq2seq4repair_space>`user_progress`.`user_id`=?" ; protected String getVisitedCountriesQuery = "SELECT<seq2seq4repair_space>l1,<seq2seq4repair_space>l2,<seq2seq4repair_space>l3,<seq2seq4repair_space>l4,<seq2seq4repair_space>l5,<seq2seq4repair_space>l6,<seq2seq4repair_space>l7<seq2seq4repair_space>FROM<seq2seq4repair_space>`user_progress`,<seq2seq4repair_space>`user`<seq2seq4repair_space>WHERE<seq2seq4repair_space>`user_progress`.`user_id`=<seq2seq4repair_space>`user`.`user_id`<seq2seq4repair_space>AND<seq2seq4repair_space>`user_progress`.`user_id`=?" ; protected String getStudentsForProfessorQuery = "SELECT<seq2seq4repair_space>`first_name`,<seq2seq4repair_space>`last_name`,<seq2seq4repair_space>`cost`,<seq2seq4repair_space>`quality`,<seq2seq4repair_space>`time`<seq2seq4repair_space>,<seq2seq4repair_space>`group_name`,<seq2seq4repair_space>`email`,<seq2seq4repair_space>`group`<seq2seq4repair_space>FROM<seq2seq4repair_space>`user`,<seq2seq4repair_space>`user_progress`<seq2seq4repair_space>,<seq2seq4repair_space>`group`<seq2seq4repair_space>WHERE<seq2seq4repair_space>`user`.`user_id`<seq2seq4repair_space>=<seq2seq4repair_space>`user_progress`.`user_id`<seq2seq4repair_space>AND`user`.`group`<seq2seq4repair_space>IN<seq2seq4repair_space>(SELECT<seq2seq4repair_space>`group_id`<seq2seq4repair_space>FROM<seq2seq4repair_space>`group`<seq2seq4repair_space>WHERE<seq2seq4repair_space>`professor_id`<seq2seq4repair_space>=<seq2seq4repair_space>(SELECT<seq2seq4repair_space>`user_id`<seq2seq4repair_space>FROM`user`<seq2seq4repair_space>WHERE<seq2seq4repair_space>`email`<seq2seq4repair_space>=<seq2seq4repair_space>?))<seq2seq4repair_space>AND<seq2seq4repair_space>`user`.`group`<seq2seq4repair_space>=<seq2seq4repair_space>`group`.`group_id`<seq2seq4repair_space>ORDER<seq2seq4repair_space>BY<seq2seq4repair_space>`last_name`<seq2seq4repair_space>ASC" ; protected String getGroupsForProfessorQuery = "SELECT<seq2seq4repair_space>*<seq2seq4repair_space>FROM<seq2seq4repair_space>`group`WHERE<seq2seq4repair_space>`professor_id`=<seq2seq4repair_space>(SELECT<seq2seq4repair_space>`user_id`<seq2seq4repair_space>FROM<seq2seq4repair_space>`user`<seq2seq4repair_space>WHERE<seq2seq4repair_space>`email`<seq2seq4repair_space>=<seq2seq4repair_space>?)ORDER<seq2seq4repair_space>BY<seq2seq4repair_space>`group_name`<seq2seq4repair_space>ASC" ; protected String groupExistsQuery = "SELECT<seq2seq4repair_space>COUNT(`group_id`)<seq2seq4repair_space>FROM<seq2seq4repair_space>`group`<seq2seq4repair_space>WHERE<seq2seq4repair_space>`group_id`=?" ; protected String userExistsQuery = "SELECT<seq2seq4repair_space>Count(email)<seq2seq4repair_space>from<seq2seq4repair_space>`user`<seq2seq4repair_space>WHERE<seq2seq4repair_space>`email`=?" ; protected String getSettings = "SELECT<seq2seq4repair_space>*<seq2seq4repair_space>FROM<seq2seq4repair_space>`settings`" ; protected String setSettings = "UPDATE<seq2seq4repair_space>`settings`<seq2seq4repair_space>SET<seq2seq4repair_space>`audio`=?,<seq2seq4repair_space>`video`=?,<seq2seq4repair_space>`tts`=?,<seq2seq4repair_space>`subtitles`=?" ; public UserRealm ( ) { } protected void createNewGroup ( String groupname , String professor ) throws SQLException { } protected ArrayList < Boolean > getSettings ( ) throws SQLException { } protected void setSettings ( Boolean audio , Boolean video , Boolean tts , Boolean subtitles ) throws SQLException { } protected ArrayList < ArrayList < String > > getUsersForProfessor ( String professor ) throws SQLException { } protected ArrayList < String > getUserIdsByGroupId ( String group_id ) throws SQLException { } protected ArrayList < ArrayList < String > > getProfessors ( ) throws SQLException { } protected ArrayList < ArrayList < String > > getGroupsForProfessor ( String professor ) throws SQLException { } protected boolean groupExists ( String groupid ) throws SQLException { } protected boolean userExists ( String email ) throws SQLException { } protected void createNewUser ( String email , String lastname , String firstname , String password , String role , String group , int gender ) throws SQLException { } protected void updateEmail ( String email , String unverifiedEmail ) throws SQLException { } protected void updatePassword ( String email , String password ) throws SQLException { } public void setUserProgress ( String userid , int costs , int quality , int time , String path ) throws SQLException { } public void setUserCountry ( String userId , String gamepath ) throws SQLException { } public void setLvlId ( String userId , String lvlId ) throws SQLException { } public void deleteUser ( String email ) throws SQLException { } public void deleteGroup ( String group_id ) throws SQLException { } public void deleteGroupMembers ( String group_id ) throws SQLException { } public void deleteProfessor ( String email ) throws SQLException { } public String getUserByEmail ( String email ) throws SQLException { } public ArrayList < Object > getUserProgress ( String userid ) throws SQLException { } public ArrayList < String > getVisitedCountries ( String userid ) { ArrayList < String > visitedCountries = new ArrayList < String > ( ) ; PreparedStatement ps ; ResultSet rs ; try { Connection conn = dataSource . getConnection ( ) ; ps = conn . prepareStatement ( getVisitedCountriesQuery ) ; ps . setString ( 1 , userid ) ; rs = ps . executeQuery ( ) ; while ( rs . next ( ) ) { <START_BUG> for ( int l = 1 ; l < 0 ; l ++ ) { <END_BUG> if ( rs . getBoolean ( ( l + 1 ) ) ) visitedCountries . add ( ( "l" + l ) ) ; } } } catch ( SQLException e ) { e . printStackTrace ( ) ; } return visitedCountries ; } public void resetUserProgress ( String userEmail ) throws SQLException { } public boolean isUserFinished ( String userEmail ) throws SQLException { } }

Fix:
for ( int l = 1 ; l < 8 ; l ++ ) {