[Demonstration 1]

[Buggy Method]
public static byte[] getBytesFromAttachment(String xopUri, RequestData data) throws WSSecurityException {
    CallbackHandler attachmentCallbackHandler = data.getAttachmentCallbackHandler();
    if (attachmentCallbackHandler == null) {
        throw new WSSecurityException(WSSecurityException.ErrorCode.FAILED_CHECK);
    }
    final String attachmentId = xopUri.substring("cid:".length());
    AttachmentRequestCallback attachmentRequestCallback = new AttachmentRequestCallback();
    attachmentRequestCallback.setAttachmentId(attachmentId);
    try {
        attachmentCallbackHandler.handle(new Callback[] { attachmentRequestCallback });
        List<Attachment> attachments = attachmentRequestCallback.getAttachments();
        if (attachments == null || attachments.isEmpty() || !attachmentId.equals(attachments.get(0).getId())) {
            throw new WSSecurityException(WSSecurityException.ErrorCode.INVALID_SECURITY, "empty", new Object[] { "Attachment not found" });
        }
        Attachment attachment = attachments.get(0);
        InputStream inputStream = attachment.getSourceStream();
        return JavaUtils.getBytesFromStream(inputStream);
    } catch (UnsupportedCallbackException | IOException e) {
        throw new WSSecurityException(WSSecurityException.ErrorCode.FAILED_CHECK, e);
    }
}

[Buggy Hunk]
"empty", new Object[] {"Attachment not found"}

[Patch]
"empty", new Object[] {"Attachment not found: " + xopUri}

[Demonstration 2]

[Buggy Method]
@Override
public List<String> repopulateDatabaseUsingFilesStoredOnServer() {
    List<Metadata> metadataList = fileStorageDAO.getAllMetadata();
    dropDatabase();
    DataRepositoryApplication dataRepositoryApplication = getDataRepositoryApplication();
    dataRepositoryApplication.initializeBusinessObjects();
    IBusinessObjects businessObjects = dataRepositoryApplication.getBusinessObjects();
    String[] defaultSetOfDataCategories = getSettings().getDefaultSetOfDataCategories();
    businessObjects.getDataCategoryBO().assureCategoriesAreInTheDatabase(defaultSetOfDataCategories);
    IDatasetBO datasetBO = businessObjects.getDatasetBO();
    List<String> errors = new ArrayList<>();
    for (Metadata metadata : metadataList) {
        try {
            datasetBO.addDataset(metadata);
        } catch (FailedToSave e) {
            log.error(metadata, e);
            errors.add("Failed to save: " + metadata);
            throw new RuntimeException(e);
        } catch (FileContainsInvalidColumnName e) {
            log.error(metadata, e);
            errors.add("Failed to save (file contains invalid column name): " + metadata);
            throw new RuntimeException(e);
        } catch (UnsupportedFileExtension e) {
            errors.add("Failed to save (unsupported file extension): " + metadata);
            throw new RuntimeException(e);
        }
    }
    return errors;
}

[Buggy Hunk]
List<Metadata> metadataList = fileStorageDAO.getAllMetadata();

[Patch]
List<Metadata> metadataList = fileStorageDAO.getAllMetadataForActiveData();

[Demonstration 3]

[Buggy Method]
private void openOnDrive(DriveId driveId) {
    driveId.asDriveFolder().getMetadata((mGoogleApiClient)).setResultCallback(new ResultCallback<DriveResource.MetadataResult>() {

        @Override
        public void onResult(DriveResource.MetadataResult result) {
            if (!result.getStatus().isSuccess()) {
                showErrorDialog();
                return;
            }
            Metadata metadata = result.getMetadata();
            String url = metadata.getAlternateLink();
            Intent i = new Intent(Intent.ACTION_VIEW);
            i.setData(Uri.parse(url));
            startActivity(i);
        }
    });
}

[Buggy Hunk]
public void onResult(DriveResource.MetadataResult result) {

[Patch]
public void onResult(@NonNull DriveResource.MetadataResult result) {