Program: 5776
Project: 5776
Buggy source:
@Test public void testPlugin() throws Exception {
  try {
    startLogSaver();
    publishLogs();
    LocationFactory locationFactory=injector.getInstance(LocationFactory.class);
    String logBaseDir=cConf.get(LoggingConfiguration.LOG_BASE_DIR);
    Location ns1LogBaseDir=locationFactory.create(namespaceDir).append("String_Node_Str").append(logBaseDir);
    FlowletLoggingContext loggingContext=new FlowletLoggingContext("String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str");
    FileMetaDataManager fileMetaDataManager=injector.getInstance(FileMetaDataManager.class);
    waitTillLogSaverDone(fileMetaDataManager,loggingContext,"String_Node_Str");
    testLogRead(loggingContext,logBaseDir);
    FileLogReader fileLogReader=injector.getInstance(FileLogReader.class);
    List<LogEvent> events=Lists.newArrayList(fileLogReader.getLog(new FlowletLoggingContext("String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str",null,"String_Node_Str"),0,Long.MAX_VALUE,Filter.EMPTY_FILTER));
    Assert.assertEquals(60,events.size());
    stopLogSaver();
    verifyCheckpoint();
    verifyMetricsPlugin(60L);
    LogSaverTableUtilOverride.setLogMetaTableName("String_Node_Str");
    resetLogSaverPluginCheckpoint(10);
    String logBaseDir1=logBaseDir + "String_Node_Str";
    cConf.set(LoggingConfiguration.LOG_BASE_DIR,logBaseDir1);
    Location ns1LogBaseDir1=locationFactory.create(namespaceDir).append("String_Node_Str").append(logBaseDir1);
    startLogSaver();
    cConf.set(LoggingConfiguration.LOG_BASE_DIR,logBaseDir);
    fileMetaDataManager=injector.getInstance(FileMetaDataManager.class);
    waitTillLogSaverDone(fileMetaDataManager,loggingContext,"String_Node_Str");
    stopLogSaver();
    fileLogReader=injector.getInstance(FileLogReader.class);
    events=Lists.newArrayList(fileLogReader.getLog(new FlowletLoggingContext("String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str",null,"String_Node_Str"),0,Long.MAX_VALUE,Filter.EMPTY_FILTER));
    Assert.assertEquals(50,events.size());
    verifyCheckpoint();
    verifyMetricsPlugin(110L);
  }
 catch (  Throwable t) {
    try {
      final Multimap<String,String> contextMessages=getPublishedKafkaMessages();
      LOG.info("String_Node_Str",contextMessages);
    }
 catch (    Exception e) {
      LOG.error("String_Node_Str",e);
    }
    throw t;
  }
}

Fixed version (ground truth):
@Test public void testPlugin() throws Exception {
  try {
    startLogSaver();
    FlowletLoggingContext loggingContext=new FlowletLoggingContext("String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str");
    FileLogReader fileLogReader=injector.getInstance(FileLogReader.class);
    try (CloseableIterator<LogEvent> events=fileLogReader.getLog(loggingContext,0,Long.MAX_VALUE,Filter.EMPTY_FILTER)){
      Assert.assertFalse(events.hasNext());
    }
     publishLogs();
    LocationFactory locationFactory=injector.getInstance(LocationFactory.class);
    String logBaseDir=cConf.get(LoggingConfiguration.LOG_BASE_DIR);
    Location ns1LogBaseDir=locationFactory.create(namespaceDir).append("String_Node_Str").append(logBaseDir);
    FileMetaDataManager fileMetaDataManager=injector.getInstance(FileMetaDataManager.class);
    waitTillLogSaverDone(fileMetaDataManager,loggingContext,"String_Node_Str");
    testLogRead(loggingContext,logBaseDir);
    List<LogEvent> events=Lists.newArrayList(fileLogReader.getLog(new FlowletLoggingContext("String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str",null,"String_Node_Str"),0,Long.MAX_VALUE,Filter.EMPTY_FILTER));
    Assert.assertEquals(60,events.size());
    stopLogSaver();
    verifyCheckpoint();
    verifyMetricsPlugin(60L);
    LogSaverTableUtilOverride.setLogMetaTableName("String_Node_Str");
    resetLogSaverPluginCheckpoint(10);
    String logBaseDir1=logBaseDir + "String_Node_Str";
    cConf.set(LoggingConfiguration.LOG_BASE_DIR,logBaseDir1);
    Location ns1LogBaseDir1=locationFactory.create(namespaceDir).append("String_Node_Str").append(logBaseDir1);
    startLogSaver();
    cConf.set(LoggingConfiguration.LOG_BASE_DIR,logBaseDir);
    fileMetaDataManager=injector.getInstance(FileMetaDataManager.class);
    waitTillLogSaverDone(fileMetaDataManager,loggingContext,"String_Node_Str");
    stopLogSaver();
    fileLogReader=injector.getInstance(FileLogReader.class);
    events=Lists.newArrayList(fileLogReader.getLog(new FlowletLoggingContext("String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str",null,"String_Node_Str"),0,Long.MAX_VALUE,Filter.EMPTY_FILTER));
    Assert.assertEquals(50,events.size());
    verifyCheckpoint();
    verifyMetricsPlugin(110L);
  }
 catch (  Throwable t) {
    try {
      final Multimap<String,String> contextMessages=getPublishedKafkaMessages();
      LOG.info("String_Node_Str",contextMessages);
    }
 catch (    Throwable e) {
      LOG.error("String_Node_Str",e);
    }
    throw t;
  }
}