Program: 53312
Project: 53312
Buggy source:
@Override public final synchronized ListenableFuture<BuildRuleSuccess> build(final BuildContext context){
  if (buildRuleResult != null) {
    return buildRuleResult;
  }
  context.getEventBus().post(BuildEvents.started(this));
  boolean isCached;
  try {
    isCached=isCached(context);
  }
 catch (  IOException e) {
    buildRuleResult=Futures.immediateFailedFuture(e);
    context.getEventBus().post(BuildEvents.finished(this,BuildRuleStatus.FAIL,CacheResult.MISS));
    return buildRuleResult;
  }
  if (isCached) {
    logger.info(String.format("String_Node_Str",getFullyQualifiedName()));
    buildRuleResult=Futures.immediateFuture(new BuildRuleSuccess(this));
    context.getEventBus().post(BuildEvents.finished(this,BuildRuleStatus.SUCCESS,CacheResult.HIT));
    return buildRuleResult;
  }
  logger.info(String.format("String_Node_Str",getFullyQualifiedName()));
  buildRuleResult=SettableFuture.create();
  ListenableFuture<List<BuildRuleSuccess>> builtDeps=Builder.getInstance().buildRules(getDeps(),context);
  OnDepsBuiltCallback onDepsBuiltCallback=new OnDepsBuiltCallback(context);
  Futures.addCallback(builtDeps,onDepsBuiltCallback,context.getExecutor());
  Futures.addCallback(buildRuleResult,new FutureCallback<BuildRuleSuccess>(){
    @Override public void onSuccess(    BuildRuleSuccess buildRuleSuccess){
      context.getEventBus().post(BuildEvents.finished(AbstractCachingBuildRule.this,BuildRuleStatus.SUCCESS,CacheResult.MISS));
    }
    @Override public void onFailure(    Throwable throwable){
      context.getEventBus().post(BuildEvents.finished(AbstractCachingBuildRule.this,BuildRuleStatus.FAIL,CacheResult.MISS));
    }
  }
,context.getExecutor());
  return buildRuleResult;
}

Fixed version (ground truth):
@Override public final synchronized ListenableFuture<BuildRuleSuccess> build(final BuildContext context){
  if (buildRuleResult != null) {
    return buildRuleResult;
  }
  context.getEventBus().post(BuildEvents.started(this));
  boolean isCached;
  ImmutableSet<BuildRule> depsWithUncachedDescendants;
  try {
    isCached=isCached(context);
    depsWithUncachedDescendants=getDepsWithUncachedDescendants(context);
  }
 catch (  IOException e) {
    buildRuleResult=Futures.immediateFailedFuture(e);
    context.getEventBus().post(BuildEvents.finished(this,BuildRuleStatus.FAIL,CacheResult.MISS));
    return buildRuleResult;
  }
  buildRuleResult=SettableFuture.create();
  ListenableFuture<List<BuildRuleSuccess>> builtDeps=Builder.getInstance().buildRules(depsWithUncachedDescendants,context);
  if (isCached) {
    logger.info(String.format("String_Node_Str",getFullyQualifiedName()));
    context.getEventBus().post(BuildEvents.finished(this,BuildRuleStatus.SUCCESS,CacheResult.HIT));
    Futures.addCallback(builtDeps,new FutureCallback<List<BuildRuleSuccess>>(){
      final SettableFuture<BuildRuleSuccess> result=(SettableFuture<BuildRuleSuccess>)buildRuleResult;
      @Override public void onSuccess(      List<BuildRuleSuccess> results){
        result.set(new BuildRuleSuccess(AbstractCachingBuildRule.this));
      }
      @Override public void onFailure(      Throwable t){
        result.setException(t);
      }
    }
,context.getExecutor());
    return buildRuleResult;
  }
  logger.info(String.format("String_Node_Str",getFullyQualifiedName()));
  buildRuleResult=SettableFuture.create();
  OnDepsBuiltCallback onDepsBuiltCallback=new OnDepsBuiltCallback(context);
  Futures.addCallback(builtDeps,onDepsBuiltCallback,context.getExecutor());
  Futures.addCallback(buildRuleResult,new FutureCallback<BuildRuleSuccess>(){
    @Override public void onSuccess(    BuildRuleSuccess buildRuleSuccess){
      context.getEventBus().post(BuildEvents.finished(AbstractCachingBuildRule.this,BuildRuleStatus.SUCCESS,CacheResult.MISS));
    }
    @Override public void onFailure(    Throwable throwable){
      context.getEventBus().post(BuildEvents.finished(AbstractCachingBuildRule.this,BuildRuleStatus.FAIL,CacheResult.MISS));
    }
  }
,context.getExecutor());
  return buildRuleResult;
}