[Demonstration 1]

[Buggy Method]
@Test
public void testNewTaskWithMapContent() {
    String str = "(with (new Task()) { priority = 55, taskData = (with( new TaskData()) { } ), ";
    str += "peopleAssignments = (with ( new PeopleAssignments() ) { potentialOwners = [new User('Bobba Fet') ],businessAdministrators = [ new User('Administrator') ], }),";
    str += "name =  'This is my task name' })";
    Map<String, Object> variablesMap = new HashMap<String, Object>();
    variablesMap.put("key1", "value1");
    variablesMap.put("key2", null);
    variablesMap.put("key3", "value3");
    ContentData data = ContentMarshallerHelper.marshal(variablesMap, null);
    Task task = (Task) TaskFactory.evalTask(new StringReader(str));
    taskService.addTask(task, data);
    long taskId = task.getId();
    // Task should be assigned to the single potential owner and state set to Reserved
    Task task1 = taskService.getTaskById(taskId);
    assertEquals(AccessType.Inline, ((InternalTaskData) task1.getTaskData()).getDocumentAccessType());
    assertEquals("java.util.HashMap", task1.getTaskData().getDocumentType());
    long contentId = task1.getTaskData().getDocumentContentId();
    assertTrue(contentId != -1);
    // content
    Content content = taskService.getContentById(contentId);
    Object unmarshalledObject = ContentMarshallerHelper.unmarshall(content.getContent(), null);
    if (!(unmarshalledObject instanceof Map)) {
        fail("The variables should be a Map");
    }
    Map<String, Object> unmarshalledvars = (Map<String, Object>) unmarshalledObject;
    JaxbContent jaxbContent = xmlRoundTripContent(content);
    assertNotNull("Jaxb Content map not filled", jaxbContent.getContentMap());
    assertEquals("value1", unmarshalledvars.get("key1"));
    assertNull(unmarshalledvars.get("key2"));
    assertEquals("value3", unmarshalledvars.get("key3"));
}

[Buggy Hunk]
Task task = ( Task )  TaskFactory.evalTask( new StringReader( str ));

[Patch]
Task task = TaskFactory.evalTask( new StringReader( str ));

[Demonstration 2]

[Buggy Method]
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_registration);
    final String logTag = "RegistrationActivity";
    final EditText usernameButton = (EditText) findViewById(R.id.usernameInput);
    final EditText passwordButton = (EditText) findViewById(R.id.passwordInput);
    Button registerButton = (Button) findViewById(R.id.registerButton);
    Button backButton = (Button) findViewById(R.id.backButton);
    backButton.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View view) {
            Intent welcome = new Intent(getApplicationContext(), WelcomeActivity.class);
            startActivity(welcome);
        }
    });
    registerButton.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View view) {
            boolean validData = BackendManager.validateUserPassword(usernameButton.getText().toString(), passwordButton.getText().toString(), getApplicationContext());
            final String username = usernameButton.getText().toString();
            final String password = passwordButton.getText().toString();
            if (!validData) {
                return;
            }
            new AsyncTask<Void, String, String>() {

                @Override
                protected String doInBackground(Void... voids) {
                    try {
                        URL url = new URL(BackendManager.generateRegistrationURL(username, password));
                        try {
                            HttpURLConnection urlConnection = (HttpURLConnection) url.openConnection();
                            urlConnection.setRequestMethod("GET");
                            urlConnection.setConnectTimeout(5000);
                            urlConnection.setReadTimeout(5000);
                            urlConnection.setRequestProperty("user-agent", "Android");
                            urlConnection.setRequestProperty("Content-Type", "application/x-zip");
                            urlConnection.connect();
                            int statusCode = urlConnection.getResponseCode();
                            if (statusCode != 200) {
                                // bad stuff happened
                                Log.d(logTag, "CRITICAL: Registration failed, response code " + statusCode);
                                return "";
                            } else {
                                try {
                                    InputStream in = new BufferedInputStream(urlConnection.getInputStream());
                                    String result = BackendManager.getStringFromInputStream(in);
                                    Log.d(logTag, "Verified user with ID " + result);
                                    BackendManager.setUserToken(result);
                                    BackendManager.setUsername(username);
                                    urlConnection.disconnect();
                                    return "Welcome " + username;
                                } finally {
                                }
                            }
                        } catch (IOException ioe) {
                            Log.d(logTag, "Bad IO: " + ioe);
                        }
                    } catch (MalformedURLException mue) {
                        Log.d(logTag, "Malformed URL: " + mue);
                    }
                    return "";
                }

                @Override
                protected void onPostExecute(String result) {
                    if (result != "") {
                        Toast.makeText(getApplicationContext(), "Welcome " + username, Toast.LENGTH_SHORT).show();
                        Intent profile = new Intent(getApplicationContext(), ProfileActivity.class);
                        startActivity(profile);
                    } else {
                        Toast.makeText(getApplicationContext(), "Registration failed", Toast.LENGTH_SHORT).show();
                    }
                }
            }.execute();
        }
    });
}

[Buggy Hunk]
if (result != "") {

[Patch]
if (!result.equals("")) {

[Demonstration 3]

[Buggy Method]
@Override
public void markDone(ArrayList<Integer> indices, ArrayList<ReadOnlyTask> tasksToMarkDone) throws IllegalValueException, TaskNotFoundException {
    taskbossHistory.push(new TaskBoss(this.taskBoss));
    int index = 0;
    for (ReadOnlyTask task : tasksToMarkDone) {
        int targetIndex = indices.get(index) - 1;
        if (!task.isRecurring()) {
            Task newTask = new Task(task.getName(), task.getPriorityLevel(), task.getStartDateTime(), task.getEndDateTime(), task.getInformation(), task.getRecurrence(), new UniqueCategoryList("Done"));
            this.taskBoss.updateTask(targetIndex, newTask);
        } else {
            Task copy = new Task(task);
            Task newTask = new Task(copy);
            newTask.getRecurrence().updateTaskDates(newTask);
            this.taskBoss.updateTask(targetIndex, newTask);
        }
        index++;
    }
    indicateTaskBossChanged();
}

[Buggy Hunk]
public void markDone(ArrayList<Integer> indices, ArrayList<ReadOnlyTask> tasksToMarkDone) throws IllegalValueException, TaskNotFoundException {

[Patch]
public void markDone(ArrayList<Integer> indices, ArrayList<ReadOnlyTask> tasksToMarkDone) throws IllegalValueException{