[Demonstration 1]

[Buggy Method]
protected void initialise() throws IOException {
    if (initialised)
        return;
    String classpath = this.getClasspath();
    String[] paths = classpath.split(System.getProperty("path.separator", ":"));
    logger.debug("Initialising remote server: Transferring classpath deps.");
    // mkdir
    try {
        ProcessBuilder builder = new ProcessBuilder("ssh", remoteUser + "@" + remoteHost, "mkdir -p " + remoteWorkingDir);
        logger.debug(builder.command());
        builder.redirectErrorStream(true);
        Process process = builder.start();
        StreamGobbler gobbler = new StreamGobbler(process.getInputStream(), System.out);
        gobbler.start();
        process.waitFor();
        if (process.exitValue() != 0) {
            throw new IOException("Could create working directory on remote server.");
        }
    } catch (InterruptedException e) {
    }
    // transfer dependencies
    // reverse iteration so that classes folders at the beginning of the
    // classpath get precedence.
    for (int i = paths.length - 1; i >= 0; i--) {
        ProcessBuilder builder = new ProcessBuilder("rsync", "-avz", "-e", "ssh", paths[i], remoteUser + "@" + remoteHost + ":" + remoteWorkingDir + "/deps/");
        logger.debug(builder.command());
        builder.redirectErrorStream(true);
        Process process = builder.start();
        StreamGobbler gobbler = new StreamGobbler(process.getInputStream());
        gobbler.start();
        try {
            process.waitFor();
        } catch (InterruptedException e) {
        }
        if (process.exitValue() != 0) {
            throw new IOException("Could not copy all classpath components to remote server.");
        }
    }
    remoteClasspath = remoteWorkingDir + "/deps/classes/:" + remoteWorkingDir + "/deps/*";
    initialised = true;
}

[Buggy Hunk]
+ remoteWorkingDir + "/deps/*";

[Patch]
+ remoteWorkingDir + "/deps/*:" + remoteWorkingDir + "/deps/";

[Demonstration 2]

[Buggy Method]
private void setupMarkers() {
    markers = new ArrayList<>();
    LatLng position = null;
    LatLngBounds.Builder builder = new LatLngBounds.Builder();
    for (String key : coords.keySet()) {
        LatLng latLng = coords.get(key);
        Marker marker = mMap.addMarker(getMarkerOptions(key, latLng));
        marker.setTitle(key);
        marker.showInfoWindow();
        markers.add(marker);
        builder.include(marker.getPosition());
        if (isSelectedLocation(key)) {
            position = latLng;
        }
    }
    // zoom in on marker group if no location was selected
    if (position == null) {
        builder.build().getCenter();
    }
    CameraPosition cameraPosition = new CameraPosition.Builder().target(position).zoom(14).build();
    mMap.moveCamera(CameraUpdateFactory.newCameraPosition(cameraPosition));
}

[Buggy Hunk]
builder.build().getCenter();

[Patch]
position = builder.build().getCenter();

[Demonstration 3]

[Buggy Method]
private void printTopIPResults(List<IPResult> ipResults, int top) {
    try {
        Writer writer = new BufferedWriter(new FileWriter(formatFileName(outputShortFile), false));
        for (int i = 0; i < ipResults.size() && i < top; i++) {
            writer.write(String.format("model #%d", ipResults.get(i).getNumber()));
            writer.write(System.lineSeparator());
            writer.write(String.format("%s: %f", errorMode, ipResults.get(i).getError()));
            writer.write(System.lineSeparator());
            writer.write(String.format("output value: %.3f", ipResults.get(i).getOutputValue()));
            writer.write(System.lineSeparator());
            if (capacityLeft != -1) {
                writer.write(String.format("total output: %.3f, expected capacity unused: %.3f", ipResults.get(i).getOutputValue(), capacityLeft - ipResults.get(i).getOutputValue()));
                writer.write(System.lineSeparator());
            }
            writer.write("template: ");
            writer.write(PrintUtils.printArray(ipResults.get(i).getTemplates()));
            writer.write(System.lineSeparator());
            writer.write("-------------------------------------------------------------------------");
            writer.write(System.lineSeparator());
        }
        writer.flush();
        writer.close();
    } catch (IOException e) {
        e.printStackTrace();
    }
}

[Buggy Hunk]
ipResults.get(i).getOutputValue(),

[Patch]
previousOutput + ipResults.get(i).getOutputValue(),