[Demonstration 1]

[Buggy Method]
private void handleExperimentFileSelect(InputDataObjectType inputDataObjectType, HBox hBox, Button localFilePickBtn, Button remoteFilePickBtn, File selectedFile) {
    if (selectedFile != null) {
        hBox.getChildren().clear();
        Hyperlink hyperlink = new Hyperlink(selectedFile.getName());
        hyperlink.setOnAction(hyperLinkEvent -> {
            //FIXME Else it is a remote file. Cannot open locally without downloading it.
            if (selectedFile.exists()) {
                try {
                    Desktop.getDesktop().open(selectedFile);
                } catch (IOException e) {
                    SEAGridDialogHelper.showExceptionDialog(e, "Exception Dialog", expCreateInputsGridPane.getScene().getWindow(), "Failed Opening File");
                }
            } else {
                boolean result = SEAGridDialogHelper.showConfirmDialog("Confirm Action", "Remote File Download", "You have selected a remote file." + " Do you want to download it ?");
                if (result) {
                    String remotePath = selectedFile.getPath();
                    remotePath = remotePath.replaceAll(remoteDataDirRoot + SEAGridContext.getInstance().getUserName(), "");
                    downloadFile(Paths.get(remotePath), System.getProperty("java.io.tmpdir"));
                }
            }
        });
        hBox.getChildren().add(0, hyperlink);
        hBox.getChildren().add(1, localFilePickBtn);
        hBox.getChildren().add(2, remoteFilePickBtn);
        experimentInputs.put(inputDataObjectType, selectedFile);
    }
}

[Buggy Hunk]
remotePath = remotePath.replaceAll(remoteDataDirRoot + SEAGridContext.getInstance().getUserName(), "");

[Patch]
remotePath = remotePath.replaceAll(remoteDataDirRoot, "");

[Demonstration 2]

[Buggy Method]
private void updateProductWithResponseBodyData(zaza.model.catalog.Product product, Product responseBody, User user) {
    product.setSourceId(responseBody.getSourceId());
    product.setName(responseBody.getName());
    product.setDescription(responseBody.getDescription());
    product.setLongDescription(responseBody.getLongDescription());
    if (user.isAdmin()) {
        product.setNameMandarin(responseBody.getNameMandarin());
        product.setDescriptionMandarin(responseBody.getNameMandarin());
        product.setLongDescriptionMandarin(responseBody.getLongDescriptionMandarin());
        product.setApproved(responseBody.isApproved());
    } else {
        product.setApproved(false);
    }
    product.setCategory(categoryRepository.findOne(Long.parseLong(responseBody.getCategoryId())));
}

[Buggy Hunk]
product.setDescriptionMandarin(responseBody.getNameMandarin());

[Patch]
product.setDescriptionMandarin(responseBody.getDescriptionMandarin());

[Demonstration 3]

[Buggy Method]
@RequestMapping(value = "/send", method = RequestMethod.POST)
public Transaction send(@RequestBody TransportRequest request, HttpSession session) throws TransportClientException {
    logger.info("Sending message  with user id=" + SessionContext.getCurrentUserId(session) + " and test step with id=" + request.getTestStepId());
    Long testStepId = request.getTestStepId();
    TestStep testStep = testStepService.findOne(testStepId);
    if (testStep == null)
        throw new TestStepException("Unknown test step with id=" + testStepId);
    String outgoingMessage = null;
    try {
        outgoingMessage = MessageUtils.encodeMedHistory(request.getMessage());
        StringBuilder body = new StringBuilder();
        body.append("request=");
        body.append(outgoingMessage);
        request.getConfig().put("Content-Type", MediaType.APPLICATION_FORM_URLENCODED_VALUE);
        String incoming = send(request, body.toString());
        Long userId = SessionContext.getCurrentUserId(session);
        String decodedMessage = decodeIncomingMessage(incoming, testStep, userId);
        return saveTransaction(userId, testStep, decodedMessage, outgoingMessage);
    } catch (UnsupportedEncodingException e) {
        logger.error("Unable to encode outgoing message: " + request.getMessage());
        e.printStackTrace();
    }
    return null;
}

[Buggy Hunk]
return saveTransaction(userId,testStep,decodedMessage,outgoingMessage);

[Patch]
return saveTransaction(userId,testStep,MessageUtils.prettyPrint(decodedMessage),outgoingMessage);