[Demonstration 1]

[Buggy Method]
private void handleDataCreated(Map<InstanceIdentifier<?>, DataObject> createdData) {
    Preconditions.checkNotNull(createdData);
    if (!createdData.isEmpty()) {
        // TODO: put this on a new thread, or make the algorithm below fully async
        for (Map.Entry<InstanceIdentifier<?>, DataObject> dataObjectEntry : createdData.entrySet()) {
            final InstanceIdentifier<Node> path = (InstanceIdentifier<Node>) dataObjectEntry.getKey();
            // sleep 250ms and then re-read the Node information to give OF a change to update with FlowCapable
            // TODO: Figure out why FlowCapableNode is attached later. Who adds the original Node?
            executorService.schedule(new Callable<Void>() {

                @Override
                public Void call() throws Exception {
                    ReadOnlyTransaction readOnlyTransaction = dataBroker.newReadOnlyTransaction();
                    final CheckedFuture<Optional<Node>, ReadFailedException> readFuture = readOnlyTransaction.read(LogicalDatastoreType.OPERATIONAL, path);
                    Futures.addCallback(readFuture, new FutureCallback<Optional<Node>>() {

                        @Override
                        public void onSuccess(Optional<Node> result) {
                            if (result.isPresent()) {
                                identifyDevice(path, result.get());
                            } else {
                                LOG.error("Read succeeded, node doesn't exist: {}", path);
                            }
                        }

                        @Override
                        public void onFailure(Throwable t) {
                            LOG.error("Failed to read Node: {}", path, t);
                        }
                    });
                    return null;
                }
            }, 250, TimeUnit.MILLISECONDS);
        }
    }
}

[Buggy Hunk]
executorService.schedule(new Callable<Void>() {

[Patch]
EXECUTORSERVICE.schedule(new Callable<Void>() {

[Demonstration 2]

[Buggy Method]
@Override
public boolean onItemUse(ItemStack stack, EntityPlayer player, World world, int x, int y, int z, int side, float xOffset, float yOffset, float zOffset) {
    for (int i = 0; i < player.inventory.mainInventory.length; i++) {
        ItemStack torchStack = player.inventory.mainInventory[i];
        if (torchStack == null || !torchStack.getUnlocalizedName().toLowerCase().contains("torch")) {
            continue;
        }
        Item item = torchStack.getItem();
        if (!(item instanceof ItemBlock)) {
            continue;
        }
        int oldMeta = torchStack.getItemDamage();
        int oldSize = torchStack.stackSize;
        boolean result = torchStack.tryPlaceItemIntoWorld(player, world, x, y, z, side, xOffset, yOffset, zOffset);
        if (player.capabilities.isCreativeMode) {
            torchStack.setItemDamage(oldMeta);
            torchStack.stackSize = oldSize;
        } else if (torchStack.stackSize <= 0) {
            ForgeEventFactory.onPlayerDestroyItem(player, torchStack);
            player.inventory.mainInventory[i] = null;
        }
        if (result) {
            return true;
        }
    }
    return super.onItemUse(stack, player, world, x, y, z, side, xOffset, yOffset, zOffset);
}

[Buggy Hunk]
if (torchStack == null || !torchStack.getUnlocalizedName().toLowerCase().contains("torch")) {

[Patch]
if (torchStack == null || !torchStack.getUnlocalizedName().toLowerCase(Locale.US).contains("torch")) {

[Demonstration 3]

[Buggy Method]
public static ReaderNodeNodePlugin getDefault() {
    return plugin;
}

[Buggy Hunk]
public static ReaderNodeNodePlugin getDefault() {

[Patch]
public static ReaderNodePlugin getDefault() {