[Demonstration 1]

[Buggy Method]
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View rootView = inflater.inflate(R.layout.fragment_test, container, false);
    setHasOptionsMenu(true);
    Button b = (Button) rootView.findViewById(R.id.b1);
    b.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            DateSpan ds = new DateSpan(new Date(25, 7, 2016), new Date(27, 7, 2016));
            TimetableEntry ent = TimetableEntry.create((byte) 0, "Test-Entry-1", "This is the Description", ds, null);
        }
    });
    b = (Button) rootView.findViewById(R.id.b2);
    b.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
        }
    });
    b = (Button) rootView.findViewById(R.id.b3);
    b.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            System.out.println("asdf: " + Timetable.getEntries().size());
        }
    });
    b = (Button) rootView.findViewById(R.id.b4);
    b.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
        }
    });
    return rootView;
}

[Buggy Hunk]
TimetableEntry ent = TimetableEntry.create((byte)0, "Test-Entry-1", "This is the Description", ds, null);

[Patch]
TimetableEntry ent = TimetableEntry.create("Test-Entry-1", "This is the Description", ds, null, (byte)0);

[Demonstration 2]

[Buggy Method]
@Override
public void onClick(View v) {
    int i;
    int counter = 3;
    String U, P;
    for (i = 0; i < Users.size(); i++) {
        U = Users.get(i).getAsString(UserContract.UserEntry.COLUMN_NAME_USERNAME);
        P = Users.get(i).getAsString(UserContract.UserEntry.COLUMN_NAME_PASSWORD);
        if (U.equals(Uname.toString()) && P.equals(Pword.toString()))
            CurrentUser = Uname.toString();
    }
    if (CurrentUser.equals(Uname.toString())) {
        Toast.makeText(getApplicationContext(), "Logging in...", Toast.LENGTH_SHORT).show();
        //TODO write code for interaction with BigOven API here
    } else {
        if (counter > 0)
            Toast.makeText(getApplicationContext(), "Wrong Credentials", Toast.LENGTH_SHORT).show();
        else
            Toast.makeText(getApplicationContext(), "Wrong Credentials, Local recipes only", Toast.LENGTH_SHORT).show();
        attempts.setBackgroundColor(Color.RED);
        counter--;
        attempts.setText(Integer.toString(counter));
        if (counter == 0) {
            login.setEnabled(false);
        }
    }
}

[Buggy Hunk]
login.setEnabled(false);

[Patch]
Login.setEnabled(false);

[Demonstration 3]

[Buggy Method]
private void setUpViews() {
    // Set up the Time object.
    dueDate = new Time();
    dueDate.setToNow();
    long millis = dueDate.toMillis(false);
    dueDate.set(millis - (millis % 1800000));
    // Initialize all four views.
    taskNameEditText = (EditText) findViewById(R.id.task_name);
    prioritySpinner = (Spinner) findViewById(R.id.priority);
    prioritySpinner.setSelection(3);
    listSpinner = (Spinner) findViewById(R.id.parent_list);
    dateView = (TextView) findViewById(R.id.due_date);
    timeView = (TextView) findViewById(R.id.due_time);
    addButton = (Button) findViewById(R.id.add_button2);
    cancelButton = (Button) findViewById(R.id.cancel_button);
    // Set the arraylist for the spinner.
    ArrayAdapter<List> adapter = new ArrayAdapter<List>(this, android.R.layout.simple_spinner_item, app.getLists());
    adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
    listSpinner.setAdapter(adapter);
    listSpinner.setSelection(app.getCurrentListIndex());
    // Add an OnClickListener for the dateView.
    dateView.setOnClickListener(new View.OnClickListener() {

        public void onClick(View v) {
            datePicker = new DatePickerDialog(AddTaskActivity.this, R.style.Theme_Dialog, new DatePickerDialog.OnDateSetListener() {

                public void onDateSet(DatePicker view, int year, int month, int day) {
                    setDate(year, month, day);
                }
            }, dueDate.year, dueDate.month, dueDate.monthDay);
            datePicker.show();
        }
    });
    dateView.setOnLongClickListener(new View.OnLongClickListener() {

        @Override
        public boolean onLongClick(View v) {
            // Create an AlertDialog that allows the user to remove the date.
            removeDialog = new AlertDialog.Builder(AddTaskActivity.this).setTitle(R.string.remove_date_title).setMessage(R.string.remove_date_message).setPositiveButton(R.string.cancel, new AlertDialog.OnClickListener() {

                public void onClick(DialogInterface dialog, int which) {
                    // Closes the AlertDialog.
                    removeDialog.cancel();
                }
            }).setNegativeButton(R.string.remove, new AlertDialog.OnClickListener() {

                public void onClick(DialogInterface dialog, int which) {
                    // Add the task and close the activity.
                    hasDate = false;
                    hasTime = false;
                    removeDialog.dismiss();
                }
            }).create();
            // Show the AlertDialog.
            removeDialog.show();
            return true;
        }
    });
    // Add an OnClickListener for the timeView.
    timeView.setOnClickListener(new View.OnClickListener() {

        public void onClick(View v) {
            if (!hasDate) {
                return;
            }
            timePicker = new TimePickerDialog(AddTaskActivity.this, R.style.Theme_Dialog, new TimePickerDialog.OnTimeSetListener() {

                public void onTimeSet(TimePicker view, int hourOfDay, int minute) {
                    setTime(hourOfDay, minute);
                }
            }, dueDate.hour, dueDate.minute, true);
            timePicker.show();
        }
    });
    timeView.setOnLongClickListener(new View.OnLongClickListener() {

        @Override
        public boolean onLongClick(View v) {
            // Create an AlertDialog that allows the user to remove the time.
            removeDialog = new AlertDialog.Builder(AddTaskActivity.this).setTitle(R.string.remove_time_title).setMessage(R.string.remove_time_message).setPositiveButton(R.string.cancel, new AlertDialog.OnClickListener() {

                public void onClick(DialogInterface dialog, int which) {
                    // Closes the AlertDialog.
                    removeDialog.cancel();
                }
            }).setNegativeButton(R.string.remove, new AlertDialog.OnClickListener() {

                public void onClick(DialogInterface dialog, int which) {
                    // Add the task and close the activity.
                    hasTime = false;
                    removeDialog.dismiss();
                }
            }).create();
            // Show the AlertDialog.
            removeDialog.show();
            return true;
        }
    });
    // Give the add button an OnCLickListener (only calls the method addTask()).
    addButton.setOnClickListener(new View.OnClickListener() {

        public void onClick(View v) {
            addTask();
            finish();
        }
    });
    // Disable the add button because there is no task name.
    addButton.setEnabled(false);
    // Set an OnClickListener for the cancel button (calls the cancel() method);
    cancelButton.setOnClickListener(new View.OnClickListener() {

        public void onClick(View v) {
            cancel();
        }
    });
    // Put a text listener on the EditText, so we can enable/disable the add button
    // when the user adds text/deletes all text.
    taskNameEditText.addTextChangedListener(new TextWatcher() {

        public void onTextChanged(CharSequence s, int start, int before, int count) {
            addButton.setEnabled(!taskNameEditText.getText().toString().equals(""));
        }

        public void beforeTextChanged(CharSequence s, int start, int count, int after) {
        }

        public void afterTextChanged(Editable s) {
        }
    });
}

[Buggy Hunk]
long millis = dueDate.toMillis(false);

[Patch]
long millis = dueDate.toMillis(true);