[Demonstration 1]

[Buggy Method]
private void updateAudioPlayPosition() {
    Log.d(TAG, "updateAudioPlayPosition");
    if (mAudioRequest == null) {
        return;
    }
    if (mPlayer != null || mGaplessSuraData == null) {
        int sura = mAudioRequest.getCurrentSura();
        int ayah = mAudioRequest.getCurrentAyah();
        int updatedAyah = ayah;
        int maxAyahs = QuranInfo.getNumAyahs(sura);
        if (sura != mGaplessSura) {
            return;
        }
        int pos = mPlayer.getCurrentPosition();
        Integer ayahTime = mGaplessSuraData.get(ayah);
        Log.d(TAG, "updateAudioPlayPosition: " + sura + ":" + ayah + ", currently at " + pos + " vs expected at " + ayahTime);
        if (ayahTime > pos) {
            int iterAyah = ayah;
            while (--iterAyah > 0) {
                ayahTime = mGaplessSuraData.get(iterAyah);
                if (ayahTime <= pos) {
                    updatedAyah = iterAyah;
                    break;
                } else {
                    updatedAyah--;
                }
            }
        } else {
            int iterAyah = ayah;
            while (++iterAyah <= maxAyahs) {
                ayahTime = mGaplessSuraData.get(iterAyah);
                if (ayahTime > pos) {
                    updatedAyah = iterAyah - 1;
                    break;
                } else {
                    updatedAyah++;
                }
            }
        }
        Log.d(TAG, "updateAudioPlayPosition: " + sura + ":" + ayah + ", decided ayah should be: " + updatedAyah);
        if (updatedAyah != ayah) {
            ayahTime = mGaplessSuraData.get(ayah);
            if (Math.abs(pos - ayahTime) < 150) {
                // shouldn't change ayahs if the delta is just 150ms...
                mHandler.sendEmptyMessageDelayed(MSG_UPDATE_AUDIO_POS, 150);
                return;
            }
            QuranAyah nextAyah = mAudioRequest.setCurrentAyah(sura, updatedAyah);
            if (nextAyah == null) {
                processStopRequest();
                return;
            } else if (nextAyah.getSura() != sura || nextAyah.getAyah() != updatedAyah) {
                // remove any messages currently in the queue
                mHandler.removeCallbacksAndMessages(null);
                // if the ayah hasn't changed, we're repeating the ayah,
                // otherwise, we're repeating a range. this variable is
                // what determines whether or not we replay the basmallah.
                final boolean ayahRepeat = (ayah == nextAyah.getAyah() && sura == nextAyah.getSura());
                if (ayahRepeat) {
                    // jump back to the ayah we should repeat and play it
                    pos = getSeekPosition(true);
                    mPlayer.seekTo(pos);
                } else {
                    // we're repeating into a different sura
                    final boolean flag = sura != mAudioRequest.getCurrentSura();
                    playAudio(flag);
                }
                return;
            }
            // moved on to next ayah
            updateNotification(mAudioRequest.getTitle(getApplicationContext()));
        } else {
            // if we have end of sura info and we bypassed end of sura
            // line, switch the sura.
            ayahTime = mGaplessSuraData.get(999);
            if (pos >= ayahTime) {
                QuranAyah repeat = mAudioRequest.setCurrentAyah(sura + 1, 1);
                if (repeat != null && repeat.getSura() == sura) {
                    // remove any messages currently in the queue
                    mHandler.removeCallbacksAndMessages(null);
                    // jump back to the ayah we should repeat and play it
                    pos = getSeekPosition(false);
                    mPlayer.seekTo(pos);
                } else {
                    playAudio(true);
                }
                return;
            }
        }
        notifyAyahChanged();
        if (maxAyahs >= (updatedAyah + 1)) {
            Integer t = mGaplessSuraData.get(updatedAyah + 1);
            t = t - mPlayer.getCurrentPosition();
            Log.d(TAG, "updateAudioPlayPosition postingDelayed after: " + t);
            if (t < 100) {
                t = 100;
            } else if (t > 10000) {
                t = 10000;
            }
            mHandler.sendEmptyMessageDelayed(MSG_UPDATE_AUDIO_POS, t);
        }
        // if we're on the last ayah, don't do anything - let the file
        // complete on its own to avoid getCurrentPosition() bugs.
    }
}

[Buggy Hunk]
if (pos >= ayahTime){

[Patch]
if (ayahTime > 0 && pos >= ayahTime){

[Demonstration 2]

[Buggy Method]
static private void jj_add_error_token(int kind, int pos) {
    if (pos >= 100)
        return;
    if (pos == jj_endpos + 1) {
        jj_lasttokens[jj_endpos++] = kind;
    } else if (jj_endpos != 0) {
        jj_expentry = new int[jj_endpos];
        for (int i = 0; i < jj_endpos; i++) {
            jj_expentry[i] = jj_lasttokens[i];
        }
        jj_entries_loop: for (java.util.Iterator<?> it = jj_expentries.iterator(); it.hasNext(); ) {
            int[] oldentry = (int[]) (it.next());
            if (oldentry.length == jj_expentry.length) {
                for (int i = 0; i < jj_expentry.length; i++) {
                    if (oldentry[i] != jj_expentry[i]) {
                        continue jj_entries_loop;
                    }
                }
                jj_expentries.add(jj_expentry);
                break jj_entries_loop;
            }
        }
        if (pos != 0)
            jj_lasttokens[(jj_endpos = pos) - 1] = kind;
    }
}

[Buggy Hunk]
static private void jj_add_error_token(int kind, int pos) {

[Patch]
private void jj_add_error_token(int kind, int pos) {

[Demonstration 3]

[Buggy Method]
public HandlerList getHandlerList() {
    return HANDLER_LIST;
}

[Buggy Hunk]
public HandlerList getHandlerList(){

[Patch]
public static HandlerList getHandlerList(){