[Demonstration 1]

[Buggy Method]
private static BulkObject getBlobFromPosition(final ImmutableMultimap<BulkObject, Range> blobs, final long position) {
    if (Guard.isMultiMapNullOrEmpty(blobs)) {
        return null;
    }
    for (final BulkObject bulkObject : blobs.keySet()) {
        if (bulkObject.getOffset() <= position && position <= (bulkObject.getOffset() + bulkObject.getLength() - 1)) {
            return bulkObject;
        }
    }
    return null;
}

[Buggy Hunk]
if (bulkObject.getOffset() <= position && position <= (bulkObject.getOffset() + bulkObject.getLength() - 1)) {

[Patch]
if (bulkObject.getOffset() <= position && position < bulkObject.getOffset() + bulkObject.getLength()) {

[Demonstration 2]

[Buggy Method]
private Exercise[] convertCursorToExercises(Cursor c) {
    int count = c.getCount();
    int i = 0;
    Exercise[] exercises = new Exercise[count];
    if (count >= 1) {
        while (c.moveToNext()) {
            int val_id = -1, val_oneRepMax = -1;
            String val_name = null, val_equipmentType = null, val_targetMuscle = null, val_muscleGroup = null, columnData = null;
            for (int j = 0; j < c.getColumnCount(); j++) {
                String columnName = c.getColumnName(j);
                if (!columnName.equalsIgnoreCase(COLUMN_ID)) {
                    columnData = c.getString(c.getColumnIndex(columnName));
                }
                if (columnName.equalsIgnoreCase(COLUMN_ID)) {
                    val_id = c.getInt(c.getColumnIndex(columnName));
                } else if (columnName.equalsIgnoreCase(COLUMN_NAME)) {
                    val_name = columnData;
                } else if (columnName.equalsIgnoreCase(COLUMN_EQUIPMENT_TYPE)) {
                    val_equipmentType = columnData;
                } else if (columnName.equalsIgnoreCase(COLUMN_MUSCLE_GROUP)) {
                    val_muscleGroup = columnData;
                } else if (columnName.equalsIgnoreCase(COLUMN_TARGET_MUSCLE)) {
                    val_targetMuscle = columnData;
                } else if (columnName.equalsIgnoreCase(COLUMN_ONE_REP_MAX)) {
                    val_oneRepMax = c.getInt(c.getColumnIndex(columnName));
                }
            }
            exercises[i] = new Exercise(val_id, val_name, val_equipmentType, val_muscleGroup, val_targetMuscle, val_oneRepMax);
            i++;
        }
    }
    return exercises;
}

[Buggy Hunk]
exercises[i] = new Exercise(val_id, val_name, val_equipmentType, val_muscleGroup, val_targetMuscle, val_oneRepMax);

[Patch]
exercises[i] = new Exercise(val_id, val_name, val_muscleGroup, val_equipmentType, val_targetMuscle, val_oneRepMax);

[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)));