[Demonstration 1]

[Buggy Method]
@Override
public int compareTo(final Event other) {
    return Long.valueOf(getEventStartTime()).compareTo(other.getEventStartTime());
}

[Buggy Hunk]
return Long.valueOf(getEventStartTime()).compareTo(other.getEventStartTime());

[Patch]
return Long.compare(getEventStartTime(), other.getEventStartTime());

[Demonstration 2]

[Buggy Method]
public void run() {
    logger.info("request runner started.");
    handler.handleRequest(socket);
}

[Buggy Hunk]
logger.info("request runner started.");

[Patch]
logger.debug("request runner started...");

[Demonstration 3]

[Buggy Method]
@Override
public synchronized void log(List<LogRecordContainer> containers, long timestamp) {
    if (cms == null) {
        logger.error("Requested to log values for deactivated Emoncms logger");
    } else if (containers == null || containers.isEmpty()) {
        logger.warn("Requested Emoncms logger to log an empty container list");
    } else if (containers.size() == 1) {
        LogRecordContainer container = containers.get(0);
        if (isValid(container)) {
            ChannelInput channel = channelInputsById.get(container.getChannelId());
            try {
                Record record = container.getRecord();
                Long time = record.getTimestamp();
                if (time == null) {
                    time = timestamp;
                }
                Timevalue timevalue = new Timevalue(time, record.getValue().asDouble());
                channel.post(timevalue);
            } catch (EmoncmsException | TypeConversionException e) {
                logger.warn("Failed to log record for channel \"{}\": {}", container.getChannelId(), e.getMessage());
            }
        }
    } else {
        // TODO: Check, if several channels can be posted for the same device at once
        List<DeviceValuesCollection> devices = new ArrayList<DeviceValuesCollection>();
        for (LogRecordContainer container : containers) {
            if (isValid(container)) {
                ChannelInput channel = channelInputsById.get(container.getChannelId());
                try {
                    Record record = container.getRecord();
                    Long time = record.getTimestamp();
                    if (time == null) {
                        time = timestamp;
                    }
                    Namevalue value = new Namevalue(container.getChannelId(), record.getValue().asDouble());
                    DeviceValuesCollection device = null;
                    for (DeviceValuesCollection d : devices) {
                        if (d.getNode().equals(channel.getInput().getNode()) && d.getAuthenticator().equals(channel.getAuthenticator()) && d.getTimestamp() == time) {
                            d.add(value);
                            device = d;
                            break;
                        }
                    }
                    if (device == null) {
                        // No input collection for that device exists yet, so it needs to be created
                        device = new DeviceValuesCollection(channel.getInput().getNode(), channel.getAuthenticator(), time);
                        device.add(value);
                        devices.add(device);
                    }
                } catch (TypeConversionException e) {
                    logger.warn("Failed to prepare record to log to Channel \"{}\": {}", container.getChannelId(), e.getMessage());
                }
            }
        }
        for (DeviceValuesCollection device : devices) {
            if (logger.isTraceEnabled()) {
                logger.trace("Attempting to log values for {} channels at device node \"{}\"", device.size(), device.getNode());
            }
            try {
                cms.post(device.getNode(), device.getTimestamp(), device, device.getAuthenticator());
            } catch (EmoncmsException e) {
                logger.warn("Failed to log values for device node \"{}\": {}", device.getNode(), e.getMessage());
            }
        }
    }
}

[Buggy Hunk]
logger.warn("Requested Emoncms logger to log an empty container list");

[Patch]
logger.debug("Requested Emoncms logger to log an empty container list");