[Demonstration 1]

[Buggy Method]
@Override
public void onPlaybackEvent(EventType eventType, PlayerState playerState) {
    mCurrentPlayerState = playerState;
    int lastPosition = playerState.positionInMs;
    if (eventType == EventType.TRACK_CHANGED) {
        String trackId = playerState.trackUri.replaceAll("spotify:track:", "");
        mService.getTrack(trackId, this);
    }
    EventBus.getDefault().post(new SpotifyPlaybackEvent(lastPosition, eventType));
    if (eventType == EventType.END_OF_CONTEXT) {
        EventBus.getDefault().post(new VideoCompletedEvent());
    }
}

[Buggy Hunk]
EventBus.getDefault().post(new VideoCompletedEvent());

[Patch]
stop();

[Demonstration 2]

[Buggy Method]
@Override
public void notiClicked(String eventType, String raiserId, String raiserThumb, String eventDate, String elementId) {
    if (eventType.equals("2") || eventType.equals("4") || eventType.equals("9")) {
        // commentFragment = new CommentFragment(elementId);
        Bundle bundle = new Bundle();
        bundle.putString("postId", elementId);
        commentFragment = new CommentFragment();
        commentFragment.setArguments(bundle);
        setFragmentView(commentFragment, R.id.container1, -1, true);
    } else if (eventType.equals("5")) {
        userProfile = new UserProfile();
        userProfile.userProfile1(elementId);
        setFragmentView(userProfile, R.id.container, -1, true);
    }
}

[Buggy Hunk]
if(eventType.equals("2") || eventType.equals("4") || eventType.equals("9")){

[Patch]
if(eventType.equals("2") || eventType.equals("4") || eventType.equals("9") || eventType.equals("12")){

[Demonstration 3]

[Buggy Method]
public FREObject call(FREContext arg0, FREObject[] arg1) {
    if (Build.MANUFACTURER.equals("Amazon")) {
        Log.d(TAG, "push notifications disabled on amazon devices, ignoring local notification");
        return null;
    }
    String message = null;
    long timestamp = 0;
    String title = null;
    int recurrenceType = RECURRENCE_NONE;
    int notificationId = DEFAULT_NOTIFICATION_ID;
    String largeIconResourceId = null;
    try {
        message = arg1[0].getAsString();
        timestamp = (long) arg1[1].getAsInt();
        title = arg1[2].getAsString();
        if (arg1.length >= 4) {
            recurrenceType = arg1[3].getAsInt();
        }
        if (arg1.length >= 5) {
            notificationId = arg1[4].getAsInt();
        }
        if (arg1.length >= 7) {
            largeIconResourceId = arg1[6].getAsString();
        }
    } catch (IllegalStateException e) {
        e.printStackTrace();
    } catch (FRETypeMismatchException e) {
        e.printStackTrace();
    } catch (FREInvalidObjectException e) {
        e.printStackTrace();
    } catch (FREWrongThreadException e) {
        e.printStackTrace();
    } catch (Exception e) {
        e.printStackTrace();
    }
    if (message != null && timestamp > 0) {
        Context appContext = arg0.getActivity().getApplicationContext();
        // convert in ms
        timestamp *= 1000;
        Calendar cal = Calendar.getInstance();
        if (cal.getTimeInMillis() > timestamp) {
            Log.d(TAG, "timestamp is older than current time");
            return null;
        }
        Intent intent = new Intent(appContext, LocalBroadcastReceiver.class);
        if (title != null) {
            intent.putExtra("contentTitle", title);
        }
        intent.putExtra("contentText", message);
        if (largeIconResourceId != null) {
            intent.putExtra("largeIconResourceId", largeIconResourceId);
        }
        PendingIntent sender = PendingIntent.getBroadcast(appContext, notificationId, intent, PendingIntent.FLAG_UPDATE_CURRENT);
        // Get the AlarmManager service
        AlarmManager am = (AlarmManager) appContext.getSystemService(Context.ALARM_SERVICE);
        am.cancel(sender);
        if (recurrenceType == RECURRENCE_DAY) {
            am.setRepeating(AlarmManager.RTC_WAKEUP, timestamp, 24 * 3600 * 1000, sender);
        } else if (recurrenceType == RECURRENCE_WEEK) {
            am.setRepeating(AlarmManager.RTC_WAKEUP, timestamp, 7 * 24 * 3600 * 1000, sender);
        } else if (recurrenceType == RECURRENCE_MONTH) {
            am.setRepeating(AlarmManager.RTC_WAKEUP, timestamp, 30 * 7 * 24 * 3600 * 1000, sender);
        } else if (recurrenceType == RECURRENCE_YEAR) {
            am.setRepeating(AlarmManager.RTC_WAKEUP, timestamp, 365 * 7 * 24 * 3600 * 1000, sender);
        } else {
            am.set(AlarmManager.RTC_WAKEUP, timestamp, sender);
        }
        Log.d(TAG, "setting params to run at " + Long.toString(timestamp));
    } else {
        Log.d(TAG, "cannot set local notification, not enough params");
    }
    return null;
}

[Buggy Hunk]
if (arg1.length >= 7)

[Patch]
if (arg1.length >= 7 && arg1[6] != null)