[Demonstration 1]

[Buggy Method]
@SuppressWarnings("deprecation")
@Override
protected void onResume() {
    super.onResume();
    // window flags:
    Log.d(TAG, "Updating window params");
    getWindow().addFlags(WindowManager.LayoutParams.FLAG_TURN_SCREEN_ON | WindowManager.LayoutParams.FLAG_SHOW_WHEN_LOCKED | WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
    // Acquire wakelock
    PowerManager pm = (PowerManager) getApplicationContext().getSystemService(Context.POWER_SERVICE);
    if (mWakeLock == null) {
        mWakeLock = pm.newWakeLock((PowerManager.FULL_WAKE_LOCK | PowerManager.ACQUIRE_CAUSES_WAKEUP | PowerManager.ON_AFTER_RELEASE), TAG);
    }
    if (!mWakeLock.isHeld()) {
        mWakeLock.acquire();
        Log.i(TAG, "Wakelock aquired!!");
    }
}

[Buggy Hunk]
PowerManager pm = (PowerManager) getApplicationContext().getSystemService(Context.POWER_SERVICE);

[Patch]
PowerManager pm = (PowerManager) this.getSystemService(Context.POWER_SERVICE);

[Demonstration 2]

[Buggy Method]
public static void getParseData(final String className) {
    Log.d(TAG, "getParseData");
    ParseUser currentUser = ParseUser.getCurrentUser();
    if (currentUser == null) {
        return;
    }
    ParseQuery<ParseObject> query = ParseQuery.getQuery(className);
    query.whereEqualTo(Constants.GROUP_MEMBERS, currentUser.getEmail());
    query.findInBackground(new FindCallback<ParseObject>() {

        @Override
        public void done(final List<ParseObject> parseObjects, ParseException e) {
            if (e != null) {
                Log.e(TAG, "Query error: " + e.getMessage());
            } else {
                // Release any objects previously pinned for this query.
                Log.i(TAG, className + ": Found " + parseObjects.size());
                ParseObject.unpinAllInBackground(className, parseObjects, new DeleteCallback() {

                    public void done(ParseException e) {
                        if (e != null) {
                            // There was some error.
                            Log.e(TAG, "Unpin error: " + e.getMessage());
                            return;
                        }
                        // Add the latest results for this query to the cache.
                        Log.i(TAG, className + ": Pinned " + parseObjects.size());
                        ParseObject.pinAllInBackground(className, parseObjects);
                    }
                });
            }
        }
    });
}

[Buggy Hunk]
Log.d(TAG, "getParseData");

[Patch]
Log.d(TAG, className + ": getParseData");

[Demonstration 3]

[Buggy Method]
private int parsePcapFilesAndPutItToTable() throws IOException {
    Packet packet = new Packet();
    while (offset < validBytes) {
        if (validBytes - offset < 9000) {
            System.arraycopy(buffer, offset, buffer, 0, validBytes - offset);
            validBytes = validBytes - offset;
            offset = 0;
            int n = in.read(buffer, validBytes, buffer.length - validBytes);
            if (n > 0) {
                validBytes += n;
            }
        }
        offset = packet.decodePcap(buffer, offset);
        if (addDataToTable(packet, decoder.getNetwork())) {
            return 1;
        }
    }
    return 0;
}

[Buggy Hunk]
offset = packet.decodePcap(buffer, offset);

[Patch]
offset = decoder.decodePacket(buffer, offset, packet);