[Demonstration 1]

[Buggy Method]
public void run() {
    try {
        boolean status = false;
        Log.i(TAG, "----------------------------------------------------------------------");
        Log.i(TAG, "POSTING FILE");
        Log.i(TAG, "----------------------------------------------------------------------");
        String pathFile = filesHelper.getLastPath(context);
        final String filename = filesHelper.getLastFilename(context);
        String _id = filesHelper.getLastId(context);
        Log.i(TAG, "start posting picture, path : " + pathFile);
        fileUpload = new File(pathFile);
        if (fileUpload.exists()) {
            Log.i(TAG, "Uploading : " + filename);
            status = ftpHelper.ftpUpload(pathFile, filename);
        } else {
            Log.d(TAG, "File not exist");
        }
        if (status == true) {
            Log.d(TAG, "Upload success");
            File file = new File(pathFile);
            final long fileSizeInKB = file.length() / 1024;
            boolean deleted = file.delete();
            Log.i(TAG, "delete file " + pathFile + " : " + deleted);
            filesHelper.delete(context, _id);
            new ExecuteTask().execute(filename, String.valueOf(fileSizeInKB), getApplicationContext().getResources().getString(R.string.main_path_stored_file) + filename);
        } else {
            Log.d(TAG, "Upload failed");
            File file = new File(pathFile);
            boolean deleted = file.delete();
            Log.i(TAG, "delete file " + pathFile + " : " + deleted);
            filesHelper.delete(context, _id);
            ftpHelper.ftpDisconnect();
            connectToFtp();
        }
    } catch (Exception e) {
    }
}

[Buggy Hunk]
String pathFile = filesHelper.getLastPath(context);

[Patch]
final String pathFile = filesHelper.getLastPath(context);

[Demonstration 2]

[Buggy Method]
@Override
public GetMockDataResponse getMockResponse() throws MockServiceSystemException {
    GetMockDataResponse response = new GetMockDataResponse();
    try {
        JSONObject requestJson = new JSONObject(request);
        List<MockData> staticMockList = getMockDataListOfStaticMockObjects();
        if (staticMockList != null && !staticMockList.isEmpty()) {
            for (MockData mockData : staticMockList) {
                JSONObject mockJsonRequest = new JSONObject(getFormattedJsonString(mockData.getRequest()));
                if ((isSameJson(requestJson, mockJsonRequest, Boolean.FALSE))) {
                    // gets the json from the DB for the request which
                    // matches exactly with the request json values
                    // irrespective of the json order
                    response.setResponse(getFormattedJsonString(mockData.getResponse()));
                    response.setContentType(mockData.getContenttype());
                    return response;
                }
            }
        }
        List<MockData> dynamicMockList = getMockDataListOfDynamicMockObjects();
        if (dynamicMockList != null && !dynamicMockList.isEmpty()) {
            for (MockData mockData : dynamicMockList) {
                JSONObject mockJsonRequest = new JSONObject(mockData.getRequest());
                JSONObject mockJsonResponse = new JSONObject(mockData.getResponse());
                if ((isSameJson(requestJson, mockJsonRequest, Boolean.TRUE))) {
                    // gets the json response dynamically based on the
                    // request key and values
                    response.setResponse(getDynamicResponse(requestJson, mockJsonResponse));
                    response.setContentType(mockData.getContenttype());
                    return response;
                } else if (isRequestList(requestJson, mockJsonRequest, Boolean.TRUE)) {
                    // gets the json dynamic response list based on the
                    // request json list
                    response.setResponse(getDynamicResponseList(requestJson, mockJsonResponse));
                    response.setContentType(mockData.getResponse());
                    return response;
                }
            }
        }
    } catch (JSONException e) {
        throw new MockServiceSystemException(e);
    }
    return response;
}

[Buggy Hunk]
response.setContentType(mockData.getResponse());

[Patch]
response.setContentType(mockData.getContenttype());

[Demonstration 3]

[Buggy Method]
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_assignment_screen);
    Toolbar myToolbar = (Toolbar) findViewById(R.id.my_toolbar);
    myToolbar.setTitle("Assignments");
    setSupportActionBar(myToolbar);
    getSupportActionBar().setDisplayHomeAsUpEnabled(true);
    ListView lv = (ListView) findViewById(R.id.assignlist);
    final ArrayList<Assignment> assignments = Values.unemptycourses.get(Values.Courseindex).assignments;
    lv.setAdapter(new AssignmentAdapter(this, assignments));
    lv.setPadding(0, 0, 0, 0);
    for (Assignment a : assignments) {
        Log.e("COMMENTS", a.getComment() + "_");
    }
    Course c = Values.assignedcourse;
    View headerview = getLayoutInflater().inflate(R.layout.assignheader, null);
    TextView course = (TextView) headerview.findViewById(R.id.headerclass);
    course.setText(c.getName());
    TextView teach = (TextView) headerview.findViewById(R.id.headerteach);
    teach.setText(c.getTeacher());
    TextView room = (TextView) headerview.findViewById(R.id.roomnumber);
    room.setText("Room Number:" + " " + c.getRoomnum());
    TextView email = (TextView) headerview.findViewById(R.id.email);
    email.setText(c.getEmail());
    TextView averagename = (TextView) headerview.findViewById(R.id.averagename);
    TextView averageav = (TextView) headerview.findViewById(R.id.averageav);
    TextView clssgrade = (TextView) headerview.findViewById(R.id.headergade);
    clssgrade.setText(String.format("%.2f", c.getGrade()));
    String s = "";
    String k = "";
    for (Type t : c.getTypes()) {
        s += t.getName() + " Points - \n";
        k += String.format("%.2f", t.getOriggrade()) + "/" + String.format("%.2f", t.getWeight()) + "\n";
    }
    averagename.setText(s);
    averageav.setText(k);
    lv.addHeaderView(headerview);
    lv.setOnItemClickListener(new AdapterView.OnItemClickListener() {

        @Override
        public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
            if (position != 0) {
                position = position - 1;
                if (!assignments.get(position).getComment().equals("")) {
                    Dialog dialog = new Dialog(AssignmentScreen.this);
                    dialog.setContentView(R.layout.assigndialog);
                    dialog.setTitle("Comment");
                    // set the custom dialog components - text, image and button
                    dialog.show();
                    TextView tx = (TextView) dialog.findViewById(R.id.fullcomment);
                    tx.setText(assignments.get(position).getComment());
                }
            }
        }
    });
    SendData sd = new SendData("enterassign");
    sd.execute();
}

[Buggy Hunk]
final ArrayList<Assignment> assignments = Values.unemptycourses.get(Values.Courseindex).assignments;

[Patch]
final ArrayList<Assignment> assignments = Values.PKG.classes.get(Values.periodnum).assignments;