[Demonstration 1]

[Buggy Method]
public static void writeCSV(File csv, List<Chunk> chunks) throws IOException {
    FileWriter fw = new FileWriter(csv);
    fw.write("document,chunk_id,start,end,type,before,after,text,label");
    for (Chunk c : chunks) {
        for (Span t : c.tregex()) {
            String label = (t.match() == null) ? "F" : "T";
            fw.write("\n" + stringFormat(c.document()) + "," + c.id() + "," + t.start() + "," + t.end() + "," + stringFormat(t.name()) + "," + stringFormat(t.sentenceTextBefore()) + "," + stringFormat(t.sentenceTextAfter()) + "," + stringFormat(t.text()) + "," + label);
        }
    }
    fw.close();
}

[Buggy Hunk]
String label = (t.match() == null) ? "F" : "T";

[Patch]
String label = (t.matches().isEmpty()) ? "F" : "T";

[Demonstration 2]

[Buggy Method]
private void notifyUser(int alarmCount, int warningCount) {
    Intent intent = new Intent(getContext(), WeatherAlert.class);
    PendingIntent pIntent = PendingIntent.getActivity(getContext(), 0, intent, 0);
    NotificationManager notificationManager = (NotificationManager) getContext().getSystemService(Context.NOTIFICATION_SERVICE);
    if (alarmCount > 0) {
        Notification red = new Notification.Builder(getContext()).setContentTitle("Wykryto zagrożenia (" + alarmCount + warningCount + ")!!").setContentText("Kliknij aby zobaczyć").setSmallIcon(R.mipmap.red).setAutoCancel(true).setContentIntent(pIntent).build();
        notificationManager.notify(0, red);
    } else if (warningCount > 0) {
        Notification yellow = new Notification.Builder(getContext()).setContentTitle("Możliwe zagrożenie (" + warningCount + ")!!").setContentText("Kliknij aby zobaczyć").setSmallIcon(R.mipmap.yellow).setContentIntent(pIntent).setAutoCancel(true).build();
        notificationManager.notify(1, yellow);
    }
}

[Buggy Hunk]
.setContentTitle("Wykryto zagrożenia (" + alarmCount + warningCount + ")!!")

[Patch]
.setContentTitle("Wykryto zagrożenia (" + (alarmCount + warningCount) + ")!!")

[Demonstration 3]

[Buggy Method]
protected void updateJava() throws IOException, InterruptedException {
    Resource vmjar = _app.getJavaVMResource();
    if (vmjar == null) {
        throw new IOException("m.java_download_failed");
    }
    reportTrackingEvent("jvm_start", -1);
    updateStatus("m.downloading_java");
    List<Resource> list = new ArrayList<Resource>();
    list.add(vmjar);
    download(list);
    reportTrackingEvent("jvm_unpack", -1);
    updateStatus("m.unpacking_java");
    if (!vmjar.unpack()) {
        throw new IOException("m.java_unpack_failed");
    }
    vmjar.markAsValid();
    // Sun, why dost thou spite me? Java doesn't know anything about file permissions (and by
    // extension then, neither does Jar), so on Joonix we have to hackily make java_vm/bin/java
    // executable by execing chmod; a pox on their children!
    if (!RunAnywhere.isWindows()) {
        String vmbin = LaunchUtil.LOCAL_JAVA_DIR + File.separator + "bin" + File.separator + "java";
        String[] cmd = { "chmod", "a+rx", _app.getLocalPath(vmbin).toString() };
        try {
            log.info("Please smack a Java engineer. Running: " + Arrays.asList(cmd));
            Runtime.getRuntime().exec(cmd);
        } catch (Exception e) {
            log.warning("Failed to mark VM binary as executable", "cmd", cmd, "error", e);
            // we should do something like tell the user or something but fucking fuck
        }
    }
    // lastly regenerate the .jsa dump file that helps Java to start up faster
    String vmpath = LaunchUtil.getJVMPath(_app.getLocalPath(""));
    try {
        log.info("Regenerating classes.jsa for " + vmpath + "...");
        Runtime.getRuntime().exec(vmpath + " -Xshare:dump");
    } catch (Exception e) {
        log.warning("Failed to regenerate .jsa dum file", "error", e);
    }
    reportTrackingEvent("jvm_complete", -1);
}

[Buggy Hunk]
Runtime.getRuntime().exec(vmpath + " -Xshare:dump");

[Patch]
Runtime.getRuntime().exec(new String[] {vmpath, "-Xshare:dump"});