[Demonstration 1]

[Buggy Method]
@Override
public void generateChildView(View inflatedLayout) {
    fullQuestion = (McqSingleAnswer) question;
    radioGroup = new RadioGroupPlus(getContext());
    radioGroup.setLayoutParams(new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT));
    int optionIndex = 0;
    for (String option : fullQuestion.shuffledOptions) {
        LinearLayout layoutForQuestion = new LinearLayout(getContext());
        layoutForQuestion.setOrientation(LinearLayout.HORIZONTAL);
        layoutForQuestion.setLayoutParams(new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT));
        final RadioButton button = new RadioButton(getContext());
        button.setLayoutParams(new LinearLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT));
        button.setId(View.generateViewId());
        button.setTag(fullQuestion.options.indexOf(option));
        // Bold and green correct answers
        if (fullQuestion.answers != null) {
            for (Integer answer : fullQuestion.answers) {
                if (option.equals(fullQuestion.options.get(answer))) {
                    option = "<span style=\"color:green\"> <b>" + option + "</b></span>";
                }
            }
        }
        /* If the same option repeats then the webview gets reused. Since the key
            * in the webview cache is the same for the different options. So an
            * extra data attribute option-id is added*/
        final WebView optionWebView = AppData.getWebViewCache().get("<span hidden data-option-id=\"" + optionIndex + "\">" + question.id + "</span>" + option);
        optionWebView.setLayoutParams(new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT));
        optionWebView.setPadding(0, 0, 15, 0);
        optionWebView.setId(View.generateViewId());
        optionWebView.setTag(button);
        optionWebView.setOnTouchListener(new View.OnTouchListener() {

            @Override
            public boolean onTouch(View view, MotionEvent motionEvent) {
                if (view.getId() == optionWebView.getId() && motionEvent.getAction() == MotionEvent.ACTION_UP) {
                    ((RadioButton) view.getTag()).performClick();
                }
                return false;
            }
        });
        /* If this webview was used somewhere else previously (from the LruCache)
            * and then clear the reference from the parent view*/
        if (optionWebView.getParent() != null) {
            ((ViewGroup) optionWebView.getParent()).removeView(optionWebView);
        }
        //For PreviousQuiz. Disable button and webView if submitted_response available
        if (fullQuestion.submittedResponse != null) {
            button.setEnabled(false);
            optionWebView.setEnabled(false);
        }
        buttons.add(button);
        layoutForQuestion.addView(button);
        layoutForQuestion.addView(optionWebView);
        radioGroup.addView(layoutForQuestion);
        optionIndex++;
    }
    radioGroup.setOnCheckedChangeListener(this);
    LinearLayout layout = (LinearLayout) inflatedLayout.findViewById(R.id.frag_question);
    layout.addView(radioGroup);
    // If response is already available, select it.
    if (!"".equals(question.getResponse())) {
        Integer selectedOption = Integer.parseInt(question.getResponse());
        buttons.get(fullQuestion.shuffledOptions.indexOf(fullQuestion.options.get(selectedOption))).performClick();
    }
    //For PreviousQuiz. Click submitted response if available.
    if (fullQuestion.submittedResponse != null) {
        buttons.get(fullQuestion.shuffledOptions.indexOf(fullQuestion.options.get(fullQuestion.submittedResponse.get(0)))).performClick();
    }
}

[Buggy Hunk]
.indexOf(fullQuestion.options.get(fullQuestion.submittedResponse.get(0)))).performClick();

[Patch]
.indexOf(fullQuestion.options.get(fullQuestion.submittedResponse))).performClick();

[Demonstration 2]

[Buggy Method]
private void ce(int row, int col, int errno, VariableSymbol vs1, VariableSymbol vs2) {
    System.err.print("GEM Error on line " + row + " at position " + col + ": ");
    StringBuilder arrayBrackets1 = new StringBuilder();
    for (int i = 0; i < vs1.arrayDimension; i++) {
        arrayBrackets1.append("[]");
    }
    StringBuilder arrayBrackets2 = new StringBuilder();
    for (int i = 0; i < vs1.arrayDimension; i++) {
        arrayBrackets2.append("[]");
    }
    System.err.printf(errorMessage.get(errno), vs1.type + arrayBrackets1.toString(), vs2.type + arrayBrackets2.toString());
}

[Buggy Hunk]
for (int i = 0; i < vs1.arrayDimension; i++) {

[Patch]
for (int i = 0; i < vs2.arrayDimension; i++) {

[Demonstration 3]

[Buggy Method]
public Iterator<Tuple2<Integer, Tuple2<BigDecimal, Blockie>>> call(Integer v1, Iterator<Tuple2<BigDecimal, Blockie>> v2) throws Exception {
    List<Tuple2<Integer, Tuple2<BigDecimal, Blockie>>> list = Lists.newArrayList();
    while (v2.hasNext()) {
        Tuple2<BigDecimal, Blockie> next = v2.next();
        list.add(new Tuple2<Integer, Tuple2<BigDecimal, Blockie>>(v1, next));
    }
    if (v1 > 0) {
        // This step is the one which takes the first element from this
        // partition and puts it in the previous partition.
        // Hence maintaining the data continuity even with partitions.
        Tuple2<BigDecimal, Blockie> firstRecord = list.get(0)._2();
        list.add(new Tuple2<Integer, Tuple2<BigDecimal, Blockie>>(v1 - 1, firstRecord));
        System.out.println("Adding " + firstRecord._2().getIds() + " to " + (v1 - 1));
        while (list.remove(new Tuple2<Integer, Tuple2<BigDecimal, Blockie>>(v1, firstRecord))) ;
        System.out.println("Removing " + firstRecord._2().getIds() + " from " + (v1));
    }
    return list.iterator();
}

[Buggy Hunk]
if(v1 > 0) {

[Patch]
if(! list.isEmpty() && v1 > 0) {