nus-yam/ex-repair huggingface dataset:
Program: 7666
Project: 7666
Buggy source:
private void startCleanupThread(){
  if (cleanupInterval <= 0 && defaultTimeout <= 0) {
    return;
  }
  LOG.info("String_Node_Str" + cleanupInterval + "String_Node_Str"+ defaultTimeout+ "String_Node_Str");
  this.cleanupThread=new DaemonThreadExecutor("String_Node_Str"){
    @Override public void doRun(){
      cleanupTimedOutTransactions();
    }
    @Override public long getSleepMillis(){
      return cleanupInterval * 1000;
    }
  }
;
  cleanupThread.start();
}

Fixed version (ground truth):
private void startCleanupThread(){
  if (cleanupInterval <= 0 || defaultTimeout <= 0) {
    return;
  }
  LOG.info("String_Node_Str" + cleanupInterval + "String_Node_Str"+ defaultTimeout+ "String_Node_Str");
  this.cleanupThread=new DaemonThreadExecutor("String_Node_Str"){
    @Override public void doRun(){
      cleanupTimedOutTransactions();
    }
    @Override public long getSleepMillis(){
      return cleanupInterval * 1000;
    }
  }
;
  cleanupThread.start();
}
Program: 7667
Project: 7667
Buggy source:
/** 
 * @return the second component of the URI (the flow for a queue, the stream name for a stream).
 */
public String getSecondComponent(){
  return getNthComponent(1);
}

Fixed version (ground truth):
/** 
 * @return the second component of the URI (the flow for a queue, the stream name for a stream).
 */
public String getSecondComponent(){
  return getNthComponent(2);
}
Program: 7668
Project: 7668
Buggy source:
/** 
 * @return the third component of the URI (the flowlet for a queue, null for a stream).
 */
public String getThirdComponent(){
  return getNthComponent(2);
}

Fixed version (ground truth):
/** 
 * @return the third component of the URI (the flowlet for a queue, null for a stream).
 */
public String getThirdComponent(){
  return getNthComponent(3);
}
Program: 7670
Project: 7670
Buggy source:
private <T>Verifier<T> getVerifier(Class<? extends T> clz){
  if (verifiers.containsKey(clz)) {
    return (Verifier<T>)verifiers.get(clz);
  }
  if (clz.equals(ApplicationSpecification.class)) {
    verifiers.put(clz,new ApplicationVerification());
  }
 else   if (clz.equals(StreamSpecification.class)) {
    verifiers.put(clz,new StreamVerification());
  }
 else   if (clz.equals(DataSetSpecification.class)) {
    verifiers.put(clz,new DataSetVerification());
  }
 else   if (clz.equals(FlowSpecification.class)) {
    verifiers.put(clz,new FlowVerification());
  }
 else   if (ProgramSpecification.class.isAssignableFrom(clz)) {
    verifiers.put(clz,createProgramVerifier((Class<ProgramSpecification>)clz));
  }
  return (Verifier<T>)verifiers.get(clz);
}

Fixed version (ground truth):
private <T>Verifier<T> getVerifier(Class<? extends T> clz){
  if (verifiers.containsKey(clz)) {
    return (Verifier<T>)verifiers.get(clz);
  }
  if (ApplicationSpecification.class.isAssignableFrom(clz)) {
    verifiers.put(clz,new ApplicationVerification());
  }
 else   if (StreamSpecification.class.isAssignableFrom(clz)) {
    verifiers.put(clz,new StreamVerification());
  }
 else   if (DataSetSpecification.class.isAssignableFrom(clz)) {
    verifiers.put(clz,new DataSetVerification());
  }
 else   if (FlowSpecification.class.isAssignableFrom(clz)) {
    verifiers.put(clz,new FlowVerification());
  }
 else   if (ProgramSpecification.class.isAssignableFrom(clz)) {
    verifiers.put(clz,createProgramVerifier((Class<ProgramSpecification>)clz));
  }
  return (Verifier<T>)verifiers.get(clz);
}
Program: 7671
Project: 7671
Buggy source:
@Test public void testInjection() throws IOException {
  Injector injector=Guice.createInjector(new DataFabricModules().getSingleNodeModules());
  QueueClientFactory factory=injector.getInstance(QueueClientFactory.class);
  Queue2Producer producer=factory.createProducer(QueueName.fromStream("String_Node_Str","String_Node_Str"));
  Assert.assertTrue(producer instanceof LevelDBQueue2Producer);
  producer=factory.createProducer(QueueName.fromFlowlet("String_Node_Str","String_Node_Str","String_Node_Str"));
  Assert.assertTrue(producer instanceof InMemoryQueue2Producer);
}

Fixed version (ground truth):
@Test public void testInjection() throws IOException {
  Injector injector=Guice.createInjector(new DataFabricModules().getSingleNodeModules(conf));
  QueueClientFactory factory=injector.getInstance(QueueClientFactory.class);
  Queue2Producer producer=factory.createProducer(QueueName.fromStream("String_Node_Str","String_Node_Str"));
  Assert.assertTrue(producer instanceof LevelDBQueue2Producer);
  producer=factory.createProducer(QueueName.fromFlowlet("String_Node_Str","String_Node_Str","String_Node_Str"));
  Assert.assertTrue(producer instanceof InMemoryQueue2Producer);
}
Program: 7672
Project: 7672
Buggy source:
@BeforeClass public static void init() throws Exception {
  CConfiguration conf=CConfiguration.create();
  conf.unset(Constants.CFG_DATA_LEVELDB_DIR);
  conf.setBoolean(Constants.Transaction.Manager.CFG_DO_PERSIST,false);
  Injector injector=Guice.createInjector(new DataFabricLocalModule(conf));
  transactionManager=injector.getInstance(InMemoryTransactionManager.class);
  transactionManager.startAndWait();
  txSystemClient=injector.getInstance(TransactionSystemClient.class);
  queueClientFactory=injector.getInstance(QueueClientFactory.class);
  queueAdmin=injector.getInstance(QueueAdmin.class);
  streamAdmin=injector.getInstance(StreamAdmin.class);
  executorFactory=injector.getInstance(TransactionExecutorFactory.class);
}

Fixed version (ground truth):
@BeforeClass public static void init() throws Exception {
  conf=CConfiguration.create();
  conf.unset(Constants.CFG_DATA_LEVELDB_DIR);
  conf.setBoolean(Constants.Transaction.Manager.CFG_DO_PERSIST,false);
  Injector injector=Guice.createInjector(new DataFabricLocalModule(conf));
  transactionManager=injector.getInstance(InMemoryTransactionManager.class);
  transactionManager.startAndWait();
  txSystemClient=injector.getInstance(TransactionSystemClient.class);
  queueClientFactory=injector.getInstance(QueueClientFactory.class);
  queueAdmin=injector.getInstance(QueueAdmin.class);
  streamAdmin=injector.getInstance(StreamAdmin.class);
  executorFactory=injector.getInstance(TransactionExecutorFactory.class);
}
Program: 7673
Project: 7673
Buggy source:
@Override public void stop(){
  LOG.info("String_Node_Str" + name);
  Futures.getUnchecked(Services.chainStart(logSaver,multiElection,kafkaClientService,zkClientService));
  runLatch.countDown();
}

Fixed version (ground truth):
@Override public void stop(){
  LOG.info("String_Node_Str" + name);
  Futures.getUnchecked(Services.chainStop(multiElection,logSaver,kafkaClientService,zkClientService));
  runLatch.countDown();
}
Program: 7674
Project: 7674
Buggy source:
@Override public void run(){
  LOG.info("String_Node_Str" + name);
  Futures.getUnchecked(Services.chainStart(zkClientService,kafkaClientService,logSaver));
  multiElection.startAndWait();
  LOG.info("String_Node_Str" + name);
  try {
    runLatch.await();
    LOG.info("String_Node_Str" + name);
  }
 catch (  InterruptedException e) {
    LOG.error("String_Node_Str");
    Thread.currentThread().interrupt();
  }
}

Fixed version (ground truth):
@Override public void run(){
  LOG.info("String_Node_Str" + name);
  Futures.getUnchecked(Services.chainStart(zkClientService,kafkaClientService,logSaver,multiElection));
  LOG.info("String_Node_Str" + name);
  try {
    runLatch.await();
    LOG.info("String_Node_Str" + name);
  }
 catch (  InterruptedException e) {
    LOG.error("String_Node_Str");
    Thread.currentThread().interrupt();
  }
}
Program: 7675
Project: 7675
Buggy source:
/** 
 * Deletes dir if it is empty, and recursively deletes parent dirs if they are empty too. The recursion stops at non-empty parent or base directory. If dir is not child of base directory then the recursion stops at root.
 * @param dir dir to be deleted.
 */
void deleteEmptyDir(Location dir){
  dir=LocationUtils.normalize(locationFactory,dir);
  LOG.debug("String_Node_Str",dir.toURI());
  if (logBaseDir.toURI().equals(dir.toURI()) || !dir.toURI().getRawPath().startsWith(logBaseDir.toURI().getRawPath())) {
    LOG.debug("String_Node_Str",dir.toURI());
    return;
  }
  try {
    if (dir.delete()) {
      LOG.info("String_Node_Str",dir.toURI());
      Location parent=LocationUtils.getParent(locationFactory,dir);
      LOG.debug("String_Node_Str",parent);
      deleteEmptyDir(parent);
    }
 else {
      LOG.debug("String_Node_Str",dir.toURI());
    }
  }
 catch (  IOException e) {
    LOG.error("String_Node_Str",dir.toURI(),e);
  }
}

Fixed version (ground truth):
/** 
 * Deletes dir if it is empty, and recursively deletes parent dirs if they are empty too. The recursion stops at non-empty parent or base directory. If dir is not child of base directory then the recursion stops at root.
 * @param dir dir to be deleted.
 */
void deleteEmptyDir(Location dir){
  dir=LocationUtils.normalize(locationFactory,dir);
  LOG.debug("String_Node_Str",dir.toURI());
  if (logBaseDir.toURI().equals(dir.toURI()) || !dir.toURI().getRawPath().startsWith(logBaseDir.toURI().getRawPath())) {
    LOG.debug("String_Node_Str",dir.toURI());
    return;
  }
  try {
    if (dir.delete()) {
      LOG.info("String_Node_Str",dir.toURI());
      Location parent=LocationUtils.getParent(locationFactory,dir);
      LOG.debug("String_Node_Str",parent);
      deleteEmptyDir(parent);
    }
 else {
      LOG.debug("String_Node_Str",dir.toURI());
    }
  }
 catch (  RemoteException e) {
    LOG.debug("String_Node_Str",dir.toURI(),e);
  }
catch (  IOException e) {
    LOG.error("String_Node_Str",dir.toURI(),e);
  }
}
Program: 7676
Project: 7676
Buggy source:
@Override public void stop(){
  LOG.info("String_Node_Str" + name);
  Futures.getUnchecked(Services.chainStart(logSaver,multiElection,kafkaClientService,zkClientService));
  runLatch.countDown();
}

Fixed version (ground truth):
@Override public void stop(){
  LOG.info("String_Node_Str" + name);
  Futures.getUnchecked(Services.chainStop(multiElection,logSaver,kafkaClientService,zkClientService));
  runLatch.countDown();
}
Program: 7677
Project: 7677
Buggy source:
@Override public void run(){
  LOG.info("String_Node_Str" + name);
  Futures.getUnchecked(Services.chainStart(zkClientService,kafkaClientService,logSaver));
  multiElection.startAndWait();
  LOG.info("String_Node_Str" + name);
  try {
    runLatch.await();
    LOG.info("String_Node_Str" + name);
  }
 catch (  InterruptedException e) {
    LOG.error("String_Node_Str");
    Thread.currentThread().interrupt();
  }
}

Fixed version (ground truth):
@Override public void run(){
  LOG.info("String_Node_Str" + name);
  Futures.getUnchecked(Services.chainStart(zkClientService,kafkaClientService,logSaver,multiElection));
  LOG.info("String_Node_Str" + name);
  try {
    runLatch.await();
    LOG.info("String_Node_Str" + name);
  }
 catch (  InterruptedException e) {
    LOG.error("String_Node_Str");
    Thread.currentThread().interrupt();
  }
}
Program: 7678
Project: 7678
Buggy source:
/** 
 * Deletes dir if it is empty, and recursively deletes parent dirs if they are empty too. The recursion stops at non-empty parent or base directory. If dir is not child of base directory then the recursion stops at root.
 * @param dir dir to be deleted.
 */
void deleteEmptyDir(Location dir){
  dir=LocationUtils.normalize(locationFactory,dir);
  LOG.debug("String_Node_Str",dir.toURI());
  if (logBaseDir.toURI().equals(dir.toURI()) || !dir.toURI().getRawPath().startsWith(logBaseDir.toURI().getRawPath())) {
    LOG.debug("String_Node_Str",dir.toURI());
    return;
  }
  try {
    if (dir.delete()) {
      LOG.info("String_Node_Str",dir.toURI());
      Location parent=LocationUtils.getParent(locationFactory,dir);
      LOG.debug("String_Node_Str",parent);
      deleteEmptyDir(parent);
    }
 else {
      LOG.debug("String_Node_Str",dir.toURI());
    }
  }
 catch (  IOException e) {
    LOG.error("String_Node_Str",dir.toURI(),e);
  }
}

Fixed version (ground truth):
/** 
 * Deletes dir if it is empty, and recursively deletes parent dirs if they are empty too. The recursion stops at non-empty parent or base directory. If dir is not child of base directory then the recursion stops at root.
 * @param dir dir to be deleted.
 */
void deleteEmptyDir(Location dir){
  dir=LocationUtils.normalize(locationFactory,dir);
  LOG.debug("String_Node_Str",dir.toURI());
  if (logBaseDir.toURI().equals(dir.toURI()) || !dir.toURI().getRawPath().startsWith(logBaseDir.toURI().getRawPath())) {
    LOG.debug("String_Node_Str",dir.toURI());
    return;
  }
  try {
    if (dir.delete()) {
      LOG.info("String_Node_Str",dir.toURI());
      Location parent=LocationUtils.getParent(locationFactory,dir);
      LOG.debug("String_Node_Str",parent);
      deleteEmptyDir(parent);
    }
 else {
      LOG.debug("String_Node_Str",dir.toURI());
    }
  }
 catch (  RemoteException e) {
    LOG.debug("String_Node_Str",dir.toURI(),e);
  }
catch (  IOException e) {
    LOG.error("String_Node_Str",dir.toURI(),e);
  }
}
Program: 7680
Project: 7680
Buggy source:
@Override public void run(){
  boolean success=false;
  try {
    LoggingContextAccessor.setLoggingContext(context.getLoggingContext());
    try {
      LOG.info("String_Node_Str",context.toString());
      jobConf.submit();
      while (!jobConf.isComplete()) {
        reportStats(context);
        TimeUnit.MILLISECONDS.sleep(1000);
      }
      LOG.info("String_Node_Str" + jobConf.getStatus() + "String_Node_Str"+ success+ "String_Node_Str"+ context.toString());
      reportStats(context);
      success=jobConf.isSuccessful();
    }
 catch (    InterruptedException e) {
      throw Throwables.propagate(e);
    }
catch (    Exception e) {
      throw Throwables.propagate(e);
    }
  }
 catch (  Exception e) {
    throw Throwables.propagate(e);
  }
 finally {
    stopController(success,context,job,tx,dataSetInstantiator);
    try {
      jobJar.delete();
    }
 catch (    IOException e) {
      LOG.warn("String_Node_Str" + jobJar.toURI());
    }
    try {
      programJarCopy.delete();
    }
 catch (    IOException e) {
      LOG.warn("String_Node_Str" + programJarCopy.toURI());
    }
  }
}

Fixed version (ground truth):
@Override public void run(){
  boolean success=false;
  try {
    LoggingContextAccessor.setLoggingContext(context.getLoggingContext());
    try {
      LOG.info("String_Node_Str",context.toString());
      jobConf.submit();
      initializeStats();
      while (!jobConf.isComplete()) {
        reportStats(context);
        TimeUnit.MILLISECONDS.sleep(1000);
      }
      LOG.info("String_Node_Str" + jobConf.getStatus() + "String_Node_Str"+ success+ "String_Node_Str"+ context.toString());
      reportStats(context);
      TimeUnit.SECONDS.sleep(2L);
      success=jobConf.isSuccessful();
    }
 catch (    InterruptedException e) {
      throw Throwables.propagate(e);
    }
catch (    Exception e) {
      throw Throwables.propagate(e);
    }
  }
 catch (  Exception e) {
    throw Throwables.propagate(e);
  }
 finally {
    stopController(success,context,job,tx,dataSetInstantiator);
    try {
      jobJar.delete();
    }
 catch (    IOException e) {
      LOG.warn("String_Node_Str" + jobJar.toURI());
    }
    try {
      programJarCopy.delete();
    }
 catch (    IOException e) {
      LOG.warn("String_Node_Str" + programJarCopy.toURI());
    }
  }
}
Program: 7682
Project: 7682
Buggy source:
@Override public void init(String[] args){
  LOG.info("String_Node_Str");
  try {
    cConf=CConfiguration.create();
    String zookeeper=cConf.get(Constants.CFG_ZOOKEEPER_ENSEMBLE);
    if (zookeeper == null) {
      LOG.error("String_Node_Str");
      System.exit(1);
    }
    zkClientService=ZKClientServices.delegate(ZKClients.reWatchOnExpire(ZKClients.retryOnFailure(ZKClientService.Builder.of(zookeeper).build(),RetryStrategies.exponentialDelay(500,2000,TimeUnit.MILLISECONDS))));
    Injector injector=createGuiceInjector();
    weaveRunnerService=injector.getInstance(WeaveRunnerService.class);
    router=injector.getInstance(NettyRouter.class);
    LOG.info("String_Node_Str");
  }
 catch (  Throwable t) {
    LOG.error(t.getMessage(),t);
    throw Throwables.propagate(t);
  }
}

Fixed version (ground truth):
@Override public void init(String[] args){
  LOG.info("String_Node_Str");
  try {
    CConfiguration cConf=CConfiguration.create();
    String zookeeper=cConf.get(Constants.CFG_ZOOKEEPER_ENSEMBLE);
    if (zookeeper == null) {
      LOG.error("String_Node_Str");
      System.exit(1);
    }
    zkClientService=ZKClientServices.delegate(ZKClients.reWatchOnExpire(ZKClients.retryOnFailure(ZKClientService.Builder.of(zookeeper).build(),RetryStrategies.exponentialDelay(500,2000,TimeUnit.MILLISECONDS))));
    Injector injector=createGuiceInjector(cConf,zkClientService);
    weaveRunnerService=injector.getInstance(WeaveRunnerService.class);
    router=injector.getInstance(NettyRouter.class);
    LOG.info("String_Node_Str");
  }
 catch (  Throwable t) {
    LOG.error(t.getMessage(),t);
    throw Throwables.propagate(t);
  }
}
Program: 7683
Project: 7683
Buggy source:
private Injector createGuiceInjector(){
  return Guice.createInjector(new ConfigModule(cConf),new LocationRuntimeModule().getDistributedModules(),new DiscoveryRuntimeModule(zkClientService).getDistributedModules(),new AbstractModule(){
    @Override protected void configure(){
      bind(WeaveRunnerService.class).to(YarnWeaveRunnerService.class);
    }
    @Provides @Named(Constants.Router.ADDRESS) public final InetAddress providesHostname(    CConfiguration cConf){
      return Networks.resolve(cConf.get(Constants.Router.ADDRESS),new InetSocketAddress("String_Node_Str",0).getAddress());
    }
    @Singleton @Provides private YarnWeaveRunnerService provideYarnWeaveRunnerService(    CConfiguration configuration,    YarnConfiguration yarnConfiguration,    LocationFactory locationFactory){
      String zkNamespace=configuration.get(Constants.CFG_WEAVE_ZK_NAMESPACE,"String_Node_Str");
      return new YarnWeaveRunnerService(yarnConfiguration,configuration.get(Constants.Zookeeper.QUORUM) + zkNamespace,LocationFactories.namespace(locationFactory,"String_Node_Str"));
    }
    @Provides public Iterable<WeaveRunner.LiveInfo> providesWeaveLiveInfo(    WeaveRunnerService weaveRunnerService){
      return weaveRunnerService.lookupLive();
    }
  }
);
}

Fixed version (ground truth):
static Injector createGuiceInjector(CConfiguration cConf,ZKClientService zkClientService){
  return Guice.createInjector(new ConfigModule(cConf),new LocationRuntimeModule().getDistributedModules(),new DiscoveryRuntimeModule(zkClientService).getDistributedModules(),new AbstractModule(){
    @Override protected void configure(){
      bind(WeaveRunnerService.class).to(YarnWeaveRunnerService.class);
      bind(new TypeLiteral<Iterable<WeaveRunner.LiveInfo>>(){
      }
).toProvider(WeaveLiveInfoProvider.class);
    }
    @Provides @Named(Constants.Router.ADDRESS) public final InetAddress providesHostname(    CConfiguration cConf){
      return Networks.resolve(cConf.get(Constants.Router.ADDRESS),new InetSocketAddress("String_Node_Str",0).getAddress());
    }
    @Singleton @Provides private YarnWeaveRunnerService provideYarnWeaveRunnerService(    CConfiguration configuration,    YarnConfiguration yarnConfiguration,    LocationFactory locationFactory){
      String zkNamespace=configuration.get(Constants.CFG_WEAVE_ZK_NAMESPACE,"String_Node_Str");
      return new YarnWeaveRunnerService(yarnConfiguration,configuration.get(Constants.Zookeeper.QUORUM) + zkNamespace,LocationFactories.namespace(locationFactory,"String_Node_Str"));
    }
  }
);
}
Program: 7684
Project: 7684
Buggy source:
@Override protected void configure(){
  bind(WeaveRunnerService.class).to(YarnWeaveRunnerService.class);
}

Fixed version (ground truth):
@Override protected void configure(){
  bind(WeaveRunnerService.class).to(YarnWeaveRunnerService.class);
  bind(new TypeLiteral<Iterable<WeaveRunner.LiveInfo>>(){
  }
).toProvider(WeaveLiveInfoProvider.class);
}
Program: 7685
Project: 7685
Buggy source:
@Inject public RouterServiceLookup(final Iterable<WeaveRunner.LiveInfo> liveApps,final DiscoveryServiceClient discoveryServiceClient){
  this.discoverableCache=CacheBuilder.newBuilder().expireAfterAccess(1,TimeUnit.HOURS).build(new CacheLoader<String,EndpointStrategy>(){
    @Override public EndpointStrategy load(    String serviceName) throws Exception {
      for (      WeaveRunner.LiveInfo liveInfo : liveApps) {
        String appName=liveInfo.getApplicationName();
        LOG.debug("String_Node_Str",appName);
        if (appName.endsWith("String_Node_Str" + serviceName)) {
          String[] splits=Iterables.toArray(Splitter.on('.').split(appName),String.class);
          if (splits.length > 3) {
            serviceName=String.format("String_Node_Str",splits[1],splits[2],serviceName);
          }
        }
      }
      LOG.debug("String_Node_Str",serviceName);
      return new RandomEndpointStrategy(discoveryServiceClient.discover(serviceName));
    }
  }
);
}

Fixed version (ground truth):
@Inject public RouterServiceLookup(final DiscoveryServiceClient discoveryServiceClient,final Provider<Iterable<WeaveRunner.LiveInfo>> liveAppsProvider){
  this.discoverableCache=CacheBuilder.newBuilder().expireAfterAccess(1,TimeUnit.HOURS).build(new CacheLoader<String,EndpointStrategy>(){
    @Override public EndpointStrategy load(    String serviceName) throws Exception {
      for (      WeaveRunner.LiveInfo liveInfo : liveAppsProvider.get()) {
        String appName=liveInfo.getApplicationName();
        LOG.debug("String_Node_Str",appName);
        if (appName.endsWith("String_Node_Str" + serviceName)) {
          String[] splits=Iterables.toArray(Splitter.on('.').split(appName),String.class);
          if (splits.length > 3) {
            serviceName=String.format("String_Node_Str",splits[1],splits[2],serviceName);
          }
        }
      }
      LOG.debug("String_Node_Str",serviceName);
      return new RandomEndpointStrategy(discoveryServiceClient.discover(serviceName));
    }
  }
);
}
Program: 7686
Project: 7686
Buggy source:
@Override public EndpointStrategy load(String serviceName) throws Exception {
  for (  WeaveRunner.LiveInfo liveInfo : liveApps) {
    String appName=liveInfo.getApplicationName();
    LOG.debug("String_Node_Str",appName);
    if (appName.endsWith("String_Node_Str" + serviceName)) {
      String[] splits=Iterables.toArray(Splitter.on('.').split(appName),String.class);
      if (splits.length > 3) {
        serviceName=String.format("String_Node_Str",splits[1],splits[2],serviceName);
      }
    }
  }
  LOG.debug("String_Node_Str",serviceName);
  return new RandomEndpointStrategy(discoveryServiceClient.discover(serviceName));
}

Fixed version (ground truth):
@Override public EndpointStrategy load(String serviceName) throws Exception {
  for (  WeaveRunner.LiveInfo liveInfo : liveAppsProvider.get()) {
    String appName=liveInfo.getApplicationName();
    LOG.debug("String_Node_Str",appName);
    if (appName.endsWith("String_Node_Str" + serviceName)) {
      String[] splits=Iterables.toArray(Splitter.on('.').split(appName),String.class);
      if (splits.length > 3) {
        serviceName=String.format("String_Node_Str",splits[1],splits[2],serviceName);
      }
    }
  }
  LOG.debug("String_Node_Str",serviceName);
  return new RandomEndpointStrategy(discoveryServiceClient.discover(serviceName));
}
Program: 7687
Project: 7687
Buggy source:
private HttpResponse get(String url) throws Exception {
  DefaultHttpClient client=new DefaultHttpClient();
  HttpGet get=new HttpGet(url);
  return client.execute(get);
}

Fixed version (ground truth):
@Override public Iterable<WeaveRunner.LiveInfo> get(){
  return ImmutableSet.of();
}
Program: 7688
Project: 7688
Buggy source:
@Override public void initialize(DataSetSpecification spec){
  super.initialize(spec);
  track(getName(),"String_Node_Str");
}

Fixed version (ground truth):
@Override public void initialize(DataSetSpecification spec,DataSetContext context){
  super.initialize(spec,context);
  track(getName(),"String_Node_Str");
}
Program: 7689
Project: 7689
Buggy source:
public Scanner scan(byte[] startRow,byte[] stopRow,@Nullable FuzzyRowFilter filter,@Nullable byte[][] columns,@Nullable Transaction tx) throws IOException {
  DBIterator iterator=db.iterator();
  try {
    if (startRow != null) {
      iterator.seek(createStartKey(startRow));
    }
 else {
      iterator.seekToFirst();
    }
  }
 catch (  RuntimeException e) {
    try {
      iterator.close();
    }
 catch (    IOException ioe) {
      LOG.warn("String_Node_Str",ioe);
    }
    throw e;
  }
  byte[] endKey=stopRow == null ? null : createEndKey(stopRow);
  return new LevelDBScanner(iterator,endKey,filter,columns,tx);
}

Fixed version (ground truth):
public Scanner scan(byte[] startRow,byte[] stopRow,@Nullable FuzzyRowFilter filter,@Nullable byte[][] columns,@Nullable Transaction tx) throws IOException {
  DBIterator iterator=getDB().iterator();
  try {
    if (startRow != null) {
      iterator.seek(createStartKey(startRow));
    }
 else {
      iterator.seekToFirst();
    }
  }
 catch (  RuntimeException e) {
    try {
      iterator.close();
    }
 catch (    IOException ioe) {
      LOG.warn("String_Node_Str",ioe);
    }
    throw e;
  }
  byte[] endKey=stopRow == null ? null : createEndKey(stopRow);
  return new LevelDBScanner(iterator,endKey,filter,columns,tx);
}
Program: 7690
Project: 7690
Buggy source:
/** 
 * Delete a list of rows from the table entirely, disregarding transactions.
 * @param toDelete the row keys to delete
 */
public void deleteRows(Collection<byte[]> toDelete) throws IOException {
  if (toDelete.isEmpty()) {
    return;
  }
  Iterator<byte[]> rows=toDelete.iterator();
  byte[] currentRow=rows.next();
  byte[] startKey=createStartKey(currentRow);
  DBIterator iterator=db.iterator();
  WriteBatch batch=db.createWriteBatch();
  try {
    iterator.seek(startKey);
    if (!iterator.hasNext()) {
      return;
    }
    Map.Entry<byte[],byte[]> entry=iterator.next();
    while (entry != null && currentRow != null) {
      KeyValue kv=KeyValue.fromKey(entry.getKey());
      int comp=Bytes.compareTo(kv.getRow(),currentRow);
      if (comp == 0) {
        batch.delete(entry.getKey());
        entry=iterator.hasNext() ? iterator.next() : null;
      }
 else       if (comp > 0) {
        currentRow=rows.hasNext() ? rows.next() : null;
      }
 else       if (comp < 0) {
        iterator.seek(createStartKey(currentRow));
        entry=iterator.hasNext() ? iterator.next() : null;
      }
    }
  }
  finally {
    iterator.close();
  }
  db.write(batch,writeOptions);
}

Fixed version (ground truth):
/** 
 * Delete a list of rows from the table entirely, disregarding transactions.
 * @param toDelete the row keys to delete
 */
public void deleteRows(Collection<byte[]> toDelete) throws IOException {
  if (toDelete.isEmpty()) {
    return;
  }
  Iterator<byte[]> rows=toDelete.iterator();
  byte[] currentRow=rows.next();
  byte[] startKey=createStartKey(currentRow);
  DB db=getDB();
  DBIterator iterator=db.iterator();
  WriteBatch batch=db.createWriteBatch();
  try {
    iterator.seek(startKey);
    if (!iterator.hasNext()) {
      return;
    }
    Map.Entry<byte[],byte[]> entry=iterator.next();
    while (entry != null && currentRow != null) {
      KeyValue kv=KeyValue.fromKey(entry.getKey());
      int comp=Bytes.compareTo(kv.getRow(),currentRow);
      if (comp == 0) {
        batch.delete(entry.getKey());
        entry=iterator.hasNext() ? iterator.next() : null;
      }
 else       if (comp > 0) {
        currentRow=rows.hasNext() ? rows.next() : null;
      }
 else       if (comp < 0) {
        iterator.seek(createStartKey(currentRow));
        entry=iterator.hasNext() ? iterator.next() : null;
      }
    }
  }
  finally {
    iterator.close();
  }
  db.write(batch,getWriteOptions());
}
Program: 7691
Project: 7691
Buggy source:
public void undo(NavigableMap<byte[],NavigableMap<byte[],byte[]>> persisted,long version){
  if (persisted.isEmpty()) {
    return;
  }
  WriteBatch batch=db.createWriteBatch();
  for (  Map.Entry<byte[],NavigableMap<byte[],byte[]>> row : persisted.entrySet()) {
    for (    Map.Entry<byte[],byte[]> column : row.getValue().entrySet()) {
      byte[] key=createPutKey(row.getKey(),column.getKey(),version);
      batch.delete(key);
    }
  }
  db.write(batch,writeOptions);
}

Fixed version (ground truth):
public void undo(NavigableMap<byte[],NavigableMap<byte[],byte[]>> persisted,long version) throws IOException {
  if (persisted.isEmpty()) {
    return;
  }
  DB db=getDB();
  WriteBatch batch=db.createWriteBatch();
  for (  Map.Entry<byte[],NavigableMap<byte[],byte[]>> row : persisted.entrySet()) {
    for (    Map.Entry<byte[],byte[]> column : row.getValue().entrySet()) {
      byte[] key=createPutKey(row.getKey(),column.getKey(),version);
      batch.delete(key);
    }
  }
  db.write(batch,service.getWriteOptions());
}
Program: 7692
Project: 7692
Buggy source:
public void persist(NavigableMap<byte[],NavigableMap<byte[],byte[]>> changes,long version) throws IOException {
  WriteBatch batch=db.createWriteBatch();
  for (  Map.Entry<byte[],NavigableMap<byte[],byte[]>> row : changes.entrySet()) {
    for (    Map.Entry<byte[],byte[]> column : row.getValue().entrySet()) {
      byte[] key=createPutKey(row.getKey(),column.getKey(),version);
      batch.put(key,column.getValue() == null ? DELETE_MARKER : column.getValue());
    }
  }
  db.write(batch,writeOptions);
}

Fixed version (ground truth):
public void persist(NavigableMap<byte[],NavigableMap<byte[],byte[]>> changes,long version) throws IOException {
  DB db=getDB();
  WriteBatch batch=db.createWriteBatch();
  for (  Map.Entry<byte[],NavigableMap<byte[],byte[]>> row : changes.entrySet()) {
    for (    Map.Entry<byte[],byte[]> column : row.getValue().entrySet()) {
      byte[] key=createPutKey(row.getKey(),column.getKey(),version);
      batch.put(key,column.getValue() == null ? DELETE_MARKER : column.getValue());
    }
  }
  db.write(batch,service.getWriteOptions());
}
Program: 7693
Project: 7693
Buggy source:
public LevelDBOcTableCore(String tableName,LevelDBOcTableService service) throws IOException {
  this.db=service.getTable(tableName);
  this.writeOptions=service.getWriteOptions();
}

Fixed version (ground truth):
public LevelDBOcTableCore(String tableName,LevelDBOcTableService service) throws IOException {
  this.tableName=tableName;
  this.service=service;
}
Program: 7694
Project: 7694
Buggy source:
private void deleteColumn(byte[] row,byte[] column) throws IOException {
  WriteBatch batch=db.createWriteBatch();
  DBIterator iterator=db.iterator();
  byte[] endKey=createStartKey(row,Bytes.add(column,new byte[]{0}));
  try {
    iterator.seek(createStartKey(row,column));
    while (iterator.hasNext()) {
      Map.Entry<byte[],byte[]> entry=iterator.next();
      if (KeyValue.KEY_COMPARATOR.compare(entry.getKey(),endKey) >= 0) {
        break;
      }
      batch.delete(entry.getKey());
    }
    db.write(batch);
  }
  finally {
    iterator.close();
  }
}

Fixed version (ground truth):
private void deleteColumn(byte[] row,byte[] column) throws IOException {
  DB db=getDB();
  WriteBatch batch=db.createWriteBatch();
  DBIterator iterator=db.iterator();
  byte[] endKey=createStartKey(row,Bytes.add(column,new byte[]{0}));
  try {
    iterator.seek(createStartKey(row,column));
    while (iterator.hasNext()) {
      Map.Entry<byte[],byte[]> entry=iterator.next();
      if (KeyValue.KEY_COMPARATOR.compare(entry.getKey(),endKey) >= 0) {
        break;
      }
      batch.delete(entry.getKey());
    }
    db.write(batch);
  }
  finally {
    iterator.close();
  }
}
Program: 7695
Project: 7695
Buggy source:
@Override public boolean commitTx() throws Exception {
  queue.ack(dequeuedKeys,config);
  committed=true;
  return true;
}

Fixed version (ground truth):
@Override public boolean commitTx() throws Exception {
  getQueue().ack(dequeuedKeys,config);
  committed=true;
  return true;
}
Program: 7696
Project: 7696
Buggy source:
@Override public DequeueResult dequeue(int maxBatchSize) throws IOException {
  ImmutablePair<List<InMemoryQueue.Key>,List<byte[]>> result=queue.dequeue(currentTx,config,state,maxBatchSize);
  if (result == null) {
    return DequeueResult.EMPTY_RESULT;
  }
 else {
    dequeuedKeys=result.getFirst();
    return new InMemoryDequeueResult(result);
  }
}

Fixed version (ground truth):
@Override public DequeueResult dequeue(int maxBatchSize) throws IOException {
  ImmutablePair<List<InMemoryQueue.Key>,List<byte[]>> result=getQueue().dequeue(currentTx,config,state,maxBatchSize);
  if (result == null) {
    return DequeueResult.EMPTY_RESULT;
  }
 else {
    dequeuedKeys=result.getFirst();
    return new InMemoryDequeueResult(result);
  }
}
Program: 7697
Project: 7697
Buggy source:
public InMemoryQueue2Consumer(QueueName queueName,ConsumerConfig config,int numGroups,InMemoryQueueService queueService){
  this.queueName=queueName;
  this.queue=queueService.getQueue(queueName);
  this.config=config;
  this.numGroups=numGroups;
}

Fixed version (ground truth):
public InMemoryQueue2Consumer(QueueName queueName,ConsumerConfig config,int numGroups,InMemoryQueueService queueService){
  this.queueName=queueName;
  this.queueService=queueService;
  this.config=config;
  this.numGroups=numGroups;
}
Program: 7698
Project: 7698
Buggy source:
@Override public boolean rollbackTx() throws Exception {
  if (committed || DequeueStrategy.FIFO.equals(config.getDequeueStrategy())) {
    if (dequeuedKeys != null) {
      queue.undoDequeue(dequeuedKeys,config);
    }
  }
  dequeuedKeys=null;
  return true;
}

Fixed version (ground truth):
@Override public boolean rollbackTx() throws Exception {
  if (committed || DequeueStrategy.FIFO.equals(config.getDequeueStrategy())) {
    if (dequeuedKeys != null) {
      getQueue().undoDequeue(dequeuedKeys,config);
    }
  }
  dequeuedKeys=null;
  return true;
}
Program: 7699
Project: 7699
Buggy source:
@Override public void postTxCommit(){
  queue.evict(dequeuedKeys,numGroups);
}

Fixed version (ground truth):
@Override public void postTxCommit(){
  getQueue().evict(dequeuedKeys,numGroups);
}
Program: 7700
Project: 7700
Buggy source:
public InMemoryQueue2Producer(QueueName queueName,InMemoryQueueService queueService,QueueMetrics queueMetrics){
  super(queueMetrics,queueName);
  this.queue=queueService.getQueue(queueName);
}

Fixed version (ground truth):
public InMemoryQueue2Producer(QueueName queueName,InMemoryQueueService queueService,QueueMetrics queueMetrics){
  super(queueMetrics,queueName);
  this.queueName=queueName;
  this.queueService=queueService;
}
Program: 7701
Project: 7701
Buggy source:
@Override protected void doRollback(){
  if (commitTransaction != null) {
    for (int seqId=0; seqId < lastEnqueueCount; seqId++) {
      queue.undoEnqueue(commitTransaction.getWritePointer(),seqId);
    }
  }
}

Fixed version (ground truth):
@Override protected void doRollback(){
  if (commitTransaction != null) {
    InMemoryQueue queue=getQueue();
    for (int seqId=0; seqId < lastEnqueueCount; seqId++) {
      queue.undoEnqueue(commitTransaction.getWritePointer(),seqId);
    }
  }
}
Program: 7702
Project: 7702
Buggy source:
@Override protected int persist(Iterable<QueueEntry> entries,Transaction transaction) throws Exception {
  commitTransaction=transaction;
  int seqId=0;
  int bytes=0;
  for (  QueueEntry entry : entries) {
    queue.enqueue(transaction.getWritePointer(),seqId++,entry);
    bytes+=entry.getData().length;
  }
  lastEnqueueCount=seqId;
  return bytes;
}

Fixed version (ground truth):
@Override protected int persist(Iterable<QueueEntry> entries,Transaction transaction) throws Exception {
  commitTransaction=transaction;
  int seqId=0;
  int bytes=0;
  InMemoryQueue queue=getQueue();
  for (  QueueEntry entry : entries) {
    queue.enqueue(transaction.getWritePointer(),seqId++,entry);
    bytes+=entry.getData().length;
  }
  lastEnqueueCount=seqId;
  return bytes;
}
Program: 7703
Project: 7703
Buggy source:
@Test public void testReset() throws Exception {
  QueueName queueName=QueueName.fromFlowlet("String_Node_Str","String_Node_Str","String_Node_Str");
  createEnqueueRunnable(queueName,5,1,null).run();
  Queue2Consumer consumer1=queueClientFactory.createConsumer(queueName,new ConsumerConfig(0,0,1,DequeueStrategy.FIFO,null),2);
  TransactionContext txContext=createTxContext(consumer1);
  txContext.start();
  Assert.assertEquals(0,Bytes.toInt(consumer1.dequeue().iterator().next()));
  txContext.abort();
  System.out.println("String_Node_Str");
  queueAdmin.dropAll();
  System.out.println("String_Node_Str");
  Queue2Consumer consumer2=queueClientFactory.createConsumer(queueName,new ConsumerConfig(1,0,1,DequeueStrategy.FIFO,null),2);
  txContext=createTxContext(consumer2);
  txContext.start();
  Assert.assertFalse(consumer2.dequeue().iterator().hasNext());
  txContext.finish();
}

Fixed version (ground truth):
@Test public void testReset() throws Exception {
  QueueName queueName=QueueName.fromFlowlet("String_Node_Str","String_Node_Str","String_Node_Str");
  Queue2Producer producer=queueClientFactory.createProducer(queueName);
  TransactionContext txContext=createTxContext(producer);
  txContext.start();
  producer.enqueue(new QueueEntry(Bytes.toBytes(0)));
  producer.enqueue(new QueueEntry(Bytes.toBytes(1)));
  producer.enqueue(new QueueEntry(Bytes.toBytes(2)));
  producer.enqueue(new QueueEntry(Bytes.toBytes(3)));
  producer.enqueue(new QueueEntry(Bytes.toBytes(4)));
  txContext.finish();
  Queue2Consumer consumer1=queueClientFactory.createConsumer(queueName,new ConsumerConfig(0,0,1,DequeueStrategy.FIFO,null),2);
  txContext=createTxContext(consumer1);
  txContext.start();
  Assert.assertEquals(0,Bytes.toInt(consumer1.dequeue().iterator().next()));
  txContext.finish();
  System.out.println("String_Node_Str");
  queueAdmin.dropAll();
  System.out.println("String_Node_Str");
  Queue2Consumer consumer2=queueClientFactory.createConsumer(queueName,new ConsumerConfig(1,0,1,DequeueStrategy.FIFO,null),2);
  txContext=createTxContext(consumer2);
  txContext.start();
  Assert.assertTrue(consumer2.dequeue().isEmpty());
  txContext.finish();
  if (this.getClass().getSimpleName().endsWith("String_Node_Str")) {
    return;
  }
  txContext=createTxContext(consumer1);
  txContext.start();
  Assert.assertTrue(consumer1.dequeue().isEmpty());
  txContext.finish();
  txContext=createTxContext(producer);
  txContext.start();
  producer.enqueue(new QueueEntry(Bytes.toBytes(5)));
  txContext.finish();
  txContext=createTxContext(consumer1);
  txContext.start();
  Assert.assertEquals(5,Bytes.toInt(consumer1.dequeue().iterator().next()));
  txContext.finish();
}
Program: 7704
Project: 7704
Buggy source:
public TimeValueAggregator(Collection<? extends Iterable<TimeValue>> timeValues){
  this.timeValues=ImmutableList.copyOf(timeValues);
}

Fixed version (ground truth):
public TimeValueAggregator(Collection<? extends Iterable<TimeValue>> timeValues,Interpolator interpolator){
  this.allTimeseries=ImmutableList.copyOf(timeValues);
  this.interpolator=interpolator;
}
Program: 7705
Project: 7705
Buggy source:
@Override public Iterator<TimeValue> iterator(){
  final List<PeekingIterator<TimeValue>> iterators=Lists.newLinkedList();
  for (  Iterable<TimeValue> timeValue : timeValues) {
    iterators.add(Iterators.peekingIterator(timeValue.iterator()));
  }
  return new AbstractIterator<TimeValue>(){
    @Override protected TimeValue computeNext(){
      long timestamp=Long.MAX_VALUE;
      boolean found=false;
      Iterator<PeekingIterator<TimeValue>> timeValuesItor=iterators.iterator();
      while (timeValuesItor.hasNext()) {
        PeekingIterator<TimeValue> iterator=timeValuesItor.next();
        if (!iterator.hasNext()) {
          timeValuesItor.remove();
          continue;
        }
        long ts=iterator.peek().getTime();
        if (ts <= timestamp) {
          timestamp=ts;
          found=true;
        }
      }
      if (!found) {
        return endOfData();
      }
      int value=0;
      timeValuesItor=iterators.iterator();
      while (timeValuesItor.hasNext()) {
        PeekingIterator<TimeValue> iterator=timeValuesItor.next();
        if (iterator.peek().getTime() == timestamp) {
          value+=iterator.next().getValue();
        }
      }
      return new TimeValue(timestamp,value);
    }
  }
;
}

Fixed version (ground truth):
@Override public Iterator<TimeValue> iterator(){
  return new InterpolatedAggregatorIterator();
}
Program: 7706
Project: 7706
Buggy source:
@Override protected TimeValue computeNext(){
  long timestamp=Long.MAX_VALUE;
  boolean found=false;
  Iterator<PeekingIterator<TimeValue>> timeValuesItor=iterators.iterator();
  while (timeValuesItor.hasNext()) {
    PeekingIterator<TimeValue> iterator=timeValuesItor.next();
    if (!iterator.hasNext()) {
      timeValuesItor.remove();
      continue;
    }
    long ts=iterator.peek().getTime();
    if (ts <= timestamp) {
      timestamp=ts;
      found=true;
    }
  }
  if (!found) {
    return endOfData();
  }
  int value=0;
  timeValuesItor=iterators.iterator();
  while (timeValuesItor.hasNext()) {
    PeekingIterator<TimeValue> iterator=timeValuesItor.next();
    if (iterator.peek().getTime() == timestamp) {
      value+=iterator.next().getValue();
    }
  }
  return new TimeValue(timestamp,value);
}

Fixed version (ground truth):
@Override protected TimeValue computeNext(){
  if (currentTs == Long.MAX_VALUE) {
    return endOfData();
  }
  boolean atEnd=true;
  int currentTsValue=0;
  Iterator<BiDirectionalPeekingIterator> timeseriesIter=timeseriesList.iterator();
  while (timeseriesIter.hasNext()) {
    BiDirectionalPeekingIterator timeseries=timeseriesIter.next();
    if (!timeseries.hasNext()) {
      timeseriesIter.remove();
      continue;
    }
    atEnd=false;
    if (timeseries.peek().getTime() == currentTs) {
      currentTsValue+=timeseries.peek().getValue();
      timeseries.next();
    }
 else     if (interpolator != null && timeseries.peekBefore() != null) {
      currentTsValue+=interpolator.interpolate(timeseries.peekBefore(),timeseries.peek(),currentTs);
    }
  }
  if (atEnd) {
    return endOfData();
  }
  TimeValue output=new TimeValue(currentTs,currentTsValue);
  currentTs=(interpolator == null) ? findEarliestTimestamp() : currentTs + 1;
  return output;
}
Program: 7707
Project: 7707
Buggy source:
@Test public void testHandlerException() throws Exception {
  HttpResponse response=doGet("String_Node_Str");
  Assert.assertEquals(HttpResponseStatus.INTERNAL_SERVER_ERROR.getCode(),response.getStatusLine().getStatusCode());
  handlerHook2.awaitPost();
  Assert.assertEquals(1,handlerHook1.getNumPreCalls());
  Assert.assertEquals(1,handlerHook1.getNumPostCalls());
  Assert.assertEquals(1,handlerHook2.getNumPreCalls());
  Assert.assertEquals(1,handlerHook2.getNumPostCalls());
}

Fixed version (ground truth):
@Test public void testHandlerException() throws Exception {
  HttpResponse response=doGet("String_Node_Str");
  Assert.assertEquals(HttpResponseStatus.INTERNAL_SERVER_ERROR.getCode(),response.getStatusLine().getStatusCode());
  awaitPostHook();
  Assert.assertEquals(1,handlerHook1.getNumPreCalls());
  Assert.assertEquals(1,handlerHook1.getNumPostCalls());
  Assert.assertEquals(1,handlerHook2.getNumPreCalls());
  Assert.assertEquals(1,handlerHook2.getNumPostCalls());
}
Program: 7708
Project: 7708
Buggy source:
@Test public void testHandlerHookCall() throws Exception {
  HttpResponse response=doGet("String_Node_Str");
  Assert.assertEquals(HttpResponseStatus.OK.getCode(),response.getStatusLine().getStatusCode());
  handlerHook2.awaitPost();
  Assert.assertEquals(1,handlerHook1.getNumPreCalls());
  Assert.assertEquals(1,handlerHook1.getNumPostCalls());
  Assert.assertEquals(1,handlerHook2.getNumPreCalls());
  Assert.assertEquals(1,handlerHook2.getNumPostCalls());
}

Fixed version (ground truth):
@Test public void testHandlerHookCall() throws Exception {
  HttpResponse response=doGet("String_Node_Str");
  Assert.assertEquals(HttpResponseStatus.OK.getCode(),response.getStatusLine().getStatusCode());
  awaitPostHook();
  Assert.assertEquals(1,handlerHook1.getNumPreCalls());
  Assert.assertEquals(1,handlerHook1.getNumPostCalls());
  Assert.assertEquals(1,handlerHook2.getNumPreCalls());
  Assert.assertEquals(1,handlerHook2.getNumPostCalls());
}
Program: 7709
Project: 7709
Buggy source:
@Override public void postCall(HttpRequest request,HttpResponseStatus status,HandlerInfo handlerInfo){
  try {
    ++numPostCalls;
    String header=request.getHeader("String_Node_Str");
    if (header != null && header.equals("String_Node_Str")) {
      throw new IllegalArgumentException("String_Node_Str");
    }
  }
  finally {
    postLatch.countDown();
  }
}

Fixed version (ground truth):
@Override public void postCall(HttpRequest request,HttpResponseStatus status,HandlerInfo handlerInfo){
  try {
    ++numPostCalls;
    String header=request.getHeader("String_Node_Str");
    if (header != null && header.equals("String_Node_Str")) {
      throw new IllegalArgumentException("String_Node_Str");
    }
  }
  finally {
    try {
      postBarrier.await();
    }
 catch (    Exception e) {
      LOG.error("String_Node_Str",e);
    }
  }
}
Program: 7710
Project: 7710
Buggy source:
@Test public void testPostException() throws Exception {
  HttpResponse response=doGet("String_Node_Str",new Header[]{new BasicHeader("String_Node_Str","String_Node_Str")});
  Assert.assertEquals(HttpResponseStatus.OK.getCode(),response.getStatusLine().getStatusCode());
  handlerHook2.awaitPost();
  Assert.assertEquals(1,handlerHook1.getNumPreCalls());
  Assert.assertEquals(1,handlerHook1.getNumPostCalls());
  Assert.assertEquals(1,handlerHook2.getNumPreCalls());
  Assert.assertEquals(1,handlerHook2.getNumPostCalls());
}

Fixed version (ground truth):
@Test public void testPostException() throws Exception {
  HttpResponse response=doGet("String_Node_Str",new Header[]{new BasicHeader("String_Node_Str","String_Node_Str")});
  Assert.assertEquals(HttpResponseStatus.OK.getCode(),response.getStatusLine().getStatusCode());
  awaitPostHook();
  Assert.assertEquals(1,handlerHook1.getNumPreCalls());
  Assert.assertEquals(1,handlerHook1.getNumPostCalls());
  Assert.assertEquals(1,handlerHook2.getNumPreCalls());
  Assert.assertEquals(1,handlerHook2.getNumPostCalls());
}
Program: 7711
Project: 7711
Buggy source:
public void awaitPost() throws Exception {
  postLatch.await();
}

Fixed version (ground truth):
public void awaitPost() throws Exception {
  postBarrier.await();
}
Program: 7712
Project: 7712
Buggy source:
private String getMetricContext(WeaveRunner.LiveInfo info){
  Matcher matcher=APP_NAME_PATTERN.matcher(info.getApplicationName());
  if (!matcher.matches()) {
    return null;
  }
  Type type=getType(matcher.group(1));
  if (type == null) {
    return null;
  }
  Id.Program programId=Id.Program.from(matcher.group(2),matcher.group(3),matcher.group(4));
  return Joiner.on("String_Node_Str").join(programId.getApplicationId(),TypeId.getMetricContextId(type),programId.getApplication().getId());
}

Fixed version (ground truth):
private String getMetricContext(WeaveRunner.LiveInfo info){
  Matcher matcher=APP_NAME_PATTERN.matcher(info.getApplicationName());
  if (!matcher.matches()) {
    return null;
  }
  Type type=getType(matcher.group(1));
  if (type == null) {
    return null;
  }
  Id.Program programId=Id.Program.from(matcher.group(2),matcher.group(3),matcher.group(4));
  return Joiner.on("String_Node_Str").join(programId.getApplicationId(),TypeId.getMetricContextId(type),programId.getId());
}