[Demonstration 1]

[Buggy Method]
public static void main(String[] args) throws Exception {
    String inputFile = "d:/test.xlsx";
    String outputFile = "d:/test.pdf";
    File tmpDir = new File("d:/pdftmp");
    if (!tmpDir.exists()) {
        tmpDir.mkdir();
    }
    XSSFWorkbook workbook = CommonExcelUtil.loadExcel(new File(inputFile));
    WorkbookToPdfHelper workbookToPdfHelper = new WorkbookToPdfHelper(workbook);
    InputStream is = workbookToPdfHelper.process(tmpDir);
    IOUtils.copy(is, FileUtils.openOutputStream(new File(outputFile)));
}

[Buggy Hunk]
InputStream is = workbookToPdfHelper.process(tmpDir);

[Patch]
InputStream is = workbookToPdfHelper.process(tmpDir,"C:\\windows\\fonts");

[Demonstration 2]

[Buggy Method]
public void run() {
    // maybe error
    logger.debug("auth task is running");
    MySQLSession session = ctx.attr(TMP_SESSION_KEY).getAndRemove();
    HandshakeResponse authReply = null;
    try {
        byte[] packet = new byte[transport.in.readableBytes()];
        transport.in.readBytes(packet);
        authReply = HandshakeResponse.loadFromPacket(packet);
        if (!privilege.userExists(authReply.username)) {
            error(ErrorCode.ER_ACCESS_DENIED_ERROR, "Access denied for user '" + authReply.username + "'");
            logger.error("user not exist : " + authReply.username);
            return;
        }
        if (!StringUtil.isEmpty(authReply.schema) && !privilege.schemaExists(authReply.username, authReply.schema)) {
            String s = "Access denied for user '" + authReply.username + "' to database '" + authReply.schema + "'";
            logger.error(s);
            error(ErrorCode.ER_DBACCESS_DENIED_ERROR, s);
            return;
        }
        if (!privilege.checkPassword(authReply.username, authReply.authResponse, (String) session.getAttachment(SEED_KEY))) {
            error(ErrorCode.ER_ACCESS_DENIED_ERROR, "Access denied for user '" + authReply.username + "'");
            logger.error("wrong name+passwd , name : " + authReply.username + " ;passwd: " + authReply.authResponse);
            return;
        }
        Connection connect = connectEngine(authReply);
        session.setHandshakeResponse(authReply);
        session.setEngineConnection(connect);
        session.bind(ctx.channel());
        session.setAttachment("remoteAddress", ctx.channel().remoteAddress().toString());
        session.setAttachment("localAddress", ctx.channel().localAddress().toString());
        success(ctx.channel());
    } catch (Exception e) {
        String errMsg = authReply == null ? e.getMessage() : "Access denied for user '" + authReply.username + "' to database '" + authReply.schema + "'";
        logger.error("Authorize failed. " + errMsg, e);
        error(ErrorCode.ER_DBACCESS_DENIED_ERROR, errMsg);
    } finally {
        ctx.writeAndFlush(transport.out);
        transport.in.release();
    }
}

[Buggy Hunk]
logger.debug("auth task is running");

[Patch]
logger.info("auth task is running");

[Demonstration 3]

[Buggy Method]
//NB - this tests the non-registration parts of initialise( with no context, and no query)
@Test
public void testInitialiseSetupNoContext() throws Exception {
    Intent boringlink = new Intent(Intent.ACTION_MAIN);
    when(storage.status()).thenReturn(MeasurementService.MeasurementServiceStatus.QUERYING);
    //setup for fingerprint
    service.initialise(null, boringlink, ADVERTISERID, CAMPAIGNID, storageFactory, reachabilityFactory, processorFactory, registerRequestFactory, trackerFactory);
    Assert.assertEquals(service.getAdvertiserID(), ADVERTISERID);
    Assert.assertEquals(service.getCampaignID(), CAMPAIGNID);
    verify(storageFactory).getMeasurementStorage(null);
    verify(context, times(0)).getSystemService(Context.CONNECTIVITY_SERVICE);
    //service
    verify(storage).status();
    Assert.assertNull(service.getDeepLinkIntent());
    Assert.assertEquals(service.getStatus(), MeasurementService.MeasurementServiceStatus.QUERYING);
    //verify the register calls were made asynchronously.
    verify(registerRequest, timeout(1000)).setCampaignID(CAMPAIGNID);
    verify(registerRequest, timeout(1000)).setAdvertiserID(ADVERTISERID);
    verify(registerRequest, timeout(1000)).setFingerprint(fingerprint);
    verify(registerQueue, timeout(1000)).addRegisterRequest(registerRequest);
}

[Buggy Hunk]
verify(storage).status();

[Patch]
verify(storage, times(2)).status();