[Demonstration 1]

[Buggy Method]
protected IProject[] build(int kind, @SuppressWarnings("rawtypes") Map args, IProgressMonitor monitor) throws CoreException {
    PlatformUI.getWorkbench().getDisplay().syncExec(new Runnable() {

        public void run() {
            Configuration.verifyIceHome(Configuration.getIceHome());
        }
    });
    // Ignore auto builds issued by Eclipse if Ice auto building is off
    if ((kind == AUTO_BUILD) && !Activator.getDefault().getPreferenceStore().getBoolean(PluginPreferencePage.BUILD_AUTO)) {
        return null;
    }
    long start = System.currentTimeMillis();
    IResourceDelta delta = getDelta(getProject());
    BuildState state = new BuildState(getProject(), delta, monitor);
    state.dependencies.read();
    try {
        if ((kind == FULL_BUILD) || (delta == null) || state.config.getExtraArguments().contains("--checksum")) {
            fullBuild(state, monitor);
        } else {
            incrementalBuild(state, monitor);
        }
        long end = System.currentTimeMillis();
        state.out.println("Build complete. Elapsed time: " + (end - start) / 1000 + "s.\n");
        state.dependencies.write();
    } catch (CoreException e) {
        long end = System.currentTimeMillis();
        state.dependencies.write();
        // Handle only exceptions thrown by the Slice compiler
        if (e.getStatus().getPlugin().equals(Activator.PLUGIN_ID)) {
            if (state.err != null) {
                state.err.println("Build failed. Elapsed time: " + (end - start) / 1000 + "s.");
                state.err.println("    Reason: " + e.getStatus().getMessage());
            } else {
                e.printStackTrace(System.err);
            }
        } else {
            throw e;
        }
    }
    return null;
}

[Buggy Hunk]
state.err.println("    Reason: " + e.getStatus().getMessage());

[Patch]
state.err.println("    Reason: " + e.getStatus().getMessage() + "\n");

[Demonstration 2]

[Buggy Method]
public void createRace(View view) {
    factory.initializeDB();
    if (!Utils.nameCheck(et_config.getText().toString()) || !Utils.nameCheck(et_weather.getText().toString()) || spn_cars.getSelectedItem() == null) {
        Timber.e("No config-, weather input or car selected");
        tv_error.setText("Please fill in all Informations for Testing");
        factory.closeDb();
    } else {
        String carName = spn_cars.getSelectedItem().toString();
        List<Car> connectedCar = factory.getDao(DaoTypes.CAR).queryBuilder().where(CarDao.Properties.Name.eq(carName)).list();
        List<Config> connectedConfig = factory.getDao(DaoTypes.CONFIG).queryBuilder().where(ConfigDao.Properties.CarID.eq(connectedCar.get(0).getId())).list();
        String comment = et_config.getText().toString();
        Config oldConfig = connectedConfig.get(0);
        oldConfig.setCurrent(false);
        Config newConfig = new Config(null, comment, connectedConfig.get(0).getBarcode(), connectedConfig.get(0).getDriver(), true, connectedCar.get(0).getId());
        factory.getDao(DaoTypes.CONFIG).insertOrReplace(oldConfig);
        factory.getDao(DaoTypes.CONFIG).insert(newConfig);
        Date date = new Date();
        tv_error.setText("");
        Race race = new Race(null, "Testing", description, false, date);
        long raceId = factory.getDao(DaoTypes.RACE).insert(race);
        Lap dummyLap = new Lap(null, null, null, null, -1, raceId, newConfig.getId(), connectedCar.get(0).getId());
        factory.getDao(DaoTypes.LAP).insert(dummyLap);
        Intent intent = new Intent(this, RaceTable.class);
        intent.putExtra("RaceID", race.getId());
        factory.closeDb();
        factory.getDaoSession().clear();
        startActivity(intent);
    }
}

[Buggy Hunk]
List<Config> connectedConfig = factory.getDao(DaoTypes.CONFIG).queryBuilder().where(ConfigDao.Properties.CarID.eq(connectedCar.get(0).getId())).list();

[Patch]
List<Config> connectedConfig = factory.getDao(DaoTypes.CONFIG).queryBuilder().where(ConfigDao.Properties.CarID.eq(connectedCar.get(0).getId()), ConfigDao.Properties.Current.eq(true)).list();

[Demonstration 3]

[Buggy Method]
@Override
public boolean execute(String action, JSONArray args, CallbackContext callbackContext) {
    try {
        if (action.equals("startActivity")) {
            if (args.length() != 1) {
                //return new PluginResult(PluginResult.Status.INVALID_ACTION);
                callbackContext.sendPluginResult(new PluginResult(PluginResult.Status.INVALID_ACTION));
                return false;
            }
            // Parse the arguments
            final CordovaResourceApi resourceApi = webView.getResourceApi();
            JSONObject obj = args.getJSONObject(0);
            String type = obj.has("type") ? obj.getString("type") : null;
            Uri uri = obj.has("url") ? resourceApi.remapUri(Uri.parse(obj.getString("url"))) : null;
            JSONObject extras = obj.has("extras") ? obj.getJSONObject("extras") : null;
            Map<String, String> extrasMap = new HashMap<String, String>();
            // Populate the extras if any exist
            if (extras != null) {
                JSONArray extraNames = extras.names();
                for (int i = 0; i < extraNames.length(); i++) {
                    String key = extraNames.getString(i);
                    String value = extras.getString(key);
                    extrasMap.put(key, value);
                }
            }
            startActivity(obj.getString("action"), uri, type, extrasMap);
            //return new PluginResult(PluginResult.Status.OK);
            callbackContext.sendPluginResult(new PluginResult(PluginResult.Status.OK));
            return true;
        } else if (action.equals("hasExtra")) {
            if (args.length() != 1) {
                //return new PluginResult(PluginResult.Status.INVALID_ACTION);
                callbackContext.sendPluginResult(new PluginResult(PluginResult.Status.INVALID_ACTION));
                return false;
            }
            Intent i = ((CordovaActivity) this.cordova.getActivity()).getIntent();
            String extraName = args.getString(0);
            //return new PluginResult(PluginResult.Status.OK, i.hasExtra(extraName));
            callbackContext.sendPluginResult(new PluginResult(PluginResult.Status.OK, i.hasExtra(extraName)));
            return true;
        } else if (action.equals("getExtra")) {
            if (args.length() != 1) {
                //return new PluginResult(PluginResult.Status.INVALID_ACTION);
                callbackContext.sendPluginResult(new PluginResult(PluginResult.Status.INVALID_ACTION));
                return false;
            }
            Intent i = ((CordovaActivity) this.cordova.getActivity()).getIntent();
            String extraName = args.getString(0);
            if (Intent.ACTION_SEND_MULTIPLE.equals(i.getAction()) && i.hasExtra(Intent.EXTRA_STREAM)) {
                ArrayList<String> toRet = new ArrayList<String>();
                ArrayList<Parcelable> list = i.getParcelableArrayListExtra(Intent.EXTRA_STREAM);
                for (Parcelable parcel : list) {
                    String s = ((Uri) parcel).toString();
                    toRet.add(s);
                }
                callbackContext.sendPluginResult(new PluginResult(PluginResult.Status.OK, toRet));
                return true;
            }
            if (i.hasExtra(extraName)) {
                String r = i.getStringExtra(extraName);
                if (null == r) {
                    r = ((Uri) i.getParcelableExtra(extraName)).toString();
                }
                //return new PluginResult(PluginResult.Status.OK, i.getStringExtra(extraName));
                callbackContext.sendPluginResult(new PluginResult(PluginResult.Status.OK, i.getStringExtra(r)));
                return true;
            } else {
                //return new PluginResult(PluginResult.Status.ERROR);
                callbackContext.sendPluginResult(new PluginResult(PluginResult.Status.ERROR));
                return false;
            }
        } else if (action.equals("getUri")) {
            if (args.length() != 0) {
                //return new PluginResult(PluginResult.Status.INVALID_ACTION);
                callbackContext.sendPluginResult(new PluginResult(PluginResult.Status.INVALID_ACTION));
                return false;
            }
            Intent i = ((CordovaActivity) this.cordova.getActivity()).getIntent();
            String uri = i.getDataString();
            //return new PluginResult(PluginResult.Status.OK, uri);
            callbackContext.sendPluginResult(new PluginResult(PluginResult.Status.OK, uri));
            return true;
        } else if (action.equals("onNewIntent")) {
            //save reference to the callback; will be called on "new intent" events
            this.onNewIntentCallbackContext = callbackContext;
            if (args.length() != 0) {
                callbackContext.sendPluginResult(new PluginResult(PluginResult.Status.INVALID_ACTION));
                return false;
            }
            PluginResult result = new PluginResult(PluginResult.Status.NO_RESULT);
            //re-use the callback on intent events
            result.setKeepCallback(true);
            callbackContext.sendPluginResult(result);
            return true;
            //return result;
        } else if (action.equals("sendBroadcast")) {
            if (args.length() != 1) {
                //return new PluginResult(PluginResult.Status.INVALID_ACTION);
                callbackContext.sendPluginResult(new PluginResult(PluginResult.Status.INVALID_ACTION));
                return false;
            }
            // Parse the arguments
            JSONObject obj = args.getJSONObject(0);
            JSONObject extras = obj.has("extras") ? obj.getJSONObject("extras") : null;
            Map<String, String> extrasMap = new HashMap<String, String>();
            // Populate the extras if any exist
            if (extras != null) {
                JSONArray extraNames = extras.names();
                for (int i = 0; i < extraNames.length(); i++) {
                    String key = extraNames.getString(i);
                    String value = extras.getString(key);
                    extrasMap.put(key, value);
                }
            }
            sendBroadcast(obj.getString("action"), extrasMap);
            //return new PluginResult(PluginResult.Status.OK);
            callbackContext.sendPluginResult(new PluginResult(PluginResult.Status.OK));
            return true;
        }
        //return new PluginResult(PluginResult.Status.INVALID_ACTION);
        callbackContext.sendPluginResult(new PluginResult(PluginResult.Status.INVALID_ACTION));
        return false;
    } catch (JSONException e) {
        e.printStackTrace();
        String errorMessage = e.getMessage();
        //return new PluginResult(PluginResult.Status.JSON_EXCEPTION);
        callbackContext.sendPluginResult(new PluginResult(PluginResult.Status.JSON_EXCEPTION, errorMessage));
        return false;
    }
}

[Buggy Hunk]
callbackContext.sendPluginResult(new PluginResult(PluginResult.Status.OK, toRet));

[Patch]
callbackContext.sendPluginResult(new PluginResult(PluginResult.Status.OK, new JSONArray(toRet)));