[Demonstration 1]

[Buggy Method]
public void menu() {
    //Make new scanner for user inputs
    Scanner input = new Scanner(System.in);
    String choice = "";
    boolean looping = true;
    while (looping) {
        //System message before user input
        System.out.println("Select an option by typing the corresponding number and pressing \"enter\"");
        System.out.println("1. Create a new user");
        System.out.println("2. Show all existing users");
        System.out.println("3. Update an existing user");
        System.out.println("4. Delete an existing user");
        System.out.println("5. Close the program");
        //Assign this value as a choice
        choice = input.next();
        /*
			 * Determine which method to run. 
			 * If the choice does not correspond to a case, 
			 * the user is given the option to type a new number
			 */
        switch(choice) {
            case "1":
                looping = false;
                //Close the input
                input.close();
                createUser();
                break;
            case "2":
                looping = false;
                //Close the input
                input.close();
                showUsers();
                break;
            case "3":
                looping = false;
                //Close the input
                input.close();
                updateUser();
                break;
            case "4":
                looping = false;
                //Close the input
                input.close();
                deleteUser();
                break;
            case "5":
                looping = false;
                //Close the input
                input.close();
                endProgram();
                break;
            default:
                looping = true;
                System.out.println("You entered " + choice + " which is not a valid choice.\n");
                break;
        }
    }
}

[Buggy Hunk]
public void menu(){

[Patch]
public void menu() throws DALException{

[Demonstration 2]

[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 3]

[Buggy Method]
@Override
public void setValueAt(Object value, int rowIndex, int columnIndex) {
    PaymentAdjustmentRowItem rowItem = rowItems.get(rowIndex);
    String val = (String) value;
    switch(columnIndex) {
        case PaymentPaymentAdjustmentsTable.ADJUSTMENT_TYPE_COLUMN_INDEX:
            AdjustmentType adjustmentType = adjustmentTypeService.findAdjustmentTypeByCode(val);
            if (val != null && val.equals(rowItem.getAdjustmentType().getCode())) {
                fireTableCellUpdated(rowIndex, columnIndex);
                return;
            }
            rowItem.setAdjustmentType(adjustmentType);
            rowItem.setReferenceNumber(null);
            rowItem.setAmount(null);
            break;
        case PaymentPaymentAdjustmentsTable.REFERENCE_NUMBER_COLUMN_INDEX:
            columnIndex = PaymentPaymentAdjustmentsTable.AMOUNT_COLUMN_INDEX;
            if (val.equals(rowItem.getReferenceNumber())) {
                return;
            }
            rowItem.setReferenceNumber(val);
            switch(rowItem.getAdjustmentType().getCode()) {
                case AdjustmentType.SALES_RETURN_CODE:
                    SalesReturn salesReturn = salesReturnService.findSalesReturnBySalesReturnNumber(Long.parseLong(val));
                    rowItem.setAmount(salesReturn.getTotalAmount());
                    break;
                case AdjustmentType.BAD_STOCK_RETURN_CODE:
                    BadStockReturn badStockReturn = badStockReturnService.findBadStockReturnByBadStockReturnNumber(Long.parseLong(val));
                    rowItem.setAmount(badStockReturn.getTotalAmount());
                    break;
                case AdjustmentType.NO_MORE_STOCK_ADJUSTMENT_CODE:
                    NoMoreStockAdjustment noMoreStockAdjustment = noMoreStockAdjustmentService.findNoMoreStockAdjustmentByNoMoreStockAdjustmentNumber(Long.parseLong(val));
                    rowItem.setAmount(noMoreStockAdjustment.getTotalAmount());
                    break;
                default:
                    PaymentAdjustment paymentAdjustment = paymentAdjustmentService.findPaymentAdjustmentByPaymentAdjustmentNumber(Long.parseLong(val));
                    rowItem.setAmount(paymentAdjustment.getAmount());
                    break;
            }
            break;
        case PaymentPaymentAdjustmentsTable.AMOUNT_COLUMN_INDEX:
            String amount = (String) value;
            if (NumberUtil.toBigDecimal(amount).equals(rowItem.getAmount())) {
                return;
            }
            rowItem.setAmount(NumberUtil.toBigDecimal(amount));
            break;
    }
    if (rowItem.isValid()) {
        PaymentPaymentAdjustment adjustment = rowItem.getAdjustment();
        adjustment.setAdjustmentType(rowItem.getAdjustmentType());
        adjustment.setReferenceNumber(rowItem.getReferenceNumber());
        adjustment.setAmount(rowItem.getAmount());
        boolean newAdjustment = (adjustment.getId() == null);
        paymentService.save(adjustment);
        if (newAdjustment) {
            adjustment.getParent().getAdjustments().add(adjustment);
        }
    }
    fireTableCellUpdated(rowIndex, columnIndex);
}

[Buggy Hunk]
if (val != null && val.equals(rowItem.getAdjustmentType().getCode())) {

[Patch]
if (rowItem.getAdjustmentType() != null && rowItem.getAdjustmentType().getCode().equals(val)) {