Buggy code:
public class QuizManager { private Connection con ; public QuizManager ( Connection con ) { } public void addQuiz ( String name , String description , int author , String category , String tags , boolean random , boolean pages , boolean correction , int points ) { } public void updateQuiz ( String name , String description , String category , String tags , boolean random , boolean pages , boolean correction , int quiz_id ) { } public int getIDByName ( String name ) { } public String getQuizNameByID ( int id ) { } public Quiz getQuizByID ( int quiz_id ) { } public ArrayList < Quiz > getQuizzes ( ) { } public ArrayList < Quiz > searchQuizzes ( String name , String category , String tag ) { } public int numTimesTaken ( int quiz_id ) { } public double avgQuizScore ( int quiz_id ) { } public int quizRange ( int quiz_id ) { } public ArrayList < Quiz > getPopularQuizzes ( ) { } public void updateQuizPoints ( int quiz_id , int points ) { } public int getQuizPoints ( int quiz_id ) { } public String convertToPercStr ( double score , double total ) { } public double calculateRating ( int quiz_id ) { } public void addQuizResult ( int quiz_id , int user_id , int score , int total , int rating , String review , String name , Timestamp time_taken ) { } public ArrayList < QuizHistory > getQuizHistory ( int quiz_id , int user_id , String type ) { ArrayList < QuizHistory > history = new ArrayList < QuizHistory > ( ) ; try { Calendar calendar = Calendar . getInstance ( ) ; calendar . add ( Calendar . HOUR , ( - 24 ) ) ; Timestamp yesterTimeStamp = new Timestamp ( calendar . getTime ( ) . getTime ( ) ) ; Statement selectStmt = con . createStatement ( ) ; ResultSet rs = null ; if ( type . equals ( "past<seq2seq4repair_space>performance" ) ) { rs = selectStmt . executeQuery ( ( ( ( ( "SELECT<seq2seq4repair_space>*<seq2seq4repair_space>FROM<seq2seq4repair_space>quiz_history<seq2seq4repair_space>WHERE<seq2seq4repair_space>quiz_id<seq2seq4repair_space>=<seq2seq4repair_space>\"" + quiz_id ) + "\"<seq2seq4repair_space>AND<seq2seq4repair_space>user_id<seq2seq4repair_space>=<seq2seq4repair_space>\"" ) + user_id ) + "\"<seq2seq4repair_space>ORDER<seq2seq4repair_space>BY<seq2seq4repair_space>date_time<seq2seq4repair_space>DESC,<seq2seq4repair_space>time_taken<seq2seq4repair_space>ASC" ) ) ; } else if ( ( type . equals ( "all<seq2seq4repair_space>time<seq2seq4repair_space>high" ) ) || ( type . equals ( "last<seq2seq4repair_space>day<seq2seq4repair_space>high" ) ) ) { rs = selectStmt . executeQuery ( ( ( "SELECT<seq2seq4repair_space>*<seq2seq4repair_space>FROM<seq2seq4repair_space>quiz_history<seq2seq4repair_space>WHERE<seq2seq4repair_space>quiz_id<seq2seq4repair_space>=<seq2seq4repair_space>\"" + quiz_id ) + "\"<seq2seq4repair_space>ORDER<seq2seq4repair_space>BY<seq2seq4repair_space>score<seq2seq4repair_space>DESC,<seq2seq4repair_space>time_taken<seq2seq4repair_space>ASC" ) ) ; } else if ( type . equals ( "recent" ) ) { rs = selectStmt . executeQuery ( ( ( "SELECT<seq2seq4repair_space>*<seq2seq4repair_space>FROM<seq2seq4repair_space>quiz_history<seq2seq4repair_space>WHERE<seq2seq4repair_space>quiz_id<seq2seq4repair_space>=<seq2seq4repair_space>\"" + quiz_id ) + "\"<seq2seq4repair_space>ORDER<seq2seq4repair_space>BY<seq2seq4repair_space>date_time<seq2seq4repair_space>DESC,<seq2seq4repair_space>time_taken<seq2seq4repair_space>ASC" ) ) ; } else if ( type . equals ( "reviews" ) ) { <START_BUG> rs = selectStmt . executeQuery ( ( ( ( ( "SELECT<seq2seq4repair_space>*<seq2seq4repair_space>FROM<seq2seq4repair_space>quiz_history<seq2seq4repair_space>WHERE<seq2seq4repair_space>quiz_id<seq2seq4repair_space>=<seq2seq4repair_space>\"" + quiz_id ) + "\"<seq2seq4repair_space>AND<seq2seq4repair_space>user_id<seq2seq4repair_space>=<seq2seq4repair_space>\"" ) + user_id ) + "\"<seq2seq4repair_space>ORDER<seq2seq4repair_space>BY<seq2seq4repair_space>date_time<seq2seq4repair_space>DESC" ) ) ; <END_BUG> } while ( rs . next ( ) ) { QuizHistory qh = new QuizHistory ( rs . getInt ( "quiz_history_id" ) , rs . getInt ( "quiz_id" ) , rs . getInt ( "user_id" ) , rs . getInt ( "score" ) , rs . getInt ( "total" ) , rs . getInt ( "rating" ) , rs . getString ( "review" ) , rs . getString ( "name" ) , rs . getTimestamp ( "date_time" ) ) ; if ( type . equals ( "last<seq2seq4repair_space>day<seq2seq4repair_space>high" ) ) { Timestamp timeStamp = new Timestamp ( ( ( Date ) ( rs . getDate ( "date_time" ) ) ) . getTime ( ) ) ; if ( timeStamp . after ( yesterTimeStamp ) ) { history . add ( qh ) ; } } else { history . add ( qh ) ; } } } catch ( SQLException e ) { e . printStackTrace ( ) ; } return history ; } public boolean checkQuizReported ( int quiz_id ) { } public void reportQuiz ( int quiz_id ) { } public void unreportQuiz ( int quiz_id ) { } public boolean authorAchievement ( int user_id ) { } public boolean quizTakerAchievement ( int user_id ) { } public boolean practiceMakesPerfect ( int user_id ) { } public boolean iAmGreatestAchievement ( int user_id , int quiz_id , int score ) { } public ArrayList < String > getAchievements ( int user_id ) { } public ArrayList < Quiz > getMostRecentlyCreatedQuizzes ( ) { } public boolean quizExists ( int quiz_id ) { } }

Fix:
rs = selectStmt . executeQuery ( ( ( "SELECT<seq2seq4repair_space>*<seq2seq4repair_space>FROM<seq2seq4repair_space>quiz_history<seq2seq4repair_space>WHERE<seq2seq4repair_space>quiz_id<seq2seq4repair_space>=<seq2seq4repair_space>\"" + quiz_id ) + "\"<seq2seq4repair_space>ORDER<seq2seq4repair_space>BY<seq2seq4repair_space>date_time<seq2seq4repair_space>DESC" ) ) ;