[Demonstration 1]

[Buggy Method]
private static FilterBase processPropFilters(final CompFilterType cf, final EventQuery eq, final int entityType) throws WebdavException {
    if (Util.isEmpty(cf.getPropFilter())) {
        return null;
    }
    FilterBase pfilters = null;
    boolean andThem = "allof".equals(cf.getTest());
    for (PropFilterType pf : cf.getPropFilter()) {
        String pname = pf.getName();
        UTCTimeRangeType utr = pf.getTimeRange();
        TextMatchType tm = pf.getTextMatch();
        boolean isNotDefined = pf.getIsNotDefined() != null;
        boolean testPresent = !isNotDefined && (utr == null) && (tm == null) && (Util.isEmpty(pf.getParamFilter()));
        TimeRange tr = null;
        if (utr != null) {
            tr = makeTimeRange(utr);
        }
        boolean andParams = "allof".equals(pf.getTest());
        FilterBase filter = makeFilter(pname, isNotDefined, testPresent, tr, tm, andParams, pf.getParamFilter());
        if (filter != null) {
            if (andThem) {
                pfilters = FilterBase.addAndChild(pfilters, filter);
            } else {
                pfilters = FilterBase.addOrChild(pfilters, filter);
            }
        } else {
            eq.postFilter = true;
            // XXX This is wrong - if we postfilter we have to postfilter everything
            // XXX because it's an OR
            /**
             * Add the propfilter to the post filter collection
             */
            if (entityType == IcalDefs.entityTypeEvent) {
                eq.eventFilters = addPropFilter(eq.eventFilters, pf);
            } else if (entityType == IcalDefs.entityTypeTodo) {
                eq.todoFilters = addPropFilter(eq.todoFilters, pf);
            } else if (entityType == IcalDefs.entityTypeJournal) {
                eq.journalFilters = addPropFilter(eq.journalFilters, pf);
            } else if (entityType == IcalDefs.entityTypeAlarm) {
                eq.alarmFilters = addPropFilter(eq.alarmFilters, pf);
            }
        }
    }
    return pfilters;
}

[Buggy Hunk]
FilterBase filter = makeFilter(pname, isNotDefined, testPresent,

[Patch]
FilterBase filter = makeFilter(pname, -1, isNotDefined, testPresent,

[Demonstration 2]

[Buggy Method]
public void getMetaData() {
    SamReader reader = SamReaderFactory.make().validationStringency(ValidationStringency.LENIENT).samRecordFactory(DefaultSAMRecordFactory.getInstance()).open(this.bamFile.toFile());
    final SAMFileHeader head = reader.getFileHeader();
    this.chrLens = head.getSequenceDictionary().getSequences().stream().collect(Collectors.toMap(s -> s.getSequenceName(), s -> s.getSequenceLength()));
    this.chrOrder = head.getSequenceDictionary().getSequences().stream().sequential().map(s -> s.getSequenceName()).collect(Collectors.toSet());
    final BAMIndex index = reader.indexing().getIndex();
    this.chrXCov = chrLens.entrySet().stream().collect(Collectors.toMap(s -> s.getKey(), (Map.Entry<String, Integer> s) -> {
        BAMIndexMetaData meta = index.getMetaData(head.getSequenceIndex(s.getKey()));
        if (meta.getUnalignedRecordCount() == 0)
            log.log(Level.FINE, "Found no aligned reads for chr: " + s.getKey());
        return (meta.getAlignedRecordCount() + meta.getUnalignedRecordCount()) / (double) s.getValue();
    }));
    double totalXCov = this.chrXCov.entrySet().stream().map(s -> s.getValue()).reduce(0.0d, (a, b) -> (a + b));
    int totalGenomeSize = this.chrLens.entrySet().stream().map(s -> s.getValue()).reduce(0, (a, b) -> (a + b));
    totalXCov /= totalGenomeSize;
    log.log(Level.INFO, "BAM metadata stats: #chrs: " + this.chrOrder.size() + " avg X coverage: " + totalXCov);
}

[Buggy Hunk]
if(meta.getUnalignedRecordCount() == 0)

[Patch]
if(meta.getAlignedRecordCount() == 0)

[Demonstration 3]

[Buggy Method]
private static boolean hasGetter(final String name, final String type, final String code) {
    return code.contains("public " + type + " get" + JavaHelper.capFirst(name) + "()");
}

[Buggy Hunk]
private static boolean hasGetter(final String name, final String type, final String code) {

[Patch]
public static boolean hasGetter(final String name, final String type, final String code) {