[Demonstration 1]

[Buggy Method]
public void _testMapReduceWithUberJar() throws Exception {
    FileSystem fs = getFileSystem();
    Path inputDir = new Path(getFsTestCaseDir(), "input");
    Path outputDir = new Path(getFsTestCaseDir(), "output");
    Writer w = new OutputStreamWriter(fs.create(new Path(inputDir, "data.txt")));
    w.write("dummy\n");
    w.write("dummy\n");
    w.close();
    String actionXml = "<map-reduce>" + "<job-tracker>" + getJobTrackerUri() + "</job-tracker>" + "<name-node>" + getNameNodeUri() + "</name-node>" + getMapReduceUberJarConfig(inputDir.toString(), outputDir.toString()).toXmlString(false) + "</map-reduce>";
    String jobID = _testSubmit("map-reduce", actionXml);
    boolean containsLib1Jar = false;
    String lib1JarStr = "jobcache/" + jobID + "/jars/lib/lib1.jar";
    Pattern lib1JarPatYarn = Pattern.compile(".*appcache/application_" + jobID.replaceFirst("job_", "") + "/filecache/.*/uber.jar/lib/lib1.jar.*");
    boolean containsLib2Jar = false;
    String lib2JarStr = "jobcache/" + jobID + "/jars/lib/lib1.jar";
    Pattern lib2JarPatYarn = Pattern.compile(".*appcache/application_" + jobID.replaceFirst("job_", "") + "/filecache/.*/uber.jar/lib/lib2.jar.*");
    FileStatus[] fstats = getFileSystem().listStatus(outputDir);
    for (FileStatus fstat : fstats) {
        Path p = fstat.getPath();
        if (getFileSystem().isFile(p) && p.getName().startsWith("part-")) {
            InputStream is = getFileSystem().open(p);
            Scanner sc = new Scanner(is);
            while (sc.hasNextLine()) {
                String line = sc.nextLine();
                containsLib1Jar = (containsLib1Jar || line.contains(lib1JarStr) || lib1JarPatYarn.matcher(line).matches());
                containsLib2Jar = (containsLib2Jar || line.contains(lib2JarStr) || lib2JarPatYarn.matcher(line).matches());
            }
            sc.close();
            is.close();
        }
    }
    assertTrue("lib/lib1.jar should have been unzipped from the uber jar and added to the classpath but was not", containsLib1Jar);
    assertTrue("lib/lib2.jar should have been unzipped from the uber jar and added to the classpath but was not", containsLib2Jar);
}

[Buggy Hunk]
String jobID = _testSubmit("map-reduce", actionXml);

[Patch]
String jobID = _testSubmit(MAP_REDUCE, actionXml);

[Demonstration 2]

[Buggy Method]
@Override
public void start() throws IOException {
    raf = new RandomAccessFile(getLogFilename(), "r");
    fileChannel = raf.getChannel();
    if (allowTracking) {
        // init state
        RecordOffset curr = getRecordOffset();
        if (curr.rOffset == 0) {
            offset = 0;
            return;
        }
        // log rotate must be done
        if (fileChannel.size() < curr.rOffset)
            offset = 0;
        else {
            // check if log rotate has been done
            fileChannel.position(curr.rOffset - curr.rValue.getBytes().length - 1);
            String rafline = raf.readLine();
            if (rafline.equals(curr.rValue))
                offset = curr.rOffset;
        }
        fileChannel.position(offset);
    }
}

[Buggy Hunk]
fileChannel.position(curr.rOffset - curr.rValue.getBytes().length - 1);

[Patch]
fileChannel.position(curr.rOffset - curr.rValue.getBytes().length - 2);

[Demonstration 3]

[Buggy Method]
protected boolean classify(final TextBlock prev, final TextBlock curr, final TextBlock next) {
    final boolean isContent;
    if (curr.getLinkDensity() <= 0.333333 || (curr.getTextDensity() >= 3.0 && curr.getText().length() / curr.getText().split("\\s+").length > 5)) {
        if ((prev.getLinkDensity() <= 0.555556 || prev.getTextDensity() >= 3.0) && curr.getNumWords() > 1) {
            if (curr.getNumWords() <= 6) {
                if (next.getNumWords() <= 4) {
                    if (prev.getNumWords() <= 1) {
                        isContent = false;
                    } else {
                        isContent = true;
                    }
                } else {
                    isContent = true;
                }
            } else {
                isContent = true;
            }
        } else {
            if (curr.getNumWords() <= 6) {
                if (next.getNumWords() <= 5) {
                    isContent = false;
                } else {
                    isContent = true;
                }
            } else {
                isContent = true;
            }
        }
    } else {
        isContent = false;
    }
    return curr.setIsContent(isContent);
}

[Buggy Hunk]
if (curr.getNumWords() <= 6) {

[Patch]
if (curr.getNumWords() <= 6 && curr.getText().length()/curr.getNumWords() < 15) {