[Demonstration 1]

[Buggy Method]
public Set<ArenaData> loadArenaData() {
    HashSet<ArenaData> arenaDatas = new HashSet<>();
    try {
        File folder = new File("config/" + folderName + "/arenas");
        folder.mkdirs();
        logger.debug("Attempting to load all ArenaData from " + folder.getPath());
        for (File file : folder.listFiles()) {
            if (file.isFile()) {
                String ext = Files.getFileExtension(file.getName());
                if (ext.equalsIgnoreCase("ser")) {
                    FileInputStream fin = new FileInputStream(file);
                    ObjectInputStream ois = new ObjectInputStream(fin);
                    Object raw = ois.readObject();
                    ois.close();
                    if (raw instanceof ArenaData) {
                        arenaDatas.add((ArenaData) raw);
                        logger.debug("Valid ArenaData loaded from " + file.getPath());
                    }
                }
            }
        }
    } catch (Exception e) {
        logger.error(e.getMessage());
        StringWriter sw = new StringWriter();
        PrintWriter pw = new PrintWriter(sw);
        e.printStackTrace(pw);
        logger.error(sw.toString());
    }
    return arenaDatas;
}

[Buggy Hunk]
logger.error(sw.toString());

[Patch]
logger.debug(sw.toString());

[Demonstration 2]

[Buggy Method]
@Override
public boolean check(final Context context) {
    if (context.contains(InputParameter.TEMP)) {
        final String value = context.get(InputParameter.TEMP);
        if (value != null && value.length() > 0) {
            final File path = new File(value);
            if (!path.exists()) {
                context.error("Temporary path provided (" + value + "), but doesn't exists. Please create it or use system path.");
                return false;
            }
            if (!path.isDirectory()) {
                context.error("Temporary path provided, but it's not a directory: " + value);
                return false;
            }
            if (path.listFiles().length > 1) {
                context.error("Temporary path contains files.");
                if (!context.canInteract()) {
                    context.error("Please manage the path you have assigned as temporary.");
                    return false;
                }
                final String delete = context.ask("Delete them? (y/N):");
                if (!"y".equalsIgnoreCase(delete)) {
                    return false;
                } else {
                    return prepareCustomPath(context, path);
                }
            }
            context.cache(CACHE_NAME, path);
            return true;
        }
    }
    return prepareSystemTempPath(context);
}

[Buggy Hunk]
if (path.listFiles().length > 1) {

[Patch]
if (path.listFiles().length > 0) {

[Demonstration 3]

[Buggy Method]
private void serveClient(File folder) throws ServerClosedException, ClientDisconnectedException, IOException {
    File[] files = folder.listFiles();
    String s = "";
    for (File file : files) {
        if (!file.isDirectory()) {
            // concat names to one string
            s += file.getName() + "\n";
        }
    }
    int textLen = s.length();
    for (int i = 0; i < 32; i += 8) {
        // send length byte-by-byte big-endian
        sout.write((byte) (textLen >> i));
    }
    sout.write(s.getBytes());
    textLen = sin.read();
    if (textLen == -1) {
        throw new ClientDisconnectedException();
    }
    byte[] buf = new byte[textLen];
    if (sin.read(buf) == -1) {
        throw new ClientDisconnectedException();
    }
    String filename = new String(buf);
    System.out.println("AppClient queries \"" + filename + "\"");
    int k = 0;
    while (k < files.length && (!filename.equals(files[k].getName()) || files[k].isDirectory())) k++;
    if (k == files.length) {
        System.out.println("404: \"" + filename + "\" not found.");
        return;
    }
    try {
        sendFile(files[k]);
    } catch (IOException x) {
        System.out.println("Error reading \"" + filename + "\"!");
    }
}

[Buggy Hunk]
private void serveClient(File folder) throws ServerClosedException, ClientDisconnectedException, IOException {

[Patch]
private void serveClient(File folder) throws ClientDisconnectedException, IOException {