[Demonstration 1]

[Buggy Method]
public void changeParamObject(Integer testID) {
    Test test = (Test) HibernateUtil.get(Test.class, testID, getCurrentSession());
    paramObject = test.getParamObject();
}

[Buggy Hunk]
Test test = (Test) HibernateUtil.get(Test.class, testID, getCurrentSession());

[Patch]
Test test = (Test) HibernateUtil.get(Test.class, testID);

[Demonstration 2]

[Buggy Method]
private void addPartitions(Collection<TopicPartition> assignment) {
    HashSet<TopicPartition> partitions = new HashSet<>(assignment);
    // TODO: change this hard-coded co-partitioning behavior
    for (TopicPartition partition : partitions) {
        final Integer id = partition.partition();
        StreamTask task = tasks.get(id);
        if (task == null) {
            // get the partitions for the task
            HashSet<TopicPartition> partitionsForTask = new HashSet<>();
            for (TopicPartition part : partitions) if (part.partition() == id)
                partitionsForTask.add(part);
            // create the task
            try {
                task = new StreamTask(id, consumer, producer, partitionsForTask, builder.build(), config);
            } catch (Exception e) {
                log.error("Failed to create a task #" + id + " in thread [" + this.getName() + "]: ", e);
                throw e;
            }
            tasks.put(id, task);
        }
    }
    lastClean = time.milliseconds() + cleanTimeMs;
}

[Buggy Hunk]
lastClean = time.milliseconds() + cleanTimeMs;

[Patch]
lastClean = time.milliseconds();

[Demonstration 3]

[Buggy Method]
@Test
public void testPublishHelperException() throws Exception {
    doThrow(new FederationAdminException("error")).when(registryPublicationService).publish(REGISTRY_ID, DESTINATION_ID);
    Response response = restEndpoint.publish(REGISTRY_ID, DESTINATION_ID);
    verify(registryPublicationService).publish(REGISTRY_ID, DESTINATION_ID);
    assertThat(response.getStatusInfo().getStatusCode(), is(Response.Status.BAD_REQUEST.getStatusCode()));
}

[Buggy Hunk]
.getStatusCode(), is(Response.Status.BAD_REQUEST.getStatusCode()));

[Patch]
.getStatusCode(), is(Response.Status.INTERNAL_SERVER_ERROR.getStatusCode()));