[Demonstration 1]

[Buggy Method]
public static void main(String[] args) {
    // TODO code application logic here
    ToDoGUI gui = new ToDoGUI();
    gui.setVisible(true);
}

[Buggy Hunk]
public static void main(String[] args) {

[Patch]
public static void main(String[] args) throws IOException, FileNotFoundException, ClassNotFoundException {

[Demonstration 2]

[Buggy Method]
@Test
public void allTests() throws Exception {
    ______TS("Send feedback session reminder email");
    FeedbackSessionAttributes session1 = dataBundle.feedbackSessions.get("session1InCourse1");
    // re-read from Datastore to update the respondents list
    session1 = fsLogic.getFeedbackSession(session1.getFeedbackSessionName(), session1.getCourseId());
    String[] submissionParams = new String[] { ParamsNames.SUBMISSION_FEEDBACK, session1.getFeedbackSessionName(), ParamsNames.SUBMISSION_COURSE, session1.getCourseId() };
    FeedbackSessionRemindEmailWorkerAction action = getAction(submissionParams);
    action.execute();
    // 2 students and 4 instructors sent reminder, 5 instructors notified
    verifySpecifiedTasksAdded(action, Const.TaskQueue.SEND_EMAIL_QUEUE_NAME, 11);
    List<String> studentRecipientList = new ArrayList<String>();
    for (StudentAttributes student : studentsLogic.getStudentsForCourse(session1.getCourseId())) {
        if (!fsLogic.isFeedbackSessionCompletedByStudent(session1, student.email)) {
            studentRecipientList.add(student.email);
        }
    }
    List<String> instructorRecipientList = new ArrayList<String>();
    List<String> instructorNotifiedList = new ArrayList<String>();
    for (InstructorAttributes instructor : instructorsLogic.getInstructorsForCourse(session1.getCourseId())) {
        if (!fsLogic.isFeedbackSessionCompletedByInstructor(session1, instructor.email)) {
            instructorRecipientList.add(instructor.email);
        }
        instructorNotifiedList.add(instructor.email);
    }
    String courseName = coursesLogic.getCourse(session1.getCourseId()).getName();
    List<TaskWrapper> tasksAdded = action.getTaskQueuer().getTasksAdded();
    for (TaskWrapper task : tasksAdded) {
        Map<String, String[]> paramMap = task.getParamMap();
        assertEquals(String.format(EmailType.FEEDBACK_SESSION_REMINDER.getSubject(), courseName, session1.getSessionName()), paramMap.get(ParamsNames.EMAIL_SUBJECT)[0]);
        String header = "The email below has been sent to students of course: " + session1.getCourseId();
        String content = paramMap.get(ParamsNames.EMAIL_CONTENT)[0];
        String recipient = paramMap.get(ParamsNames.EMAIL_RECEIVER)[0];
        if (content.contains(header)) {
            // notification to all instructors
            assertTrue(instructorNotifiedList.contains(recipient));
            instructorNotifiedList.remove(recipient);
            continue;
        }
        if (studentRecipientList.contains(recipient)) {
            studentRecipientList.remove(recipient);
            continue;
        }
        if (instructorRecipientList.contains(recipient)) {
            instructorRecipientList.remove(recipient);
            continue;
        }
        fail("Email recipient " + recipient + " is not in the list!");
    }
    // Ensure that every email recipient is accounted for
    assertTrue(String.valueOf(studentRecipientList.size()), studentRecipientList.isEmpty());
    assertTrue(String.valueOf(instructorRecipientList.size()), instructorRecipientList.isEmpty());
    assertTrue(instructorNotifiedList.isEmpty());
}

[Buggy Hunk]
String header = "The email below has been sent to students of course: " + session1.getCourseId();

[Patch]
String header = "The email below has been sent to students of course: [" + session1.getCourseId() + "]";

[Demonstration 3]

[Buggy Method]
public static void main(String[] args) {
    if (args.length <= 1) {
        System.out.println("Not enough parameters");
        return;
    }
    File data = new File(args[0]);
    int Ls = 150, tol = 5, order = 64;
    /*
		 * If another argument is present, it is assumed to be
		 * the length Ls of the stored sequence parts.
		 */
    if (args.length > 1) {
        try {
            Ls = Integer.parseInt(args[1]);
        } catch (Exception ex) {
            ex.printStackTrace();
            return;
        }
    }
    /*
		 * If a 3rd argument is present, it is assumed to be
		 * equal to the order of the encoding vector.
		 */
    if (args.length > 2) {
        try {
            order = Integer.parseInt(args[2]);
        } catch (Exception ex) {
            ex.printStackTrace();
            return;
        }
    }
    try {
        TrieKeyDistro bq = new TrieKeyDistro(Ls, 1, order);
        bq.initIndex(data);
        bq.printLeafSizes();
    } catch (Exception ex) {
        ex.printStackTrace();
    }
}

[Buggy Hunk]
int Ls = 150, tol = 5, order = 64;

[Patch]
int Ls = 150, order = 64;