[Demonstration 1]

[Buggy Method]
@Override
public void execute(Response resp) throws InterruptedException, SuspendExecution {
    // TODO Auto-generated method stub
    System.out.println("");
    this.displayPlan();
    System.out.println("");
    if (this.reqRate != 0) {
        this.running = true;
        this.reqsDetails.clear();
        for (int i = 0; i < httpreqlist.size(); i++) {
            Output outputrow = new Output();
            Date now = new Date();
            String strDate = sdf.format(now);
            outputrow.setRequest("TestPlan-" + this.getId() + "-Request-" + (i + 1));
            outputrow.setTime(strDate);
            outputrow.setInputload("0 reqs/sec");
            outputrow.setErrorrate("0%");
            outputrow.setAvgThroughput("0 reqs/sec");
            outputrow.setCurThroughput("0 reqs/sec");
            outputrow.setResponsetime("0 msec");
            MainController.outputlist.set(this.getOutputrowstart() + i, outputrow);
            List<Long> temp = new ArrayList<Long>();
            // Send Request Rate
            temp.add((long) 0);
            // Success Request count
            temp.add((long) 0);
            // Error Request count
            temp.add((long) 0);
            // Current Throughput
            temp.add((long) 0);
            // Response Time
            temp.add((long) 0);
            this.reqsDetails.put(httpreqlist.get(i), temp);
            // totalresptimes.put(httpreqlist.get(i), (long) 0);
        }
        /*
			 * System.out.println("Duration : "+ duration);
			 * System.out.println("Reqrate : "+ reqRate);
			 */
        Fiber.sleep(this.getStartDelay() * 1000);
        if (this.random == 1) {
            //System.out.println("Epoch Number : " + this.getId());
            logger.info("Epoch Number : " + this.getId());
        }
        int fiberArraysize = this.duration * this.reqRate;
        Fiber[] fibers = new Fiber[fiberArraysize];
        //System.out.println("Array Size = " + fiberArraysize);
        final int num = this.duration * this.reqRate;
        // int runningcount=num;
        this.setRunningcount(num);
        final RateLimiter rl = RateLimiter.create(this.reqRate);
        Date now1 = new Date();
        logger.info("starttime " + sdf.format(now1));
        this.outputFiber();
        final Semaphore sem = new Semaphore(1500000);
        for (int i = 0; i < num && MainController.test; i++) {
            rl.acquire();
            if (sem.availablePermits() == 0)
                logger.info("Maximum connections count reached, waiting...");
            sem.acquireUninterruptibly();
            new Fiber<Void>(() -> {
                try {
                    int k = 0;
                    Response currresp = new Response();
                    for (k = 0; k < this.testPlan.size(); k++) {
                        if (this.reqsDetails.get(k) != null) {
                            this.reqsDetails.get(k).set(0, (this.reqsDetails.get(k).get(0)) + 1);
                            long startTime = System.currentTimeMillis();
                            ((Feature) this.testPlan.get(k)).execute(currresp);
                            long elapsedTime = System.currentTimeMillis() - startTime;
                            if (currresp.getResponse().getStatusLine().toString().contains("OK")) {
                                this.reqsDetails.get(k).set(1, this.reqsDetails.get(k).get(1) + 1);
                                this.reqsDetails.get(k).set(2, this.reqsDetails.get(k).get(2));
                                this.reqsDetails.get(k).set(3, this.reqsDetails.get(k).get(3) + 1);
                                this.reqsDetails.get(k).set(4, this.reqsDetails.get(k).get(4) + elapsedTime);
                            } else {
                                this.reqsDetails.get(k).set(1, this.reqsDetails.get(k).get(1));
                                this.reqsDetails.get(k).set(2, this.reqsDetails.get(k).get(2) + 1);
                                this.reqsDetails.get(k).set(3, this.reqsDetails.get(k).get(3));
                                this.reqsDetails.get(k).set(4, this.reqsDetails.get(k).get(4));
                            }
                        } else {
                            ((Feature) this.testPlan.get(k)).execute(currresp);
                        }
                    }
                } catch (final Throwable t) {
                } finally {
                    // logger.info("inside finally");
                    sem.release();
                    this.setRunningcount(this.getRunningcount() - 1);
                }
            }).start();
        }
        Fiber.sleep(this.duration * 1000);
        while (true) {
            // logger.info(this.getRunningcount());
            if (this.runningcount <= 0) {
                this.running = false;
                break;
            }
        }
        Date now2 = new Date();
        logger.info("endtime " + sdf.format(now2));
        /*
			 * if (!MainController.test) { MainController.test = true; }
			 */
        try {
            fileWriter.flush();
            fileWriter.close();
        } catch (IOException e) {
            logger.info("Error while flushing/closing fileWriter !!!");
            e.printStackTrace();
        }
    }
    logger.info("TestPlan Finished");
}

[Buggy Hunk]
System.out.println(""); this.displayPlan(); System.out.println("");

[Patch]
this.displayPlan();

[Demonstration 2]

[Buggy Method]
private String minUpdateInterval(String interval1, String interval2) {
    LOG.warn("interval1: {}, interval2: {}", interval1, interval2);
    if (interval1 == null) {
        return interval2;
    } else if (interval2 == null) {
        return interval1;
    }
    int interval1InMin = getIntervalInMinutes(interval1);
    int interval2InMin = getIntervalInMinutes(interval2);
    if (interval1InMin <= interval2InMin) {
        return getUpdatePolicyInterval(interval1InMin);
    } else {
        return getUpdatePolicyInterval(interval2InMin);
    }
}

[Buggy Hunk]
LOG.warn("interval1: {}, interval2: {}", interval1, interval2);

[Patch]
LOG.debug("interval1: {}, interval2: {}", interval1, interval2);

[Demonstration 3]

[Buggy Method]
public static void main(String[] args) throws IOException {
    String substring;
    if (args.length < 2) {
        System.out.println("Too few arguments");
    } else {
        substring = args[0];
        for (int i = 1; i < args.length; i++) {
            Path path;
            path = Paths.get(args[i]);
            FileSearch fileSearch = new FileSearch();
            try {
                fileSearch.visitFilesInDirectory(path, substring);
            } catch (AccessDeniedException e) {
                System.out.println(path + ": access denied to" + path);
            } catch (IOException e) {
                System.out.println(path + ": " + e.toString());
            }
        }
    }
}

[Buggy Hunk]
System.out.println(path + ": access denied to" + path);

[Patch]
System.out.println(path + ": access denied to");