[Demonstration 1]

[Buggy Method]
public static String loadFileContent(String path) {
    byte[] bytes = null;
    try {
        RandomAccessFile f = new RandomAccessFile(path, "r");
        bytes = new byte[(int) f.length()];
        f.read(bytes);
    } catch (IOException e) {
        e.printStackTrace();
    }
    return new String(bytes);
}

[Buggy Hunk]
public static String loadFileContent(String path) {

[Patch]
public static synchronized String loadFileContent(String path) {

[Demonstration 2]

[Buggy Method]
@Override
public void execute(SignActionEvent info) {
    if (!info.isAction(SignActionType.MEMBER_ENTER, SignActionType.REDSTONE_ON, SignActionType.GROUP_ENTER)) {
        return;
    }
    if (info.isType("craft", "crafter")) {
        //parse the sign
        boolean docart = info.isAction(SignActionType.MEMBER_ENTER, SignActionType.REDSTONE_ON) && info.isCartSign() && info.hasMember();
        boolean dotrain = !docart && info.isAction(SignActionType.GROUP_ENTER, SignActionType.REDSTONE_ON) && info.isTrainSign() && info.hasGroup();
        if (!docart && !dotrain)
            return;
        if (!info.hasRailedMember())
            return;
        int radX, radY, radZ;
        radX = radY = radZ = Util.parse(info.getLine(1), TrainCarts.defaultTransferRadius);
        BlockFace dir = info.getRailDirection();
        if (dir == BlockFace.SOUTH) {
            radX = 0;
        } else if (dir == BlockFace.WEST) {
            radZ = 0;
        }
        World world = WorldUtil.getNative(info.getWorld());
        Block m = info.getRails();
        int id;
        Block w = null;
        for (int x = -radX; x <= radX && w == null; x++) {
            for (int y = -radY; y <= radY && w == null; y++) {
                for (int z = -radZ; z <= radZ && w == null; z++) {
                    id = world.getTypeId(m.getX() + x, m.getY() + y, m.getZ() + z);
                    if (id == Material.WORKBENCH.getId()) {
                        w = m.getRelative(x, y, z);
                    }
                }
            }
        }
        if (w != null) {
            //get the inventory to transfer in
            Inventory inventory;
            if (docart) {
                if (!info.getMember().isStorageCart())
                    return;
                inventory = info.getMember().getInventory();
            } else {
                inventory = info.getGroup().getInventory();
            }
            if (TrainCarts.showTransferAnimations) {
                inventory = new InventoryWatcher(w, info.getMember(), inventory);
            }
            //craft
            for (ItemParser item : Util.getParsers(info.getLine(2), info.getLine(3))) {
                RecipeUtil.craftItems(item, inventory);
            }
        }
    }
}

[Buggy Hunk]
inventory = new InventoryWatcher(w, info.getMember(), inventory);

[Patch]
inventory = InventoryWatcher.convert(w, info.getMember(), inventory);

[Demonstration 3]

[Buggy Method]
private void storeDataToFile(byte[] data) throws IOException {
    Path path = Paths.get(this.props.getDataPersistenceFileDirectory(), ModelUtils.translateURNtoFolderPath(this.urn));
    Path file = Paths.get(path.toString(), ModelUtils.DATA_FILE_NAME);
    if (data == null) {
        // We assume that if the value is set to null, we should delete also the corresponding file
        Files.deleteIfExists(file);
    } else {
        if (Files.notExists(path)) {
            Files.createDirectories(path);
        }
        Files.write(file, data, StandardOpenOption.WRITE, StandardOpenOption.CREATE);
    }
}

[Buggy Hunk]
Files.write(file, data, StandardOpenOption.WRITE, StandardOpenOption.CREATE);

[Patch]
Files.write(file, data, StandardOpenOption.WRITE, StandardOpenOption.CREATE, StandardOpenOption.TRUNCATE_EXISTING);