Program: 110941
Project: 110941
Buggy source:
@ThreadCompatible public AnalysisResult update(LoadingResult loadingResult,BuildConfigurationCollection configurations,List<String> aspects,Options viewOptions,TopLevelArtifactContext topLevelOptions,EventHandler eventHandler,EventBus eventBus,boolean loadingEnabled) throws ViewCreationFailedException, InterruptedException {
  LOG.info("String_Node_Str");
  pollInterruptedStatus();
  skyframeBuildView.resetEvaluatedConfiguredTargetKeysSet();
  Collection<Target> targets=loadingResult.getTargets();
  eventBus.post(new AnalysisPhaseStartedEvent(targets));
  skyframeBuildView.setConfigurations(configurations);
  List<TargetAndConfiguration> nodes=nodesForTargets(configurations,targets);
  List<ConfiguredTargetKey> targetSpecs=Lists.transform(nodes,new Function<TargetAndConfiguration,ConfiguredTargetKey>(){
    @Override public ConfiguredTargetKey apply(    TargetAndConfiguration node){
      return new ConfiguredTargetKey(node.getLabel(),node.getConfiguration());
    }
  }
);
  List<AspectValueKey> aspectKeys=new ArrayList<>();
  for (  String aspect : aspects) {
    int delimiterPosition=aspect.indexOf('%');
    if (delimiterPosition >= 0) {
      PathFragment bzlFile=new PathFragment("String_Node_Str" + aspect.substring(0,delimiterPosition));
      String skylarkFunctionName=aspect.substring(delimiterPosition + 1);
      for (      ConfiguredTargetKey targetSpec : targetSpecs) {
        aspectKeys.add(AspectValue.createSkylarkAspectKey(targetSpec.getLabel(),targetSpec.getConfiguration(),bzlFile,skylarkFunctionName));
      }
    }
 else {
      final Class<? extends ConfiguredNativeAspectFactory> aspectFactoryClass=ruleClassProvider.getAspectFactoryMap().get(aspect).asSubclass(ConfiguredNativeAspectFactory.class);
      if (aspectFactoryClass != null) {
        for (        ConfiguredTargetKey targetSpec : targetSpecs) {
          aspectKeys.add(AspectValue.createAspectKey(targetSpec.getLabel(),targetSpec.getConfiguration(),new NativeAspectClass<ConfiguredNativeAspectFactory>(aspectFactoryClass)));
        }
      }
 else {
        throw new ViewCreationFailedException("String_Node_Str" + aspect + "String_Node_Str");
      }
    }
  }
  if (loadingEnabled) {
    setArtifactRoots(loadingResult.getPackageRoots(),configurations);
  }
  prepareToBuild(configurations,new SkyframePackageRootResolver(skyframeExecutor,eventHandler));
  skyframeExecutor.injectWorkspaceStatusData();
  SkyframeAnalysisResult skyframeAnalysisResult;
  try {
    skyframeAnalysisResult=skyframeBuildView.configureTargets(eventHandler,targetSpecs,aspectKeys,eventBus,viewOptions.keepGoing);
    setArtifactRoots(skyframeAnalysisResult.getPackageRoots(),configurations);
  }
  finally {
    skyframeBuildView.clearInvalidatedConfiguredTargets();
  }
  int numTargetsToAnalyze=nodes.size();
  int numSuccessful=skyframeAnalysisResult.getConfiguredTargets().size();
  boolean analysisSuccessful=(numSuccessful == numTargetsToAnalyze);
  if (0 < numSuccessful && numSuccessful < numTargetsToAnalyze) {
    String msg=String.format("String_Node_Str",numSuccessful,numTargetsToAnalyze);
    eventHandler.handle(Event.info(msg));
    LOG.info(msg);
  }
  AnalysisResult result=createResult(eventHandler,loadingResult,topLevelOptions,viewOptions,skyframeAnalysisResult.getConfiguredTargets(),skyframeAnalysisResult.getAspects(),skyframeAnalysisResult.getWalkableGraph(),skyframeAnalysisResult.getPackageRoots(),analysisSuccessful);
  LOG.info("String_Node_Str");
  return result;
}

Fixed version (ground truth):
@ThreadCompatible public AnalysisResult update(LoadingResult loadingResult,BuildConfigurationCollection configurations,List<String> aspects,Options viewOptions,TopLevelArtifactContext topLevelOptions,EventHandler eventHandler,EventBus eventBus,boolean loadingEnabled) throws ViewCreationFailedException, InterruptedException {
  LOG.info("String_Node_Str");
  pollInterruptedStatus();
  skyframeBuildView.resetEvaluatedConfiguredTargetKeysSet();
  Collection<Target> targets=loadingResult.getTargets();
  eventBus.post(new AnalysisPhaseStartedEvent(targets));
  skyframeBuildView.setConfigurations(configurations);
  List<TargetAndConfiguration> nodes=nodesForTargets(configurations,targets);
  List<ConfiguredTargetKey> targetSpecs=Lists.transform(nodes,new Function<TargetAndConfiguration,ConfiguredTargetKey>(){
    @Override public ConfiguredTargetKey apply(    TargetAndConfiguration node){
      return new ConfiguredTargetKey(node.getLabel(),node.getConfiguration());
    }
  }
);
  List<AspectValueKey> aspectKeys=new ArrayList<>();
  for (  String aspect : aspects) {
    int delimiterPosition=aspect.indexOf('%');
    if (delimiterPosition >= 0) {
      PathFragment bzlFile=new PathFragment("String_Node_Str" + aspect.substring(0,delimiterPosition));
      String skylarkFunctionName=aspect.substring(delimiterPosition + 1);
      for (      ConfiguredTargetKey targetSpec : targetSpecs) {
        aspectKeys.add(AspectValue.createSkylarkAspectKey(targetSpec.getLabel(),targetSpec.getConfiguration(),bzlFile,skylarkFunctionName));
      }
    }
 else {
      final Class<? extends ConfiguredNativeAspectFactory> aspectFactoryClass=ruleClassProvider.getAspectFactoryMap().get(aspect).asSubclass(ConfiguredNativeAspectFactory.class);
      if (aspectFactoryClass != null) {
        for (        ConfiguredTargetKey targetSpec : targetSpecs) {
          aspectKeys.add(AspectValue.createAspectKey(targetSpec.getLabel(),targetSpec.getConfiguration(),new NativeAspectClass<ConfiguredNativeAspectFactory>(aspectFactoryClass)));
        }
      }
 else {
        throw new ViewCreationFailedException("String_Node_Str" + aspect + "String_Node_Str");
      }
    }
  }
  if (loadingEnabled) {
    setArtifactRoots(loadingResult.getPackageRoots(),configurations);
  }
  prepareToBuild(configurations,new SkyframePackageRootResolver(skyframeExecutor,eventHandler));
  skyframeExecutor.injectWorkspaceStatusData();
  SkyframeAnalysisResult skyframeAnalysisResult;
  try {
    skyframeAnalysisResult=skyframeBuildView.configureTargets(eventHandler,targetSpecs,aspectKeys,eventBus,viewOptions.keepGoing);
    setArtifactRoots(skyframeAnalysisResult.getPackageRoots(),configurations);
  }
  finally {
    skyframeBuildView.clearInvalidatedConfiguredTargets();
  }
  int numTargetsToAnalyze=nodes.size();
  int numSuccessful=skyframeAnalysisResult.getConfiguredTargets().size();
  if (0 < numSuccessful && numSuccessful < numTargetsToAnalyze) {
    String msg=String.format("String_Node_Str",numSuccessful,numTargetsToAnalyze);
    eventHandler.handle(Event.info(msg));
    LOG.info(msg);
  }
  boolean analysisSuccessful=!skyframeAnalysisResult.hasError();
  AnalysisResult result=createResult(eventHandler,loadingResult,topLevelOptions,viewOptions,skyframeAnalysisResult.getConfiguredTargets(),skyframeAnalysisResult.getAspects(),skyframeAnalysisResult.getWalkableGraph(),skyframeAnalysisResult.getPackageRoots(),analysisSuccessful);
  LOG.info("String_Node_Str");
  return result;
}