[Demonstration 1]

[Buggy Method]
public CommissionItem createCommissionItem(BilledItem bi) {
    double fee = CurrencyUtils.toEuros(bi.getFee(), bi.getCurrency());
    int monthsFromStartOfContract = JodaUtils.monthsDifference(bi.period.contractStart, bi.period.periodEnd);
    fee = computeCommission(fee, monthsFromStartOfContract);
    return new CommissionItem(commissionnee, fee, this, bi);
}

[Buggy Hunk]
int monthsFromStartOfContract = JodaUtils.monthsDifference(bi.period.contractStart, bi.period.periodEnd);

[Patch]
int monthsFromStartOfContract = JodaUtils.monthsDifference(bi.period.contractStart, bi.period.periodEnd) + 1;

[Demonstration 2]

[Buggy Method]
@OnClick(R.id.btn_next_step)
public void nextStep(View v) {
    nextButtonClickListener.onNextButtonClick(currentStep.getId());
}

[Buggy Hunk]
nextButtonClickListener.onNextButtonClick(currentStep.getId());

[Patch]
nextButtonClickListener.onNextButtonClick(currentStep.getId() + 1);

[Demonstration 3]

[Buggy Method]
@SuppressWarnings("unchecked")
@Override
protected ImgPlusCell compute(final ImgPlusValue cellValue) throws Exception {
    final ImgPlus img = cellValue.getImgPlus();
    final Interval[] intervals = m_dimSelection.getIntervals(img, img);
    final int[] m_selectedDims = m_dimSelection.getSelectedDimIndices(img);
    final IterableIntervalCopy copyOp = new IterableIntervalCopy();
    ImgPlus res = null;
    if (m_selectedDims.length < 2) {
        throw new KNIPException("Selected dimensions do result in an Img with less than two dimensions for Img " + cellValue.getMetadata().getName() + ". MissingCell is created.");
    }
    long[] min = new long[img.numDimensions()];
    for (final Interval interval : intervals) {
        interval.min(min);
        RandomAccessibleInterval subsetview = SubsetOperations.subsetview(img.getImg(), interval);
        ImgPlusMetadata meta = MetadataUtil.copyAndCleanImgPlusMetadata(interval, img, new DefaultImgMetadata(subsetview.numDimensions()));
        try {
            ImgPlus<T> imgPlus = new ImgPlus<T>(new ImgView<T>(subsetview, img.factory()), meta);
            m_macro.run(imgPlus);
        } catch (UntransformableIJTypeException e) {
            throw new KNIPRuntimeException(e.getMessage(), e);
        } catch (KNIPRuntimeException e) {
            throw e;
        } catch (Exception e) {
            throw new KNIPRuntimeException("The specified macro has thrown an error while execution. Make sure that the used plugins are available in the selected IJ1 plugin folder! See KNIME Log for details!", e);
        }
        if (res == null && intervals.length > 1) {
            final long[] dims = new long[img.numDimensions()];
            img.dimensions(dims);
            for (int i = 0; i < m_selectedDims.length; i++) {
                dims[m_selectedDims[i]] = m_macro.resImgPlus().dimension(i);
            }
            res = new ImgPlus(img.factory().create(dims, m_macro.resImgPlus().firstElement().createVariable()), img);
            res.setSource(img.getSource());
        }
        if (intervals.length > 1) {
            copyOp.compute(m_macro.resImgPlus(), SubsetOperations.subsetview(res, interval));
        } else {
            res = m_macro.resImgPlus();
            res.setSource(img.getSource());
        }
        // fill result table if available
        if (m_macro.resTable() != null) {
            if (m_resTableContainer == null) {
                final DataTableSpec spec = createResultTableSpec(m_macro.resTable());
                if (spec != null) {
                    m_resTableContainer = m_exec.createDataContainer(spec);
                } else {
                    m_resTableContainer = null;
                }
            }
            if (m_resTableContainer != null) {
                final int numCols = m_resTableContainer.getTableSpec().getNumColumns();
                final int[] colIndices = new int[numCols];
                for (int i = 0; i < colIndices.length; i++) {
                    colIndices[i] = m_macro.resTable().getColumnIndex(m_resTableContainer.getTableSpec().getColumnSpec(i).getName());
                }
                for (int r = 0; r < m_macro.resTable().getCounter(); r++) {
                    final DataCell[] cells;
                    if (!m_resultTableEntriesAsString.getBooleanValue()) {
                        cells = new DoubleCell[numCols];
                        for (int c = 0; c < cells.length; c++) {
                            cells[c] = new DoubleCell(m_macro.resTable().getValueAsDouble(colIndices[c], r));
                        }
                    } else {
                        cells = new StringCell[numCols];
                        for (int c = 0; c < cells.length; c++) {
                            cells[c] = new StringCell(m_macro.resTable().getStringValue(colIndices[c], r));
                        }
                    }
                    String rowKey;
                    if (intervals.length > 1) {
                        rowKey = m_currentRowKey + "#" + Arrays.toString(min) + "#" + r;
                    } else {
                        rowKey = m_currentRowKey + "#" + r;
                    }
                    m_resTableContainer.addRowToTable(new DefaultRow(rowKey, cells));
                }
            }
        }
    }
    return m_imgCellFactory.createCell(res);
}

[Buggy Hunk]
copyOp.compute(m_macro.resImgPlus(), SubsetOperations.subsetview(res, interval));

[Patch]
copyOp.compute(m_macro.resImgPlus(), Views.iterable(SubsetOperations.subsetview(res, interval)));