[Demonstration 1]

[Buggy Method]
private void requestFlushIfNonePending() {
    // NOTE:  This must be called under lock!
    if ((0 == this.outstandingTimerToken) && (null != this.activeWrapper)) {
        // There is no timer running so request one.
        this.outstandingTimerToken = this.timer.addDelayed(new Runnable() {

            @Override
            public void run() {
                backgroundThreadFlush();
            }
        }, ASYNC_FLUSH_DELAY_MILLIS);
        Assert.assertTrue(this.outstandingTimerToken > 0);
    }
}

[Buggy Hunk]
}}, ASYNC_FLUSH_DELAY_MILLIS);

[Patch]
}}, this.timer.currentTimeMillis() + ASYNC_FLUSH_DELAY_MILLIS);

[Demonstration 2]

[Buggy Method]
public boolean handle(Request req, Response res) throws IOException, ServletException {
    String method = req.getMethod();
    String subPath = getSubPath(req);
    Handler handler = routers.get(routerKey(method, subPath));
    if (null != handler) {
        handler.handle(req, res);
        return true;
    }
    ParamRouter paramRouter = getParamRouter(method, subPath, req);
    if (null != paramRouter) {
        paramRouter.getHandler().handle(req, res);
        return true;
    }
    return false;
}

[Buggy Hunk]
Handler handler = routers.get(routerKey(method, subPath));

[Patch]
Handler handler = getHandler(method, subPath);

[Demonstration 3]

[Buggy Method]
@Override
public void extract(String filePath) throws Exception {
    if (StringUtils.isEmptyString(current_checkit_tiff_binary_path)) {
        //log.error("No checkit_tiff_binary_path defined. Please set the plugin parameter to hold your checkit_tiff_binary_path.");
        throw new Exception("path for (current) checkit_tiff_binary not found");
    }
    if (StringUtils.isEmptyString(current_checkit_tiff_config_path)) {
        //log.error("No checkit_tiff_config_path defined. Please set the plugin parameter to hold your checkit_tiff_config_path.");
        throw new Exception("path for (current) checkit_tiff_config not found");
    }
    if (StringUtils.isEmptyString(upcoming_checkit_tiff_binary_path)) {
        //log.error("No checkit_tiff_binary_path defined. Please set the plugin parameter to hold your checkit_tiff_binary_path.");
        throw new Exception("path for (upcoming) checkit_tiff_binary not found");
    }
    if (StringUtils.isEmptyString(upcoming_checkit_tiff_config_path)) {
        //log.error("No checkit_tiff_config_path defined. Please set the plugin parameter to hold your checkit_tiff_config_path.");
        throw new Exception("path for (upcoming) checkit_tiff_config not found");
    }
    if (StringUtils.isEmptyString(exiftool_binary_path)) {
        //log.error("No checkit_tiff_config_path defined. Please set the plugin parameter to hold your checkit_tiff_config_path.");
        throw new Exception("path for exiftool_binary not found");
    }
    // checkit_tiff validation (upcoming)
    try {
        String execstring = this.upcoming_checkit_tiff_binary_path + " " + filePath + " " + this.upcoming_checkit_tiff_config_path;
        System.out.println("executing: " + execstring);
        Process p = Runtime.getRuntime().exec(execstring);
        p.waitFor();
        BufferedReader reader = new BufferedReader(new InputStreamReader(p.getInputStream()));
        String line = reader.readLine();
        while (line != null) {
            System.out.println(line);
            validationLog.add(line);
            line = reader.readLine();
        }
        if (p.exitValue() == 0) {
            is_upcoming_checkit_tiff_valid = true;
            extractionErrors.clear();
        } else {
            // something wrong
            is_upcoming_checkit_tiff_valid = false;
            extractionErrors = validationLog;
        }
    } catch (IOException e) {
        //log.error("exception creation socket, clamd not available at host=" + host + "port=" + port, e);
        System.out.println("ERROR: (upcoming) checkit_tiff not available, path=" + this.upcoming_checkit_tiff_binary_path + ", " + e.getMessage());
        throw new Exception("ERROR: (upcoming) checkit_tiff not available, path=" + this.upcoming_checkit_tiff_binary_path + ", " + e.getMessage());
    }
    /* only check against current checkit_tiff if upcoming fails */
    if (is_upcoming_checkit_tiff_valid == false) {
        // checkit_tiff (current)
        try {
            String execstring = this.current_checkit_tiff_binary_path + " " + filePath + " " + this.current_checkit_tiff_config_path;
            System.out.println("executing: " + execstring);
            Process p = Runtime.getRuntime().exec(execstring);
            p.waitFor();
            BufferedReader reader = new BufferedReader(new InputStreamReader(p.getInputStream()));
            String line = reader.readLine();
            while (line != null) {
                System.out.println(line);
                validationLog.add(line);
                line = reader.readLine();
            }
            if (p.exitValue() == 0) {
                is_current_checkit_tiff_valid = true;
            } else {
                // something wrong
                is_current_checkit_tiff_valid = false;
            }
        } catch (IOException e) {
            //log.error("exception creation socket, clamd not available at host=" + host + "port=" + port, e);
            System.out.println("ERROR: (current) checkit_tiff not available, path=" + this.current_checkit_tiff_binary_path + ", " + e.getMessage());
            throw new Exception("ERROR: (current) checkit_tiff not available, path=" + this.current_checkit_tiff_binary_path + ", " + e.getMessage());
        }
    }
    /* If upcoming was true, only report a is valid, if current was true. report log of upcoming, if all fail, report log for all */
    if (true == is_upcoming_checkit_tiff_valid) {
        isvalid = true;
        iswellformed = true;
        extractionErrors.clear();
    } else if (true == is_current_checkit_tiff_valid) {
        isvalid = true;
        iswellformed = true;
        extractionErrors = validationLog;
    } else {
        isvalid = false;
        iswellformed = false;
        extractionErrors = validationLog;
    }
    // exiftool output of metadata
    try {
        String execstring = this.exiftool_binary_path + " -X " + filePath;
        System.out.println("executing: " + execstring);
        Process p = Runtime.getRuntime().exec(execstring);
        p.waitFor();
        BufferedReader reader = new BufferedReader(new InputStreamReader(p.getInputStream()));
        String line = reader.readLine();
        String response = "";
        while (line != null) {
            System.out.println(line);
            parse_exiftool_output(line.trim());
            response += line;
            line = reader.readLine();
        }
        attributes.put("exiftool-log", response.trim());
    } catch (IOException e) {
        //log.error("exception creation socket, clamd not available at host=" + host + "port=" + port, e);
    } catch (InterruptedException e) {
        e.printStackTrace();
    }
    // attributes.put("checkit-tiff-version", "");
    // attributes.put("checkit-tiff-path", current_checkit_tiff_binary_path.trim());
    // attributes.put("checkit-tiff-conf", current_checkit_tiff_config_path.trim());
    attributes.put("checkit-tiff-log", validationLog.toString());
}

[Buggy Hunk]
String execstring = this.upcoming_checkit_tiff_binary_path + " " + filePath + " " + this.upcoming_checkit_tiff_config_path;

[Patch]
String execstring = this.upcoming_checkit_tiff_binary_path + " " + this.upcoming_checkit_tiff_config_path + " " + filePath ;