[Demonstration 1]

[Buggy Method]
public void populateChangeDeviceServicePlansDBPayload(Exchange exchange) {
    // TODO Auto-generated method stub
    log.info("Inside populateChangeDeviceServicePlansDBPayload");
    ArrayList<Transaction> list = new ArrayList<Transaction>();
    String currentDataTime = CommonUtil.getCurrentTimeStamp();
    ChangeDeviceServicePlansRequest req = (ChangeDeviceServicePlansRequest) exchange.getIn().getBody();
    ChangeDeviceServicePlansRequestDataArea changeDeviceServicePlansRequestDataArea = (ChangeDeviceServicePlansRequestDataArea) req.getDataArea();
    Devices[] changeServicePlansDevices = changeDeviceServicePlansRequestDataArea.getDevices();
    Kryo kryo = new Kryo();
    for (Devices changeServicePlansDevice : changeServicePlansDevices) {
        ChangeDeviceServicePlansRequest dbPayload = new ChangeDeviceServicePlansRequest();
        dbPayload.setHeader(req.getHeader());
        Devices[] businessPayloadDeviceArray = new Devices[1];
        Devices businessPayLoadChangeServicePlansDevices = new Devices();
        DeviceId[] businessPayloadDeviceId = new DeviceId[changeServicePlansDevice.getDeviceIds().length];
        for (int i = 0; i < changeServicePlansDevice.getDeviceIds().length; i++) {
            DeviceId changeServicePlansDeviceId = changeServicePlansDevice.getDeviceIds()[i];
            DeviceId businesspayLoadChangeServicePlansDeviceId = new DeviceId();
            businesspayLoadChangeServicePlansDeviceId.setId(changeServicePlansDeviceId.getId());
            businesspayLoadChangeServicePlansDeviceId.setKind(changeServicePlansDeviceId.getKind());
            businessPayloadDeviceId[i] = businesspayLoadChangeServicePlansDeviceId;
        }
        businessPayLoadChangeServicePlansDevices.setDeviceIds(businessPayloadDeviceId);
        businessPayloadDeviceArray[0] = businessPayLoadChangeServicePlansDevices;
        ChangeDeviceServicePlansRequestDataArea copyDataArea = kryo.copy(req.getDataArea());
        copyDataArea.setDevices(businessPayloadDeviceArray);
        dbPayload.setDataArea(copyDataArea);
        try {
            Transaction transaction = new Transaction();
            transaction.setMidwayTransactionId(exchange.getProperty(IConstant.MIDWAY_TRANSACTION_ID).toString());
            //Sorting the device id by kind and inserting into deviceNumber
            Arrays.sort(businessPayloadDeviceId, (DeviceId a, DeviceId b) -> a.getKind().compareTo(b.getKind()));
            ObjectMapper obj = new ObjectMapper();
            String strDeviceNumber = obj.writeValueAsString(businessPayloadDeviceId);
            transaction.setDeviceNumber(strDeviceNumber);
            transaction.setDevicePayload(dbPayload);
            transaction.setMidwayStatus(IConstant.MIDWAY_TRANSACTION_STATUS_PENDING);
            transaction.setCarrierName(exchange.getProperty(IConstant.MIDWAY_DERIVED_CARRIER_NAME).toString());
            transaction.setTimeStampReceived(currentDataTime);
            transaction.setAuditTransactionId(exchange.getProperty(IConstant.AUDIT_TRANSACTION_ID).toString());
            transaction.setRequestType(RequestType.CHNAGESERVICEPLAN);
            transaction.setCallBackReceived(false);
            list.add(transaction);
        } catch (Exception ex) {
            log.error("Exception populateChangeDeviceServicePlansDBPayload");
        }
    }
    mongoTemplate.insertAll(list);
    // For Kore We Need Wire Tap and SEDA component So the body should
    // be set with arraylist of transaction for Verizon we simply add
    // into database and do not change the exchange body
    if (exchange.getProperty(IConstant.MIDWAY_DERIVED_CARRIER_NAME).toString().equals("KORE")) {
        exchange.getIn().setBody(list);
    }
}

[Buggy Hunk]
transaction.setRequestType(RequestType.CHNAGESERVICEPLAN);

[Patch]
transaction.setRequestType(RequestType.CHANGESERVICEPLAN);

[Demonstration 2]

[Buggy Method]
protected List<? extends Object> getPageElementsByXPath(HtmlPage page, String xPath) {
    setTestInfo("Getting page: " + page.getUrl().toString() + " ,elements by xPath: " + xPath);
    return page.getByXPath(xPath);
}

[Buggy Hunk]
protected List<? extends Object> getPageElementsByXPath(HtmlPage page, String xPath) {

[Patch]
protected List<?> getPageElementsByXPath(HtmlPage page, String xPath) {

[Demonstration 3]

[Buggy Method]
public void notifyChanged(Notification notification) {
    super.notifyChanged(notification);
    if (notification.getFeature() instanceof EAttributeImpl) {
        if (notification.getNotifier() instanceof BoundsImpl) {
            reposition(((BoundsImpl) notification.getNotifier()).getX(), ((BoundsImpl) notification.getNotifier()).getY(), ((BoundsImpl) notification.getNotifier()).getWidth(), getTreeHeight());
            FigureCanvas canvas = (FigureCanvas) getViewer().getControl();
            canvas.getViewport().repaint();
        }
    }
}

[Buggy Hunk]
getTreeHeight());

[Patch]
TreeNodeUtils.getTreeHeight(inputRootTreeNode, LEAF_HEIGHT));