Buggy code:
public class Methods { private static Connection con = null ; private static PreparedStatement stm = null ; private static ResultSet res = null ; private static String generateHash ( String password , String salt ) { } private static String generateSalt ( ) { } private static void closeSQL ( ) { } private static int getMenuCostPrice ( int menuID ) { if ( menuID < 1 ) { return - 1 ; } int output = - 1 ; try { Methods . con = SQLConnection . openConnection ( ) ; String selectSQL = "SELECT<seq2seq4repair_space>sum(price)<seq2seq4repair_space>AS<seq2seq4repair_space>price<seq2seq4repair_space>FROM<seq2seq4repair_space>ingredient<seq2seq4repair_space>NATURAL<seq2seq4repair_space>JOIN<seq2seq4repair_space>menu_ingredient<seq2seq4repair_space>WHERE<seq2seq4repair_space>menu_id<seq2seq4repair_space>=<seq2seq4repair_space>?" ; Methods . stm = Methods . con . prepareStatement ( selectSQL ) ; Methods . stm . setInt ( 1 , menuID ) ; Methods . res = Methods . stm . executeQuery ( ) ; Methods . res . next ( ) ; <START_BUG> output = Methods . res . getInt ( "role" ) ; <END_BUG> } catch ( SQLException e ) { String errorMessage = "SQL<seq2seq4repair_space>Exception<seq2seq4repair_space>during<seq2seq4repair_space>retrieval<seq2seq4repair_space>of<seq2seq4repair_space>menu<seq2seq4repair_space>cost<seq2seq4repair_space>price,<seq2seq4repair_space>Code:<seq2seq4repair_space>8000027" ; SQLConnection . writeMessage ( e , errorMessage ) ; output = - 1 ; } finally { Methods . closeSQL ( ) ; return output ; } } public static boolean login ( String username , String password ) { } public static boolean changePassword ( String username , String password ) { } public static boolean createUser ( String username , String password , String name , int roleID ) { } public static boolean deleteUser ( String username ) { } public static boolean deleteCustomer ( int customerID ) { } public static ArrayList < ArrayList < String > > listCustomers ( String partName ) { } public static ArrayList < ArrayList < String > > listEmployees ( String partName ) { } public static boolean createCustomer ( String name , String address , String tlf , boolean isCompany ) { } public static boolean setCustomerDiscount ( int customerID , int discount ) { } public static int getRoleID ( String username ) { } public static boolean createOrder ( int customerID , String deliveryTime ) { } public static boolean addMenuToOrder ( int orderID , int menuID , int quantity , String description ) { } public static boolean addSubToOrder ( int subID , int orderID , String fromTime , String toTime ) { } public static boolean removeMenuFromOrder ( int orderID , int menuID ) { } public static boolean addIngredient ( String name , String unit , int price ) { } public static boolean removeIngredient ( int ingredientID ) { } public static boolean createMenu ( String name , String description , int price ) { } public static boolean changeMenu ( int menuID , String name , int price , String description ) { } public static ArrayList < String > getMenuInfo ( int menuID ) { } public static boolean addIngredientToMenu ( int menuID , int ingredientID , int quantity ) { } public static boolean removeIngredientFromMenu ( int menuID , int ingredientID ) { } public static boolean createSubscription ( String description ) { } public static ArrayList < String > getCustomerContactInfo ( int customerID ) { } public static ArrayList < ArrayList < String > > listMenu ( String partName ) { } public static ArrayList < ArrayList < String > > listIngredientsInMenu ( int menuID ) { } No newline ; at end ; of file ; }

Fix:
output = Methods . res . getInt ( "price" ) ;