[Demonstration 1]

[Buggy Method]
@Override
public String decorate(Message message) throws DecorateException {
    try {
        return getContent(message) + getPostfix(message);
    } catch (ContentDecorateException e) {
        throw new DecorateException("Can\'t decorate message", e);
    }
}

[Buggy Hunk]
public String decorate(Message message) throws DecorateException {

[Patch]
public String decorate(Message message) {

[Demonstration 2]

[Buggy Method]
private void testPassivate(String name, UUID uuid) throws TestException {
    String response = null;
    try {
        printDivider();
        System.out.println("Passivating " + name + ", uuid: " + uuid.toString());
        Message message = new PassivateDocumentMessage(this.getAuthToken(), name, uuid, "Passivate, please");
        response = this.sender.send(message, true).get(30, TimeUnit.SECONDS);
        if (response == null) {
            throw new TestException("Got null response from sender");
        } else {
            JSONObject object = new JSONObject(response);
            UUID result = UUID.fromString(object.getString("uuid"));
            if (uuid.compareTo(result) == 0) {
                System.out.println("Passivate succeeded");
            } else {
                throw new TestException("Unexpected answer '" + object.getString("uuid") + "' (expected '" + uuid.toString() + "')");
            }
        }
    } catch (org.json.JSONException e) {
        System.out.println(response);
        throw new TestException(e);
    } catch (InterruptedException | IOException | ExecutionException | TimeoutException e) {
        e.printStackTrace();
        throw new TestException(e);
    }
}

[Buggy Hunk]
Message message = new PassivateDocumentMessage(this.getAuthToken(), name, uuid, "Passivate, please");

[Patch]
PassivateDocumentMessage message = new PassivateDocumentMessage(this.getAuthToken(), name, uuid, "Passivate, please");

[Demonstration 3]

[Buggy Method]
@Override
public List<T> saveSync(Iterable<T> entities) {
    Realm realm = null;
    try {
        realm = repositoryConfiguration.getRealmProvider().provideRealm();
        realm.beginTransaction();
        for (T entity : entities) {
            if (idGenerator != null && idSetter != null) {
                ID id = idGenerator.generateNextId();
                idSetter.setId(entity, id);
            }
        }
        List<T> newEntities = realm.copyToRealm(entities);
        realm.commitTransaction();
        return realm.copyFromRealm(newEntities);
    } finally {
        if (realm != null) {
            realm.close();
        }
    }
}

[Buggy Hunk]
List<T> newEntities = realm.copyToRealm(entities);

[Patch]
List<T> newEntities = realm.copyToRealmOrUpdate(entities);