[Demonstration 1]

[Buggy Method]
public void takePhoto() {
    Intent intent = new Intent("android.media.action.IMAGE_CAPTURE");
    filePath = Environment.getExternalStorageDirectory() + "/" + fileName;
    File photo = new File(filePath);
    intent.putExtra(MediaStore.EXTRA_OUTPUT, Uri.fromFile(photo));
    startActivityForResult(intent, CAPTURE_PHOTO);
}

[Buggy Hunk]
filePath= Environment.getExternalStorageDirectory()+"/"+ fileName;

[Patch]
filePath= cameraOutputDirectory+ cameraOutputFileName;

[Demonstration 2]

[Buggy Method]
private boolean isElementPresent(By by) {
    try {
        driver.findElement(by);
        return true;
    } catch (NoSuchElementException e) {
        return false;
    }
}

[Buggy Hunk]
private boolean isElementPresent(By by) {

[Patch]
public boolean isElementPresent(By by) {

[Demonstration 3]

[Buggy Method]
@Override
protected String doInBackground(Boolean... params) {
    try {
        List<String> filePathsToZip = new ArrayList<String>();
        JSONObject pathInfo = getLogFilePaths(true);
        Iterator<String> iter = pathInfo.keys();
        while (iter.hasNext()) {
            String key = iter.next();
            try {
                String filePath = pathInfo.getString(key);
                filePathsToZip.add(filePath);
            } catch (JSONException e) {
                e.printStackTrace();
            }
        }
        if (params[0]) {
            JSONObject archivedPathInfo = getArchivedLogFilePaths();
            Iterator<String> iter2 = archivedPathInfo.keys();
            while (iter2.hasNext()) {
                String key = iter2.next();
                try {
                    List<String> archivedLogFilePaths = (List) archivedPathInfo.get(key);
                    if (archivedLogFilePaths != null) {
                        filePathsToZip.addAll(archivedLogFilePaths);
                    }
                } catch (JSONException e) {
                    e.printStackTrace();
                }
            }
        }
        File tmpToZipFolder = new File(cordova.getActivity().getFilesDir(), "tmpToZipFolder");
        tmpToZipFolder.mkdir();
        File zipFile = new File(logFileStorageLocation, LOGS_ZIP_FOLDER_NAME);
        if (zipFile.exists())
            zipFile.delete();
        for (String filePath : filePathsToZip) {
            String fileName = filePath.substring(filePath.lastIndexOf("/") + 1);
            fileName = fileName.replace("%20", " ");
            File inputFile = new File(filePath);
            File outputFile = new File(tmpToZipFolder, fileName);
            copy(inputFile, outputFile);
        }
        ZipUtility.zipDirectory(tmpToZipFolder, zipFile);
        deleteDirectory(tmpToZipFolder);
        return zipFile.getAbsolutePath();
    } catch (Exception e) {
        return null;
    }
}

[Buggy Hunk]
JSONObject pathInfo = getLogFilePaths(true);

[Patch]
JSONObject pathInfo = getLogFilePaths();