[Demonstration 1]

[Buggy Method]
public static BigDecimal getPriceAfterOrder(Exchange exchange, BigDecimal price) throws IOException {
    MarketDataService marketDataService = exchange.getMarketDataService();
    List<LimitOrder> orders = marketDataService.getOrderBook(CURRENCY_PAIR, PRICE_PROPERTIES.getDsxAccountType()).getBids();
    BigDecimal priceAfterUserOrder = null;
    // index in order book bids for user's order
    int indexOrder = IntStream.range(0, orders.size()).filter(i -> orders.get(i).getLimitPrice().compareTo(price) == 0).findFirst().orElse(-1);
    // take order price after user's order
    if (orders.size() > indexOrder)
        priceAfterUserOrder = orders.get(indexOrder + 1).getLimitPrice();
    return priceAfterUserOrder;
}

[Buggy Hunk]
if (orders.size() > indexOrder)

[Patch]
if (orders.size() - 1 > indexOrder)

[Demonstration 2]

[Buggy Method]
public void cancelRequest(String developerId, String productId) {
    LOG.debug("Enter. developerId: {}, productId: {}.", developerId, productId);
    int count = repository.changeRequestStatus(developerId, productId, RequestStatus.CANCELED);
    LOG.debug("Exit. cancel countProducts: {}.", count);
}

[Buggy Hunk]
int count = repository.changeRequestStatus(developerId, productId, RequestStatus.CANCELED);

[Patch]
int count = repository.changeRequestStatus(developerId, productId, RecordStatus.FINISHED);

[Demonstration 3]

[Buggy Method]
public static void addFuelReserve(GasStation station, Scanner in) {
    int fuelReserve = station.getFuelReserve();
    int maxCapacity = station.getMaxFuelCapacity();
    System.out.println("Gas station currently has " + fuelReserve + " Liters and can store " + maxCapacity);
    System.out.println("How much would you like to add?");
    int fuel = (int) in.nextInt();
    if (fuel <= maxCapacity - fuelReserve) {
        station.addFuel();
    }
}

[Buggy Hunk]
station.addFuel();

[Patch]
station.addFuel(fuel);