[Demonstration 1]

[Buggy Method]
@Override
public KeyValue<Long, Long> transform(final Long key, final Long value) {
    int maxPartitionNumber = maxPartitionNumberSeen.get(hashCode());
    maxPartitionNumber = Math.max(maxPartitionNumber, context.partition());
    maxPartitionNumberSeen.put(hashCode(), maxPartitionNumber);
    if (maxPartitionNumber == 1 && injectError) {
        throw new RuntimeException("Injected test exception.");
    }
    if (++processedRecords == 10) {
        context.commit();
        commitRequested.incrementAndGet();
    }
    if (state != null) {
        Long sum = state.get(key);
        if (sum == null) {
            sum = value;
        } else {
            sum += value;
        }
        state.put(key, sum);
        context.forward(key, sum);
        return null;
    }
    return new KeyValue<>(key, value);
}

[Buggy Hunk]
if (++processedRecords == 10) {

[Patch]
if (++processedRecords % 10 == 0) {

[Demonstration 2]

[Buggy Method]
@Override
public List<Issue> findAllMatching(String key, int limit) {
    return ((IssueRepository) this.getRepository()).findAllByKey(key);
}

[Buggy Hunk]
return ((IssueRepository)this.getRepository()).findAllByKey(key);

[Patch]
return ((IssueRepository)this.getRepository()).findAllByKey(key, RepositoryUtils.getResultsNr(limit));

[Demonstration 3]

[Buggy Method]
public AirfoilDetail getDetailInfo(String airfoilId) {
    Airfoil airfoil = daoAirfoil.findOne(airfoilId);
    if (null == airfoil) {
        return null;
    }
    String directory = getDirectory();
    drawGraphs(null, airfoil, directory);
    List<String> stlFileNames = stlGenerator.generate(airfoil.getShortName(), airfoil.getCoordView());
    drawViewAirfoil(airfoil);
    return converter.airfoilToAirfoilDetail(airfoil, ServiceAirfoilTools.CHART_NAMES, stlFileNames, directory);
}

[Buggy Hunk]
Airfoil airfoil = daoAirfoil.findOne(airfoilId);

[Patch]
Airfoil airfoil = daoAirfoil.findOneByShortName(airfoilId);