[Demonstration 1]

[Buggy Method]
@Override
public Metric getMetric(Metric metric) {
    return this.restApi().getMetric(metric.getEnvironmentId(), metric.getFeedId(), metric.getId());
}

[Buggy Hunk]
return this.restApi().getMetric(metric.getEnvironmentId(), metric.getFeedId(), metric.getId());

[Patch]
return getMetric(metric.getEnvironmentId(), metric.getFeedId(), metric.getId());

[Demonstration 2]

[Buggy Method]
private void overallSalesByPlatformExistingRecords() {
    HashMap<String, HashMap<String, Integer>> currentStatistics = getCurrentOverallSalesByPlatform();
    for (Entry<String, HashMap<String, HashMap<String, StockSales>>> shop : newData.entrySet()) {
        if (!currentStatistics.containsKey(shop.getKey())) {
            currentStatistics.put(shop.getKey(), new HashMap<>());
            for (Entry<String, HashMap<String, StockSales>> platform : shop.getValue().entrySet()) {
                if (!currentStatistics.get(shop.getKey()).containsKey(platform.getKey())) {
                    currentStatistics.get(shop.getKey()).put(platform.getKey(), 0);
                }
                for (Entry<String, StockSales> game : platform.getValue().entrySet()) {
                    if (!undo) {
                        currentStatistics.get(shop.getKey()).put(platform.getKey(), currentStatistics.get(shop.getKey()).get(platform.getKey()) + game.getValue().Sales);
                    } else {
                        currentStatistics.get(shop.getKey()).put(platform.getKey(), currentStatistics.get(shop.getKey()).get(platform.getKey()) - game.getValue().Sales);
                    }
                }
            }
        }
    }
    List<Entry<String, HashMap<String, Integer>>> newStatistics = currentStatistics.entrySet().stream().collect(Collectors.toList());
    for (int row = Constants.OVERALL_SALES_BY_PLATFORM_FIRST_ROW; row < newStatistics.size() + Constants.OVERALL_SALES_BY_PLATFORM_FIRST_ROW; row++) {
        CellRangeAddress shopNameCellAddress = CellRangeAddress.valueOf("A" + row + ":C" + row);
        salesByPlatformSheet.addMergedRegion(shopNameCellAddress);
        CellReference shopCellRef = new CellReference(row - 1, 0);
        Row shopRow = CellUtil.getRow(shopCellRef.getRow(), salesByPlatformSheet);
        Cell shopCell = salesByPlatformSheet.getRow(shopRow.getRowNum()).getCell(shopCellRef.getCol(), Row.MissingCellPolicy.CREATE_NULL_AS_BLANK);
        shopCell.setCellValue(newStatistics.get(row - Constants.OVERALL_SALES_BY_PLATFORM_FIRST_ROW).getKey());
        CellReference totalCellRef = new CellReference(row - 1, Constants.OVERALL_SALES_BY_PLATFORM_LAST_COL - 1);
        Row totalRow = CellUtil.getRow(totalCellRef.getRow(), salesByPlatformSheet);
        Cell totalCell = salesByPlatformSheet.getRow(totalRow.getRowNum()).getCell(totalCellRef.getCol(), Row.MissingCellPolicy.CREATE_NULL_AS_BLANK);
        totalCell.setCellType(CellType.FORMULA);
        totalCell.setCellFormula("SUM(D" + row + ":O" + row + ")");
        for (Entry<String, Integer> platform : newStatistics.get(row - Constants.OVERALL_SALES_BY_PLATFORM_FIRST_ROW).getValue().entrySet()) {
            for (int column = Constants.OVERALL_SALES_BY_PLATFORM_FIRST_COL; column < Constants.OVERALL_SALES_BY_PLATFORM_LAST_COL; row++) {
                CellReference platformCellRef = new CellReference(Constants.OVERALL_SALES_BY_PLATFORM_FIRST_COL - 1, column - 1);
                if (salesByPlatformSheet.getRow(platformCellRef.getRow()).getCell(platformCellRef.getCol(), Row.MissingCellPolicy.CREATE_NULL_AS_BLANK).getStringCellValue().equals(platform.getKey())) {
                    CellReference platformSalesCellRef = new CellReference(row - 1, column - 1);
                    salesByPlatformSheet.getRow(platformSalesCellRef.getRow()).getCell(platformSalesCellRef.getCol(), Row.MissingCellPolicy.CREATE_NULL_AS_BLANK).setCellValue(platform.getValue());
                }
            }
        }
    }
}

[Buggy Hunk]
HashMap<String, HashMap<String, Integer>> currentStatistics = getCurrentOverallSalesByPlatform();

[Patch]
HashMap<String, HashMap<String, Integer>> currentStatistics = getCurrentOverallSalesPerPlatform();

[Demonstration 3]

[Buggy Method]
@Override
public void onSaveInstanceState(Bundle outState) {
    // It doesn't matter what we put here, we just don't want outState to be empty
    outState.putBoolean(ExtraConstants.HAS_EXISTING_INSTANCE, true);
    super.onSaveInstanceState(outState);
}

[Buggy Hunk]
outState.putBoolean(ExtraConstants.HAS_EXISTING_INSTANCE, true);

[Patch]
outState.putBoolean(ExtraConstants.HAS_EXISTING_INSTANCE, !mIsWaitingForPlayServices);