[Demonstration 1]

[Buggy Method]
private void checkAuthorization(SecurityRequest request, String resourceId) throws Exception {
    log.debug("RAP received a security request : " + request.toString());
    // building dummy access policy
    Map<String, IAccessPolicy> accessPolicyMap = new HashMap<>();
    // to get policies here
    Optional<AccessPolicy> accPolicy = accessPolicyRepo.findById(resourceId);
    if (accPolicy == null)
        throw new Exception("No access policies for resource");
    accessPolicyMap.put(resourceId, accPolicy.get().getPolicy());
    Set<String> ids = securityHandler.getSatisfiedPoliciesIdentifiers(accessPolicyMap, request);
    if (!ids.contains(resourceId))
        ;
    throw new Exception("Security Policy is not valid");
}

[Buggy Hunk]
if(!ids.contains(resourceId));

[Patch]
if(!ids.contains(resourceId))

[Demonstration 2]

[Buggy Method]
public static final String getOwncloudShareAddress() {
    String result = PortletProps.get("owncloudshareaddress");
    if (result == null) {
        _log.error("could not load owncloudaddress from properties");
        result = "https://boxup.uni-potsdam.de/ocs/v1.php/apps/files_sharing/api/v1/shares";
    }
    return result;
}

[Buggy Hunk]
_log.error("could not load owncloudaddress from properties");

[Patch]
_log.debug("could not load owncloudaddress from properties");

[Demonstration 3]

[Buggy Method]
public static void syncSongs(final Context context, final Callbacks mainCallbacks) {
    final String bandId = bandIsSelected(context, mainCallbacks);
    if (bandId == null)
        return;
    final String spreadsheetURL = SongContent.SongItem.createSpreadsheetSongsURLFromBandId(bandId);
    try {
        // Building Parameters ( you can pass as many parameters as you want)
        List<NameValuePair> params = new ArrayList<NameValuePair>();
        // Getting JSON Object
        URL.makeHttpRequestAsync(spreadsheetURL, URL.Method.GET, params, new Callback() {

            @Override
            public void callback(final String resultText) {
                int numItems;
                if (resultText == null) {
                    mainCallbacks.errorCallback("Error: no items found");
                    return;
                }
                try {
                    JSONObject jObj = new JSONObject(resultText);
                    JSONObject feed = jObj.getJSONObject("feed");
                    JSONArray entries = feed.getJSONArray("entry");
                    numItems = _songsDBHelper.updateSongsFromJSON(entries);
                } catch (JSONException e) {
                    e.printStackTrace();
                    mainCallbacks.errorCallback(resultText);
                    return;
                }
                mainCallbacks.successCallback(numItems);
            }
        });
    } catch (Exception e) {
        e.printStackTrace();
    }
}

[Buggy Hunk]
mainCallbacks.errorCallback(resultText);

[Patch]
mainCallbacks.errorCallback("Error parsing the following as JSON: " + resultText);