[Demonstration 1]

[Buggy Method]
public void process(String dirPath, String fileNamePattern, String mongoUser, String mongoPassword, String mongoDatabaseName, String mongoHost, String mongoPort, String mongoCollection) {
    SimpleBenchmark bMark = new SimpleBenchmark();
    bMark.startNewBenchmark("processing of files in " + dirPath);
    List<File> files = IO.getAllFiles(dirPath, fileNamePattern);
    Collections.sort(files, new Comparator<File>() {

        @Override
        public int compare(File o1, File o2) {
            Long size1 = o1.length();
            return size1.compareTo(o2.length());
        }
    });
    System.out.println("\n\n==============================\n" + "STARTING PROCESSING OF FILES:\n" + "SRC DIR:\t" + dirPath + "\n" + "PATTERN:\t" + fileNamePattern + "\n" + "# FILES:\t" + files.size() + "\n" + "==============================\n\n\n");
    //init mongo connection
    mongo = new MongoWrapper();
    mongo.init(mongoUser, mongoPassword, mongoDatabaseName, mongoHost, mongoPort, mongoCollection);
    for (File f : files) {
        System.out.println("[PRCSS] " + f.getName() + " (" + FormatConvert.getReadableDataSize(f.length()) + ") [file " + (bMark.getCurrentMarkerCount() + 1) + "/" + files.size() + "] ...");
        //build CorpusObject and add to DB
        mongo.addDocuments(buildCorpusObjects(f));
        bMark.newMarker();
    }
    mongo.close();
    BenchmarkData fullBMarkData = bMark.stopBenchMark();
    System.out.println("\n\n===== RESULTS =====\n" + "processed files:\t" + fullBMarkData.getMarkerCount() + "\n" + "processing time:\t" + fullBMarkData.getRecordedTimeAsString() + "\n");
}

[Buggy Hunk]
mongo.addDocuments(buildCorpusObjects(f));

[Patch]
transformCorpusObjects(f);

[Demonstration 2]

[Buggy Method]
@Override
public boolean contains(Object o) {
    if (o == null)
        return false;
    final E[] items = this.items;
    final ReentrantLock lock = this.lock;
    lock.lock();
    try {
        int takeIndex = this.takeIndex;
        int index = 0;
        while (index++ < currentSize) {
            if (o.equals(items[takeIndex]))
                return true;
            index = increment(takeIndex);
        }
        return false;
    } finally {
        lock.unlock();
    }
}

[Buggy Hunk]
index = increment(takeIndex);

[Patch]
takeIndex = increment(takeIndex);

[Demonstration 3]

[Buggy Method]
@SuppressWarnings("deprecation")
public void prePasteSchematic(short[] blocks, byte[] data) {
    //plugin.getLogger().info("DEBUG: prepaste ");
    islandBlocks = new ArrayList<IslandBlock>();
    Map<BlockVector, Map<String, Tag>> tileEntitiesMap = this.getTileEntitiesMap();
    // Start with non-attached blocks
    //plugin.getLogger().info("DEBUG: attachable size = " + attachable.size());
    //plugin.getLogger().info("DEBUG: torch = " + Material.TORCH.getId());
    //plugin.getLogger().info("DEBUG: non attachable");
    //plugin.getLogger().info("DEBUG: bedrock y = " + bedrock.getBlockY());
    int count = 0;
    for (int x = 0; x < width; ++x) {
        for (int y = 0; y < height; ++y) {
            for (int z = 0; z < length; ++z) {
                int index = y * width * length + z * width + x;
                // Only bother if this block is above ground zero and
                // only bother with air if it is below sea level
                // TODO: need to check max world height too?
                int h = Settings.island_level + y - bedrock.getBlockY();
                if (h >= 0 && h < 255 && (blocks[index] != 0 || h < Settings.sea_level)) {
                    // Only bother if the schematic blocks are within the range that y can be
                    //plugin.getLogger().info("DEBUG: height " + (count++) + ":" +h);
                    IslandBlock block = new IslandBlock(x, y, z);
                    if (!attachable.contains((int) blocks[index]) || blocks[index] == 179) {
                        if (blocks[index] == 179) {
                            // Red sandstone - use red sand instead
                            block.setBlock(12, (byte) 1);
                        } else {
                            block.setBlock(blocks[index], data[index]);
                        }
                        // Tile Entities
                        if (tileEntitiesMap.containsKey(new BlockVector(x, y, z))) {
                            if (plugin.isOnePointEight()) {
                                if (block.getTypeId() == Material.STANDING_BANNER.getId()) {
                                    block.setBanner(tileEntitiesMap.get(new BlockVector(x, y, z)));
                                } else if (block.getTypeId() == Material.SKULL.getId()) {
                                    block.setSkull(tileEntitiesMap.get(new BlockVector(x, y, z)), block.getData());
                                } else if (block.getTypeId() == Material.FLOWER_POT.getId()) {
                                    block.setFlowerPot(tileEntitiesMap.get(new BlockVector(x, y, z)));
                                }
                            }
                            // Monster spawner blocks
                            if (block.getTypeId() == Material.MOB_SPAWNER.getId()) {
                                block.setSpawnerType(tileEntitiesMap.get(new BlockVector(x, y, z)));
                            } else if ((block.getTypeId() == Material.SIGN_POST.getId())) {
                                block.setSign(tileEntitiesMap.get(new BlockVector(x, y, z)));
                            } else if (block.getTypeId() == Material.CHEST.getId()) {
                                block.setChest(nms, tileEntitiesMap.get(new BlockVector(x, y, z)));
                            }
                        }
                        islandBlocks.add(block);
                    }
                }
            }
        }
    }
    //plugin.getLogger().info("Attachable blocks");
    // Second pass - just paste attachables and deal with chests etc.
    for (int x = 0; x < width; ++x) {
        for (int y = 0; y < height; ++y) {
            for (int z = 0; z < length; ++z) {
                int h = Settings.island_level + y - bedrock.getBlockY();
                if (h >= 0 && h < 255) {
                    int index = y * width * length + z * width + x;
                    IslandBlock block = new IslandBlock(x, y, z);
                    if (attachable.contains((int) blocks[index])) {
                        block.setBlock(blocks[index], data[index]);
                        // Tile Entities
                        if (tileEntitiesMap.containsKey(new BlockVector(x, y, z))) {
                            if (plugin.isOnePointEight()) {
                                if (block.getTypeId() == Material.WALL_BANNER.getId()) {
                                    block.setBanner(tileEntitiesMap.get(new BlockVector(x, y, z)));
                                }
                            }
                            // Wall Sign
                            if (block.getTypeId() == Material.WALL_SIGN.getId()) {
                                block.setSign(tileEntitiesMap.get(new BlockVector(x, y, z)));
                            }
                        }
                        islandBlocks.add(block);
                    }
                }
            }
        }
    }
    //plugin.getLogger().info("DEBUG: islandBlocks size = " + islandBlocks.size());
}

[Buggy Hunk]
if (blocks[index] == 179) {

[Patch]
if (Bukkit.getServer().getVersion().contains("(MC: 1.7") && blocks[index] == 179) {