[Demonstration 1]

[Buggy Method]
public void addMarkAllfromIntent(MapNearByResModel rsModel) {
    for (int index = 0; index < rsModel.results.size(); index++) {
        String type = "";
        for (String s : rsModel.results.get(index).types) {
            type += s + "\n";
        }
        addMark(Double.parseDouble(rsModel.results.get(index).geometry.location.lat), Double.parseDouble(rsModel.results.get(index).geometry.location.lng), rsModel.results.get(index).name, type);
    }
}

[Buggy Hunk]
addMark(Double.parseDouble(rsModel.results.get(index).geometry.location.lat),

[Patch]
addMarkFromLat(Double.parseDouble(rsModel.results.get(index).geometry.location.lat),

[Demonstration 2]

[Buggy Method]
private void handleActionCompute(@NonNull final Location location, @Nullable Calendar eventCal, final Constants.SolarEvents event) {
    MyLocation loc;
    try {
        loc = new MyLocation(new Double(location.getLatitude()).toString(), new Double(location.getLongitude()).toString());
        String timeZone = SimpleTimeZone.getDefault().getID();
        SunriseSunsetCalculator calculator = new SunriseSunsetCalculator(loc, timeZone);
        Calendar cal = eventCal;
        if (cal == null) {
            cal = new GregorianCalendar();
        }
        // FIXME this needs to be refactored
        if (event == Constants.SolarEvents.SUNRISE) {
            Calendar sunriseCal = calculator.getOfficialSunriseCalendarForDate(cal);
            // if current time is past sunrise time then re-compute next one
            if (cal.compareTo(sunriseCal) == 1) {
                cal.add(Calendar.DAY_OF_WEEK, 1);
                sunriseCal = calculator.getOfficialSunriseCalendarForDate(cal);
            }
            String sunrise = getPrettyTime(sunriseCal);
            DataWrapper.saveString(getApplicationContext(), Constants.SOL_DB, Constants.SUNRISE_TIME_TEXT_KEY, sunrise);
            CalendarDataHelper dataHelper = CalendarDataHelper.getInstance();
            dataHelper.setCalFor(CalendarDataHelper.sunrise_key, sunriseCal);
        } else {
            Calendar sunsetCal = calculator.getOfficialSunsetCalendarForDate(cal);
            // if current time is past sunset time then re-compute next one
            if (cal.compareTo(sunsetCal) == 1) {
                cal.add(Calendar.DAY_OF_WEEK, 1);
                sunsetCal = calculator.getOfficialSunriseCalendarForDate(cal);
            }
            String sunset = getPrettyTime(sunsetCal);
            DataWrapper.saveString(getApplicationContext(), Constants.SOL_DB, Constants.SUNSET_TIME_TEXT_KEY, sunset);
            CalendarDataHelper dataHelper = CalendarDataHelper.getInstance();
            dataHelper.setCalFor(CalendarDataHelper.sunset_key, sunsetCal);
        }
    } catch (NullPointerException e) {
        L.e(TAG, "Null location");
    }
}

[Buggy Hunk]
sunsetCal = calculator.getOfficialSunriseCalendarForDate(cal);

[Patch]
sunsetCal = calculator.getOfficialSunsetCalendarForDate(cal);

[Demonstration 3]

[Buggy Method]
private void startBroadcast() {
    LOG.info("Start Broadcast Phase");
    long bcStartTime = System.nanoTime();
    LOG.info("Time required to reach Broadcast Phase:" + (properties.leStartTime - bcStartTime) / 1000000);
    if (properties.getNodestate() == NodeServerProperties1.State.ELECTION) {
        changePhase();
    }
    // Clear proposal queue
    this.properties.getSynData().getProposedTransactions().clear();
    this.properties.getSynData().getCommittedTransactions().clear();
    MonitorProposeQueue monitorObj = null;
    WriteToDisk wtdObj = null;
    if (properties.getNodestate() == NodeServerProperties1.State.LEADING) {
        LOG.debug("Starting Monitor Propose Queue thread for leader...");
        monitorObj = new MonitorProposeQueue(properties, this);
        Thread threadMonitorProposeQueue = new Thread(monitorObj);
        threadMonitorProposeQueue.setPriority(Thread.MIN_PRIORITY);
        threadMonitorProposeQueue.start();
    }
    LOG.debug("Starting Write to disk thread irrespective of leader or follower...");
    if (properties.getNodestate() != NodeServerProperties1.State.ELECTION) {
        wtdObj = new WriteToDisk(properties);
        Thread threadWriteToDisk = new Thread(wtdObj);
        threadWriteToDisk.setPriority(Thread.MIN_PRIORITY);
        threadWriteToDisk.start();
    }
    while (properties.getNodestate() != NodeServerProperties1.State.ELECTION) {
        try {
            Thread.sleep(3000);
        } catch (InterruptedException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
    }
    if (monitorObj != null)
        monitorObj.stop();
    wtdObj.stop();
    LOG.info("End of Broadcast Phase");
    changePhase();
}

[Buggy Hunk]
LOG.info("Time required to reach Broadcast Phase:" + (properties.leStartTime-bcStartTime)/1000000);

[Patch]
LOG.info("Time required to reach Broadcast Phase:" + (bcStartTime - properties.leStartTime)/1000000);