[Demonstration 1]

[Buggy Method]
@SuppressWarnings("resource")
@StateMachineAction
public String createVM(String instanceId, ProvisioningSettings settings, @SuppressWarnings("unused") InstanceStatus result) {
    VMPropertyHandler ph = new VMPropertyHandler(settings);
    String vcenter = ph.getServiceSetting(VMPropertyHandler.TS_TARGET_VCENTER_SERVER);
    VMwareClient vmClient = null;
    try {
        vmClient = VMClientPool.getInstance().getPool().borrowObject(vcenter);
        Template template = new Template(vmClient, ph);
        TaskInfo taskInfo = template.cloneVM();
        ph.setTask(taskInfo);
        return EVENT_CREATING;
    } catch (Exception e) {
        logger.error("Failed to create VM of instance " + instanceId, e);
        String message = Messages.get(ph.getLocale(), "error_create_vm", new Object[] { instanceId });
        ph.setSetting(VMPropertyHandler.SM_ERROR_MESSAGE, message);
        return EVENT_FAILED;
    } finally {
        if (vmClient != null) {
            try {
                VMClientPool.getInstance().getPool().returnObject(vcenter, vmClient);
            } catch (Exception e) {
                logger.error("Failed to return VMware client into pool", e);
            }
        }
    }
}

[Buggy Hunk]
new Object[] { instanceId });

[Patch]
new Object[] { e.getMessage() });

[Demonstration 2]

[Buggy Method]
private Optional<ProcessingReport> validateArtifact(String schemaResourceName, JsonNode instanceNode, JsonPointer path) {
    try {
        JsonNode jsonSchemaNode = loadJsonNodeFromResource(schemaResourceName);
        ProcessingReport report = jsonSchemaValidate(jsonSchemaNode, instanceNode);
        if (!report.isSuccess()) {
            ProcessingMessage processingMessage = createProcessingMessage("Error validating artifact at path " + path.toString() + " against CEDAR sub-schema " + schemaResourceName);
            report.error(processingMessage);
            return Optional.of(report);
        } else
            return Optional.empty();
    } catch (ProcessingException | URISyntaxException | IOException e) {
        return Optional.of(generateProcessingReport("internal error at path " + path.toString() + ":" + e.getMessage()));
    }
}

[Buggy Hunk]
return Optional.of(generateProcessingReport("internal error at path " + path.toString() + ":" + e.getMessage()));

[Patch]
return Optional.of(generateErrorProcessingReport("internal error at path " + path.toString() + ":" + e.getMessage()));

[Demonstration 3]

[Buggy Method]
public void usersCount() {
    template.convertAndSend("/webchat/count", users.size());
}

[Buggy Hunk]
template.convertAndSend("/webchat/count", users.size());

[Patch]
messagingTemplate.convertAndSend("/webchat/count", users.size());