[Demonstration 1]

[Buggy Method]
@BeforeClass
public static void setUp() throws Exception {
    int bufSize = 100000;
    final ByteBuffer buf = ByteBuffer.allocate(bufSize);
    for (int i = 0; i < bufSize; i++) {
        buf.put((byte) i);
    }
    buf.flip();
    bufferChunk = new NioManagedBuffer(buf);
    testFile = File.createTempFile("shuffle-test-file", "txt");
    testFile.deleteOnExit();
    RandomAccessFile fp = new RandomAccessFile(testFile, "rw");
    byte[] fileContent = new byte[1024];
    new Random().nextBytes(fileContent);
    fp.write(fileContent);
    fp.close();
    final TransportConf conf = new TransportConf(new SystemPropertyConfigProvider());
    fileChunk = new FileSegmentManagedBuffer(conf, testFile, 10, testFile.length() - 25);
    BlockFetcher blockFetcher = new BlockFetcher() {

        @Override
        public void getBlockData(String blockId, TransportRequestHandler handler) {
            /*if (blockId.equals(BUFFER_BLOCK_ID)) {
          return new NioManagedBuffer(buf);
        } else if (blockId.equals(FILE_BLOCK_ID)) {
          return new FileSegmentManagedBuffer(conf, testFile, 10, testFile.length() - 25);
        } else {
          throw new IllegalArgumentException("Invalid chunk index: " + blockId);
        }*/
        }
    };
    TransportContext context = new TransportContext(conf, blockFetcher);
    server = context.createServer();
    clientFactory = context.createClientFactory();
}

[Buggy Hunk]
public void getBlockData(String blockId, TransportRequestHandler handler) {

[Patch]
public void getBlockData(String blockId, Channel channel) {

[Demonstration 2]

[Buggy Method]
private void fileReadTest(String fileName, int size) throws IOException {
    File testFile = new File(mLocalTachyonCluster.getTachyonHome() + "/" + fileName);
    FileInputStream fis = new FileInputStream(testFile);
    byte[] read = new byte[size];
    fis.read(read);
    fis.close();
    Assert.assertTrue(BufferUtils.equalIncreasingByteArray(size, read));
}

[Buggy Hunk]
File testFile = new File(mLocalTachyonCluster.getTachyonHome() + "/" + fileName);

[Patch]
File testFile = new File(PathUtils.concatPath(mLocalTachyonCluster.getTachyonHome(), fileName));

[Demonstration 3]

[Buggy Method]
public static void main(String[] args) throws Exception {
    BufferedWriter writer = new BufferedWriter(new FileWriter(new File("/projects/afodor_research/kylie_2015/counts.txt")));
    writer.write("sample\tcount\n");
    for (String s : CreateRDPQSub.FASTQ_DIR.list()) {
        System.out.println(s);
        File fastQFile = new File(CreateRDPQSub.FASTA_DIR.getAbsolutePath() + File.separator + s);
        BufferedReader reader = new BufferedReader(new InputStreamReader(new GZIPInputStream(new FileInputStream(fastQFile))));
        long count = 0;
        for (FastQ fastq = FastQ.readOneOrNull(reader); fastq != null; fastq = FastQ.readOneOrNull(reader)) {
            count++;
        }
        writer.write(s + "\t" + count + "\n");
    }
    writer.flush();
    writer.close();
}

[Buggy Hunk]
File fastQFile = new File( CreateRDPQSub.FASTA_DIR.getAbsolutePath() + File.separator

[Patch]
File fastQFile = new File( CreateRDPQSub.FASTQ_DIR.getAbsolutePath() + File.separator