[Demonstration 1]

[Buggy Method]
@Override
public void onConfigurationChanged(Configuration newConfig) {
    super.onConfigurationChanged(newConfig);
    // Checks whether a hardware keyboard is available
    if (newConfig.hardKeyboardHidden == Configuration.HARDKEYBOARDHIDDEN_NO) {
        LinearLayout parent = (LinearLayout) findViewById(R.id.parent);
        RelativeLayout.LayoutParams layoutParams = (RelativeLayout.LayoutParams) parent.getLayoutParams();
        layoutParams.addRule(RelativeLayout.CENTER_IN_PARENT, 0);
        parent.setLayoutParams(layoutParams);
    }
}

[Buggy Hunk]
LinearLayout parent = (LinearLayout) findViewById(R.id.parent);

[Patch]
RelativeLayout parent = (RelativeLayout) findViewById(R.id.parent);

[Demonstration 2]

[Buggy Method]
@Override
public Class<?> loadClass(String className) throws ClassNotFoundException {
    synchronized (getClassLoadingLock(className)) {
        log.debug("Received request to load class '{}'", className);
        // if the class it's a part of the plugin engine use parent class loader
        if (className.startsWith(PLUGIN_PACKAGE_PREFIX)) {
            log.debug("Delegate the loading of class '{}' to parent", className);
            try {
                return getClass().getClassLoader().loadClass(className);
            } catch (ClassNotFoundException e) {
                // try next step
                // TODO if I uncomment below lines (the correct approach) I received ClassNotFoundException for demo (ro.fortsoft.pf4j.demo)
                //                log.error(e.getMessage(), e);
                //                throw e;
            }
        }
        // second check whether it's already been loaded
        Class<?> clazz = findLoadedClass(className);
        if (clazz != null) {
            log.debug("Found loaded class '{}'", className);
            return clazz;
        }
        // nope, try to load locally
        try {
            clazz = findClass(className);
            log.debug("Found class '{}' in plugin classpath", className);
            return clazz;
        } catch (ClassNotFoundException e) {
            // try next step
        }
        // look in dependencies
        log.debug("Look in dependencies for class '{}'", className);
        List<PluginDependency> dependencies = pluginDescriptor.getDependencies();
        for (PluginDependency dependency : dependencies) {
            PluginClassLoader classLoader = pluginManager.getPluginClassLoader(dependency.getPluginId());
            try {
                return classLoader.loadClass(className);
            } catch (ClassNotFoundException e) {
                // try next dependency
            }
        }
        log.debug("Couldn't find class '{}' in plugin classpath. Delegating to parent");
        // use the standard URLClassLoader (which follows normal parent delegation)
        return super.loadClass(className);
    }
}

[Buggy Hunk]
log.debug("Couldn't find class '{}' in plugin classpath. Delegating to parent");

[Patch]
log.debug("Couldn't find class '{}' in plugin classpath. Delegating to parent", className);

[Demonstration 3]

[Buggy Method]
public byte[] findObjectsByPrefix(SwiftObjectPath path, final Header... requestHeaders) throws IOException {
    preRemoteCommand("findObjectsByPrefix");
    URI uri;
    String dataLocationURI = getEndpointURI().toString();
    try {
        String object = path.getObject();
        if (object.startsWith("/")) {
            object = object.substring(1);
        }
        object = encodeUrl(object);
        dataLocationURI = dataLocationURI.concat("/").concat(path.getContainer()).concat("/?prefix=").concat(object);
        uri = new URI(dataLocationURI);
    } catch (URISyntaxException e) {
        throw new SwiftException("Bad URI: " + dataLocationURI, e);
    }
    return perform("findObjectsByPrefix", uri, new GetMethodProcessor<byte[]>() {

        @Override
        public byte[] extractResult(GetMethod method) throws IOException {
            if (method.getStatusCode() == SC_NOT_FOUND) {
                //no result
                throw new FileNotFoundException("Not found " + method.getURI());
            }
            return method.getResponseBody();
        }

        @Override
        protected int[] getAllowedStatusCodes() {
            return new int[] { SC_OK, SC_NOT_FOUND };
        }

        @Override
        protected void setup(GetMethod method) throws SwiftInternalStateException {
            setHeaders(method, requestHeaders);
        }
    });
}

[Buggy Hunk]
object = encodeUrl(object);

[Patch]
object = SwiftUtils.encodeUrl(object);