[Demonstration 1]

[Buggy Method]
public static ArrayList<Car> getAllCar(SQLiteDatabase db) throws SQLException {
    ArrayList<Car> car_list = new ArrayList<>();
    Cursor c = db.query(true, TABLE, COLUMNS, null, null, null, null, null, null);
    if ((c != null) && (c.getCount() > 0)) {
        while (c.moveToNext()) {
            Car car = new Car(c.getString(0), c.getString(1), c.getString(2), c.getString(3), c.getString(4), c.getString(5), Boolean.parseBoolean(c.getString(6)), c.getString(7), c.getString(9), c.getString(10));
            String last_driver = c.getString(8);
            if (last_driver != null)
                car.setLast_driver(last_driver);
            car.setUsers(GroupTable.getContact_ByCarID(db, car.getId()));
            car_list.add(car);
        }
    }
    c.close();
    return car_list;
}

[Buggy Hunk]
Cursor c = db.query(true, TABLE, COLUMNS, null, null, null, null, null, null);

[Patch]
Cursor c = db.query(true, TABLE, COLUMNS, null, null, null, null, NAME, null);

[Demonstration 2]

[Buggy Method]
final AbstractMatrix _getDataMatrix(final IInstanceRuns data) {
    final ArrayListView<? extends IRun> rawData;
    final double[] doubleMatrixData;
    final long[] longMatrixData;
    final UnaryFunction x, y;
    final int xFormat, yFormat, xIndex, yIndex;
    int totalRows, outIndex, inIndex;
    rawData = data.getData();
    totalRows = 0;
    for (final IRun run : rawData) {
        totalRows += run.m();
    }
    x = this.m_dimX.use(data);
    xFormat = _ModelAttributeBase.__getDimSwitch(this.m_dimX);
    xIndex = this.m_dimX.getDimension().getIndex();
    y = this.m_dimY.use(data);
    yFormat = _ModelAttributeBase.__getDimSwitch(this.m_dimY);
    yIndex = this.m_dimX.getDimension().getIndex();
    outIndex = (totalRows << 1);
    if (Math.max(xFormat, yFormat) >= _ModelAttributeBase.LONG_IN_DOUBLE_OUT) {
        doubleMatrixData = new double[outIndex];
        for (final IRun run : rawData) {
            for (inIndex = run.m(); (--inIndex) >= 0; ) {
                //
                doubleMatrixData[--outIndex] = (//
                (yFormat <= _ModelAttributeBase.LONG_IN_DOUBLE_OUT) ? //
                y.computeAsDouble(run.getLong(inIndex, yIndex)) : y.computeAsDouble(run.getDouble(inIndex, yIndex)));
                //
                doubleMatrixData[--outIndex] = (//
                (xFormat <= _ModelAttributeBase.LONG_IN_DOUBLE_OUT) ? //
                x.computeAsDouble(run.getLong(inIndex, xIndex)) : x.computeAsDouble(run.getDouble(inIndex, xIndex)));
            }
        }
        if (outIndex == 0) {
            return new DoubleMatrix1D(doubleMatrixData, totalRows, 2);
        }
    } else {
        longMatrixData = new long[outIndex];
        for (final IRun run : rawData) {
            for (inIndex = run.m(); (--inIndex) >= 0; ) {
                longMatrixData[--outIndex] = y.computeAsLong(run.getLong(inIndex, yIndex));
                longMatrixData[--outIndex] = x.computeAsLong(run.getLong(inIndex, xIndex));
            }
        }
        if (outIndex == 0) {
            return new LongMatrix1D(longMatrixData, totalRows, 2);
        }
    }
    //$NON-NLS-1$
    throw new IllegalStateException("The lengths of the runs changed?");
}

[Buggy Hunk]
yIndex = this.m_dimX.getDimension().getIndex();

[Patch]
yIndex = this.m_dimY.getDimension().getIndex();

[Demonstration 3]

[Buggy Method]
public double[] outputs() {
    int end = Configuration.BRAIN_WIDTH - 1;
    double[] output = new double[OUTPUT_LABELS.length];
    for (int i = 0; i < output.length; i++) {
        output[i] = neurons[end][i];
    }
    return output;
}

[Buggy Hunk]
double[] output = new double[OUTPUT_LABELS.length];

[Patch]
double[] output = new double[7];