[Demonstration 1]

[Buggy Method]
public static int processText(File file) {
    try {
        File inputFile = new File(file.getAbsolutePath());
        pd = PDDocument.load(inputFile);
        numOfImages = getImageNumberFromPDF(pd);
        pageNumber = pd.getNumberOfPages();
        PDFTextStripper stripper = new PDFTextStripper() {

            String prevBaseFont;

            protected void writeString(String text, List<TextPosition> textPositions) throws IOException {
                StringBuilder builder = new StringBuilder();
                StringBuilder wordBuilder = new StringBuilder();
                for (TextPosition position : textPositions) {
                    String baseFont = position.getFont().getName();
                    if (baseFont != null && !baseFont.equals(prevBaseFont)) {
                        float size = position.getFontSizeInPt();
                        builder.append('[').append(baseFont).append(',').append(size + "").append(']');
                        prevBaseFont = baseFont;
                    }
                    wordBuilder.append(position);
                    builder.append(position);
                }
                PDFContainer.words.add(wordBuilder.toString());
                writeString(builder.toString());
            }
        };
        sb = new StringBuilder();
        /**
         * Add text to the StringBuilder from the PDF
         */
        // Start extracting from page 3
        stripper.setStartPage(1);
        // Extract till page 4
        stripper.setEndPage(pageNumber);
        sb.append(stripper.getText(pd));
        text = sb.toString();
        if (pd != null) {
            pd.close();
        }
        /**
         *  If the given PFD is has more than 40 pages (if it's not an article).
         */
        if (pageNumber > 40) {
            return -1;
        }
        /**
         *  If the PDFBox doens't recognise the given PDF.
         */
        if (!processTextByRow()) {
            return -2;
        }
    } catch (Exception e) {
        e.printStackTrace();
    }
    return 1;
}

[Buggy Hunk]
public static int processText(File file){

[Patch]
public int processText(File file){

[Demonstration 2]

[Buggy Method]
@Override
public Object visitStAssg(SCalcParser.StAssgContext ctx) {
    // Check to see that the symbol is already defined
    Symbol var = curScope.resolve(ctx.getChild(0).getText());
    if (var == null)
        throw new IllegalArgumentException("Variable not defined (" + ctx.getChild(1).getText() + ")");
    int val = (int) visit(ctx.getChild(2));
    valueTable.replace(var, val);
    return null;
}

[Buggy Hunk]
ctx.getChild(1).getText() + ")");

[Patch]
ctx.getChild(0).getText() + ")");

[Demonstration 3]

[Buggy Method]
public String createKey(String p, String ns, String local) {
    StringBuilder builder = new StringBuilder();
    String jns = getJSONNamespace(ns);
    if (jns != null && jns.length() != 0) {
        builder.append(jns).append('.');
    }
    return builder.append(local).toString();
}

[Buggy Hunk]
StringBuilder builder = new StringBuilder();

[Patch]
StringBuffer builder = new StringBuffer();