[Demonstration 1]

[Buggy Method]
private static Group createFinalPositionGroup(Group parent) {
    Group group = new Group(parent, SWT.NONE);
    group.setLayout(new GridLayout(2, false));
    group.setText("Stop at Position");
    Button btnSetFinalPosition = new Button(group, SWT.NONE);
    btnSetFinalPosition.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
    btnSetFinalPosition.setText("Set stop Position [m]");
    btnSetFinalPosition.setEnabled(false);
    // Text finalPositionText = new Text(group, SWT.BORDER);
    // finalPositionText.setLayoutData(new GridData(SWT.FILL, SWT.CENTER,
    // true, false, 1, 1));
    // finalPositionText.setText("Final Position in [cm]...");
    // finalPositionText.setToolTipText("Final Position in [cm]");
    // finalPositionText.setEnabled(false);
    Button checkButton = new Button(group, SWT.CHECK);
    checkButton.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false));
    checkButton.setSelection(false);
    Label infoLabel = new Label(group, SWT.NONE);
    infoLabel.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 2, 1));
    updateInfoLabelConveyorMonitor(infoLabel);
    // finalPositionText.addFocusListener(new FocusListener() {
    //
    // @Override
    // public void focusLost(FocusEvent e) {
    // if (finalPositionText.getText().isEmpty() == true) {
    // finalPositionText.setText("Final Position in [cm]...");
    // }
    // }
    //
    // @Override
    // public void focusGained(FocusEvent e) {
    // if (finalPositionText.getText().equals("Final Position in [cm]..."))
    // {
    // finalPositionText.setText("");
    // }
    // }
    // });
    //
    // finalPositionText.addModifyListener(new RangeDoubleModifyListener() {
    // @Override
    // protected void reactToCorrect() {
    // btnSetFinalPosition.setEnabled(true);
    // }
    //
    // @Override
    // protected void reactToError() {
    // btnSetFinalPosition.setEnabled(false);
    // }
    // });
    btnSetFinalPosition.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            // double value = Double.valueOf(finalPositionText.getText());
            ValueDialog valueDialog = new ValueDialog("Choose distance to stop at.", "Decide at which position the conveyor should stop automatically in [m]", Double.MIN_VALUE, Double.MAX_VALUE, group.getShell());
            if (valueDialog.open() == Answer.OK) {
                conveyorMonitor.setStopMode(StopMode.DISTANCE_REACHED);
                conveyorMonitor.setStopPosition(valueDialog.getValue());
                updateInfoLabelConveyorMonitor(infoLabel);
            }
        }
    });
    checkButton.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            if (checkButton.getSelection() == false) {
                conveyorMonitor.setStopMode(StopMode.OFF);
                btnSetFinalPosition.setEnabled(false);
                // finalPositionText.setEnabled(false);
                updateInfoLabelConveyorMonitor(infoLabel);
            } else {
                btnSetFinalPosition.setEnabled(true);
                // finalPositionText.setEnabled(true);
            }
        }
    });
    return group;
}

[Buggy Hunk]
"Decide at which position the conveyor should stop automatically in [m]", Double.MIN_VALUE,

[Patch]
"Decide at which position the conveyor should stop automatically in [m]", -Double.MAX_VALUE,

[Demonstration 2]

[Buggy Method]
@Override
public void onOnHMIStatus(OnHMIStatus notification) {
    if (notification.getHmiLevel().equals(HMILevel.HMI_FULL)) {
        if (notification.getFirstRun()) {
            userWantsStreaming = true;
            //TODO: There has to be a way to show a play and a pause icon separately. Perhaps
            //as part of a Show request? Unsure. This shows a single button with a
            //play/pause icon combined. It does work, but is ugly.
            SubscribeButton but = new SubscribeButton();
            but.setButtonName(ButtonName.OK);
            sendRpcRequest(but);
        }
        // Other HMI (Show, PerformInteraction, etc.) would go here
    }
    if (!notification.getHmiLevel().equals(HMILevel.HMI_NONE) && firstNonHmiNone) {
        //uploadImages();
        firstNonHmiNone = false;
        addCommand("Play", CMDID_PLAY);
        addCommand("Pause", CMDID_PAUSE);
        addCommand("Genres", CMDID_GENRES);
        Single.fromCallable(new Callable<List<Genre>>() {

            @Override
            public List<Genre> call() throws Exception {
                DirectoryClient dc = new DirectoryClient();
                return dc.queryGenres();
            }
        }).subscribeOn(Schedulers.io()).observeOn(Schedulers.trampoline()).subscribe(new Subscriber<List<Genre>>() {

            @Override
            public void onCompleted() {
            }

            @Override
            public void onError(Throwable e) {
            }

            @Override
            public void onNext(List<Genre> genres) {
                GenreTreeConversionResult result = convertGenreList(genres);
                for (CreateInteractionChoiceSet cs : result.choiceSets) {
                    int correlationID = SdlService.this.sendRpcRequest(cs);
                    pendingInteractions.add(correlationID);
                }
                genreTree = result;
            }
        });
        // Other app setup (SubMenu, CreateChoiceSet, etc.) would go here
    } else {
        //We have HMI_NONE
        if (notification.getFirstRun()) {
            uploadImages();
        }
    }
    if (notification.getAudioStreamingState().equals(AudioStreamingState.NOT_AUDIBLE)) {
        if (userWantsStreaming) {
            StreamingService.stopPlaying(this);
        }
    } else {
        if (userWantsStreaming) {
            if (!StreamingService.isStreaming) {
                StreamingService.startPlaying(this, Radioseven);
            }
        }
    }
    Log.i(TAG, "HMI status is " + notification.getAudioStreamingState() + ", " + notification.getHmiLevel() + ", " + notification.getSystemContext() + ", first run " + notification.getFirstRun());
}

[Buggy Hunk]
DirectoryClient dc = new DirectoryClient();

[Patch]
DirectoryClient dc = new DirectoryClient(new HTTPClient());

[Demonstration 3]

[Buggy Method]
@Override
public void update(Group group, String ownerEmail, Collection<? extends GrantedAuthority> authorities) {
    Group oldGroup = initGroupParticipantslist(group.getId());
    User owner;
    group.setPicture(generatePicturePath(group.getPicture()));
    if (oldGroup != null) {
        owner = oldGroup.getOwner();
        if (!owner.getEmail().equals(ownerEmail) && !authorities.contains(ConfigureSpringSecurity.grantedAdminRole)) {
            return;
        }
        group.setOwner(owner);
        group.setGroupParticipants(oldGroup.getGroupParticipants());
        //Deleting old image from server needed only if group profile is editing
        File file = new File(oldGroup.getPicture());
        file.delete();
    }
    groupsRepository.merge(group);
}

[Buggy Hunk]
group.setPicture(generatePicturePath(group.getPicture()));

[Patch]
group.setPicture(ImageUtils.generatePicturePath(group.getPicture(),environment.getProperty("groups.images.path")));