[Demonstration 1]

[Buggy Method]
public Set<VirtualMachine> getAllVirtualMachinesByInfrastructure(Folder rootFolder, Infrastructure infrastructure) {
    try {
        ManagedEntity[] managedEntities = new InventoryNavigator(rootFolder).searchManagedEntities("VirtualMachine");
        return IntStream.rangeClosed(1, managedEntities.length).mapToObj(i -> (VirtualMachine) managedEntities[i]).collect(Collectors.toSet());
    } catch (RemoteException e) {
        throw new RuntimeException("ERROR when retrieving VMWare istances for infrastructure : " + infrastructure, e);
    }
}

[Buggy Hunk]
return IntStream.rangeClosed(1, managedEntities.length)

[Patch]
return IntStream.range(0, managedEntities.length)