[Demonstration 1]

[Buggy Method]
private void parseUnsafe(XMLStreamReader reader, ConfigurationBuilder builder) throws XMLStreamException {
    for (int i = 0; i < reader.getAttributeCount(); i++) {
        ParseUtils.requireNoNamespaceAttribute(reader, i);
        String value = replaceSystemProperties(reader.getAttributeValue(i));
        Attribute attribute = Attribute.forName(reader.getAttributeLocalName(i));
        switch(attribute) {
            case UNRELIABLE_RETURN_VALUES:
                builder.unsafe().unreliableReturnValues(Boolean.valueOf(value).booleanValue());
                break;
            default:
                throw ParseUtils.unexpectedAttribute(reader, i);
        }
    }
    ParseUtils.requireNoContent(reader);
}

[Buggy Hunk]
builder.unsafe().unreliableReturnValues(Boolean.valueOf(value).booleanValue());

[Patch]
builder.unsafe().unreliableReturnValues(Boolean.valueOf(value));

[Demonstration 2]

[Buggy Method]
@Override
public ChannelFuture generate(final String hostname) {
    log.info(String.format("Generating: %s", hostname));
    URL url = null;
    try {
        url = new URL(hostname);
    } catch (MalformedURLException e) {
        throw new RuntimeException(e);
    }
    final String host = url.getHost();
    final int port = url.getPort() == -1 ? url.getDefaultPort() : url.getPort();
    final ChannelFuture retVal;
    final ChannelFuture connectFuture = bootstrap.connect(new InetSocketAddress(host, port));
    if ("https".equals(url.getProtocol())) {
        if (sslContext == null) {
            throw new IllegalStateException("No sslContext set, cannot do https");
        }
        final SSLEngine sslEngine = sslContext.createSSLEngine(host, port);
        final SSLParameters sslParameters = new SSLParameters();
        sslParameters.setEndpointIdentificationAlgorithm("HTTPS");
        sslEngine.setSSLParameters(sslParameters);
        sslEngine.setUseClientMode(true);
        final SslHandler sslHandler = new SslHandler(sslEngine, SslHandler.getDefaultBufferPool(), false, timer, sslHandshakeTimeout);
        // https://github.com/netty/netty/issues/160
        sslHandler.setCloseOnSSLException(true);
        final ChannelPipeline pipeline = connectFuture.getChannel().getPipeline();
        pipeline.addFirst("ssl", sslHandler);
        final ChannelFuture handshakeFuture = Channels.future(connectFuture.getChannel());
        connectFuture.addListener(new ChannelFutureListener() {

            @Override
            public void operationComplete(ChannelFuture f) throws Exception {
                if (f.isSuccess()) {
                    sslHandler.handshake().addListener(new ChannelFutureListener() {

                        @Override
                        public void operationComplete(ChannelFuture f2) throws Exception {
                            if (f2.isSuccess()) {
                                handshakeFuture.setSuccess();
                            } else {
                                handshakeFuture.setFailure(new ChannelException(String.format("Failed to handshake with host[%s]", hostname), f2.getCause()));
                            }
                        }
                    });
                } else {
                    handshakeFuture.setFailure(new ChannelException(String.format("Failed to connect to host[%s]", hostname), f.getCause()));
                }
            }
        });
        retVal = handshakeFuture;
    } else {
        retVal = connectFuture;
    }
    return retVal;
}

[Buggy Hunk]
log.info(String.format("Generating: %s", hostname));

[Patch]
log.info("Generating: %s", hostname);

[Demonstration 3]

[Buggy Method]
@Override
public JsonElement serialize(EventRecord src, Type typeOfSrc, JsonSerializationContext context) {
    JsonObject eventJson = new JsonObject();
    SplunkJenkinsInstallation config = SplunkJenkinsInstallation.get();
    if (!config.isMetaDataInURLSupported()) {
        //need append metadata into event json object
        eventJson = (JsonObject) context.serialize(src.getMetaData());
    }
    eventJson.add("event", context.serialize(src.getMessage()));
    eventJson.addProperty("time", src.getTimestamp());
    return eventJson;
}

[Buggy Hunk]
if (!config.isMetaDataInURLSupported()) {

[Patch]
if (!config.isMetaDataInURLSupported(src.getEventType().needSplit())) {