[Demonstration 1]

[Buggy Method]
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
    response.setContentType("text/html");
    HttpSession session = request.getSession();
    try {
        Employee emp = (Employee) session.getAttribute("user");
        FoodOrderController foodOrderController = new FoodOrderController();
        FoodDisplayPaymentController foodDisplayPaymentController = new FoodDisplayPaymentController();
        List<FoodOrder> foodOrderList = foodOrderController.getFoodOrderSet(emp.getEmail());
        System.out.println(foodOrderList.size());
        session.setAttribute("foodDisplayPaymentList", foodDisplayPaymentController.renderFoodDisplayPaymentList(foodOrderList));
        response.sendRedirect("/eureka_webservice/pages/payment.jsp");
    } catch (Exception e) {
        e.printStackTrace();
        System.out.println("Error msg: " + e.getMessage());
        session.setAttribute("error", "Something went wrong");
        response.sendRedirect("/eureka_webservice/pages/homepage.jsp");
    }
}

[Buggy Hunk]
List<FoodOrder> foodOrderList = foodOrderController.getFoodOrderSet(emp.getEmail());

[Patch]
List<FoodOrder> foodOrderList = foodOrderController.getUserFoodOrdersByStatus(emp.getEmail(),"Submitted");

[Demonstration 2]

[Buggy Method]
public ArrayList<Match> getMatches(int tourId, Tour tour, HashMap<Integer, Player> players) {
    String selectQuery = "SELECT * FROM " + TABLE_MATCH + " WHERE " + KEY_TOUR_ID + "=" + tourId;
    ArrayList<Match> matches = new ArrayList<Match>();
    Cursor cursor = db.rawQuery(selectQuery, null);
    cursor.moveToFirst();
    while (!cursor.isAfterLast()) {
        int id = cursor.getInt(cursor.getColumnIndex(KEY_ID));
        int homePlayerId = cursor.getInt(cursor.getColumnIndex(KEY_HOME_PLAYER));
        Player homePlayer = players.get(homePlayerId);
        int homeScoreColumn = cursor.getColumnIndex(KEY_HOME_SCORE);
        Integer homeScore = null;
        if (!cursor.isNull(homeScoreColumn)) {
            homeScore = new Integer(cursor.getInt(homeScoreColumn));
        }
        int homeTeamId = cursor.getInt(cursor.getColumnIndex(KEY_HOME_TEAM));
        Team homeTeam = getTeam(homeTeamId);
        int awayPlayerId = cursor.getInt(cursor.getColumnIndex(KEY_AWAY_PLAYER));
        int awayTeamId = cursor.getInt(cursor.getColumnIndex(KEY_AWAY_TEAM));
        int awayScoreColumn = cursor.getColumnIndex(KEY_AWAY_SCORE);
        Integer awayScore = null;
        if (!cursor.isNull(awayScoreColumn)) {
            homeScore = new Integer(cursor.getInt(awayScoreColumn));
        }
        Player awayPlayer = players.get(awayPlayerId);
        Team awayTeam = getTeam(awayTeamId);
        matches.add(new Match(homePlayer, awayPlayer, homeTeam, awayTeam, homeScore, awayScore, tour, id));
        cursor.moveToNext();
    }
    cursor.close();
    return matches;
}

[Buggy Hunk]
homeScore = new Integer(cursor.getInt(awayScoreColumn));

[Patch]
awayScore = new Integer(cursor.getInt(awayScoreColumn));

[Demonstration 3]

[Buggy Method]
private void getPhotos(JSONArray args, final CallbackContext callbackContext) throws JSONException {
    final CordovaWebView webView = this.webView;
    cordova.getThreadPool().execute(new Runnable() {

        @Override
        public void run() {
            // We discover every video / photo stored on the phone and ask the _data field, which is the full
            // path of the file
            discover(MediaStore.Video.Media.query(webView.getContext().getContentResolver(), MediaStore.Video.Media.EXTERNAL_CONTENT_URI, new String[] { MediaStore.Video.Media.DATA }, null, null, MediaStore.Video.Media.DATE_MODIFIED + " ASC"));
            discover(MediaStore.Images.Media.query(webView.getContext().getContentResolver(), MediaStore.Images.Media.EXTERNAL_CONTENT_URI, new String[] { MediaStore.Images.Media.DATA }, null, null, MediaStore.Images.Media.DATE_MODIFIED + " ASC"));
        }

        public discover(Cursor cursor) {
            while (cursor.moveToNext()) {
                for (int i = 0; i < cursor.getColumnCount(); i++) {
                    if (cursor.getColumnName(i).equals("_data")) {
                        Log.d(TAG, "Discovering " + cursor.getString(i));
                        // The callbackContext.success() method can only be called once
                        PluginResult result = new PluginResult(PluginResult.Status.OK, cursor.getString(i));
                        result.setKeepCallback(true);
                        callbackContext.sendPluginResult(result);
                    }
                }
            }
        }
    });
}

[Buggy Hunk]
public discover(Cursor cursor) {

[Patch]
private void discover(Cursor cursor) {