[Demonstration 1]

[Buggy Method]
public void setBackground(Region region, String image) {
    Image img = new Image(getClass().getResourceAsStream("/resources/" + image));
    BackgroundImage BI = new BackgroundImage(img, BackgroundRepeat.REPEAT, BackgroundRepeat.REPEAT, BackgroundPosition.DEFAULT, BackgroundSize.DEFAULT);
    region.setBackground(new Background(BI));
}

[Buggy Hunk]
Image img = new Image( getClass().getResourceAsStream("/resources/" + image) );

[Patch]
Image img = new Image( new File("/resources/" + image).toURI().toString() );

[Demonstration 2]

[Buggy Method]
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
    super.onActivityResult(requestCode, resultCode, data);
    if (requestCode == Utils.LOGIN_REQUEST_CODE && resultCode == RESULT_OK) {
        FacebookUtils.downloadFacebookInfo(this);
    } else if (requestCode == Utils.PIC_CAPTURE_REQUEST_CODE && resultCode == RESULT_OK) {
        if (this.imageFile == null || !this.imageFile.canRead()) {
            Toast.makeText(getApplicationContext(), "Error encountered while taking picture", Toast.LENGTH_LONG).show();
            Log.v(TAG, "Error encountered while taking picture");
            this.imageFile = null;
            return;
        }
        this.setPicture(this.imageFile.getAbsolutePath());
        this.imageFile = null;
        changeAlphaBasedOnSelection(PIC_CODE);
    } else if (requestCode == Utils.PIC_CAPTURE_REQUEST_CODE && resultCode == RESULT_CANCELED) {
        Log.v(TAG, "Camera Intent canceled");
    } else if (requestCode == Utils.VID_SHOOT_REQUEST_CODE && resultCode == RESULT_OK) {
        String videoPath = data.getExtras().getString("result");
        this.setVideo(videoPath);
        changeAlphaBasedOnSelection(VIDEO_CODE);
    } else if (requestCode == Utils.VID_SHOOT_REQUEST_CODE && resultCode == RESULT_CANCELED) {
        Log.v(TAG, "Video Intent canceled");
    } else if (requestCode == Utils.PHONE_MEDIA_REQUEST_CODE && resultCode == Activity.RESULT_OK) {
        Uri mediaUri = data.getData();
        String mediaPath = getPath(this, mediaUri);
        if (new File(mediaPath) != null) {
            this.setPhoneMedia(mediaPath);
            changeAlphaBasedOnSelection(PHONE_MEDIA_CODE);
            Log.d(TAG, "Media Path selected: " + mediaPath);
            Log.d(TAG, "Media Path selected(Uri): " + mediaUri.getPath());
        } else {
            Toast.makeText(this, "Invalid Media Selected", Toast.LENGTH_SHORT).show();
        }
    } else if (requestCode == Utils.PHONE_MEDIA_REQUEST_CODE && resultCode == Activity.RESULT_CANCELED) {
        Log.v(TAG, "Phone Media Intent canceled");
    } else if (requestCode == Utils.RECORD_AUDIO_REQUEST_CODE) {
        if (resultCode == Activity.RESULT_OK) {
            String audioPath = data.getExtras().getString("result");
            this.setAudio(audioPath);
            changeAlphaBasedOnSelection(AUDIO_CODE);
        } else {
            Log.d(TAG, "No recording found");
            // Toast.makeText(this, "Error encountered while retrieving recording", Toast.LENGTH_SHORT).show();
        }
    }
}

[Buggy Hunk]
Log.v(TAG, "Error encountered while taking picture");

[Patch]
Log.e(TAG, "Error encountered while taking picture");

[Demonstration 3]

[Buggy Method]
public static Result service(String ownerName, String projectName, String service, boolean isAdvertise) throws IOException, UnsupportedOperationException, ServletException {
    if (!isSupportedService(service)) {
        return forbidden(String.format("Unsupported service: '%s'", service));
    }
    Project project = Project.findByOwnerAndProjectName(ownerName, projectName);
    if (project == null) {
        return notFound();
    }
    models.User user = UserApp.currentUser();
    if (!isAllowed(project, service)) {
        if (user.isAnonymous()) {
            return BasicAuthAction.unauthorized(response());
        } else {
            // If you want the Git client showing your custom message to
            // the user, the Content-Type should be exact "text/plain"
            // without any parameter. For more details, see the code at
            // https://github.com/git/git/commit/426e70d4a11ce3b4f70636d57c6a0ab16ae08a00#diff-eea0ad565ec5903a11b6023755d491cfR154
            response().setHeader("Content-Type", "text/plain");
            return forbidden(String.format("'%s' has no permission to '%s/%s'.", user.name, ownerName, projectName));
        }
    }
    if (isAdvertise) {
        return ok(RepositoryService.gitAdvertise(project, service, response()));
    } else {
        if (request().body().isMaxSizeExceeded()) {
            return status(REQUEST_ENTITY_TOO_LARGE);
        } else {
            user.visits(project);
            return ok(RepositoryService.gitRpc(project, service, request(), response()));
        }
    }
}

[Buggy Hunk]
user.name, ownerName, projectName));

[Patch]
user.loginId, ownerName, projectName));