Program: 110566
Project: 110566
Buggy source:
/** 
 * Validates and packages merged resources. <p>Specifically, validates that: <ul> <li>there are no conflicts between resources (though currently we just warn) <li>each reference to a resource in resources and manifest are satisfied </ul> <p>And packs resources into: <ul> <li>R.java and R.txt files <li>A resource-only APK (deprecated) <li>When building with aapt2, aapt2 equivalents of the above <li>When building with aapt2, a compiled symbols zip </ul>
 */
public static ValidatedAndroidResources validateFrom(RuleContext ruleContext,MergedAndroidResources merged) throws InterruptedException {
  AndroidConfiguration config=AndroidCommon.getAndroidConfig(ruleContext);
  AndroidResourceValidatorActionBuilder builder=new AndroidResourceValidatorActionBuilder(ruleContext).setJavaPackage(merged.getJavaPackage()).setDebug(ruleContext.getConfiguration().getCompilationMode() != CompilationMode.OPT).setMergedResources(merged.getMergedResources()).setRTxtOut(ruleContext.getImplicitOutputArtifact(AndroidRuleClasses.ANDROID_R_TXT)).setSourceJarOut(ruleContext.getImplicitOutputArtifact(AndroidRuleClasses.ANDROID_JAVA_SOURCE_JAR)).setApkOut(ruleContext.getImplicitOutputArtifact(AndroidRuleClasses.ANDROID_LIBRARY_APK)).withDependencies(merged.getResourceDependencies());
  if (config.getAndroidAaptVersion() == AndroidAaptVersion.AAPT2) {
    builder.setCompiledSymbols(merged.getCompiledSymbols()).setAapt2RTxtOut(ruleContext.getImplicitOutputArtifact(AndroidRuleClasses.ANDROID_RESOURCES_AAPT2_R_TXT)).setAapt2SourceJarOut(ruleContext.getImplicitOutputArtifact(AndroidRuleClasses.ANDROID_RESOURCES_AAPT2_SOURCE_JAR)).setStaticLibraryOut(ruleContext.getImplicitOutputArtifact(AndroidRuleClasses.ANDROID_RESOURCES_AAPT2_LIBRARY_APK));
  }
  return builder.build(ruleContext,merged);
}

Fixed version (ground truth):
/** 
 * Validates and packages merged resources. <p>Specifically, validates that: <ul> <li>there are no conflicts between resources (though currently we just warn) <li>each reference to a resource in resources and manifest are satisfied </ul> <p>And packs resources into: <ul> <li>R.java and R.txt files <li>A resource-only APK (deprecated) <li>When building with aapt2, aapt2 equivalents of the above <li>When building with aapt2, a compiled symbols zip </ul>
 */
public static ValidatedAndroidResources validateFrom(RuleContext ruleContext,MergedAndroidResources merged) throws InterruptedException, RuleErrorException {
  AndroidResourceValidatorActionBuilder builder=new AndroidResourceValidatorActionBuilder(ruleContext).setJavaPackage(merged.getJavaPackage()).setDebug(ruleContext.getConfiguration().getCompilationMode() != CompilationMode.OPT).setMergedResources(merged.getMergedResources()).setRTxtOut(ruleContext.getImplicitOutputArtifact(AndroidRuleClasses.ANDROID_R_TXT)).setSourceJarOut(ruleContext.getImplicitOutputArtifact(AndroidRuleClasses.ANDROID_JAVA_SOURCE_JAR)).setApkOut(ruleContext.getImplicitOutputArtifact(AndroidRuleClasses.ANDROID_LIBRARY_APK)).withDependencies(merged.getResourceDependencies());
  if (AndroidAaptVersion.chooseTargetAaptVersion(ruleContext) == AndroidAaptVersion.AAPT2) {
    builder.setCompiledSymbols(merged.getCompiledSymbols()).setAapt2RTxtOut(ruleContext.getImplicitOutputArtifact(AndroidRuleClasses.ANDROID_RESOURCES_AAPT2_R_TXT)).setAapt2SourceJarOut(ruleContext.getImplicitOutputArtifact(AndroidRuleClasses.ANDROID_RESOURCES_AAPT2_SOURCE_JAR)).setStaticLibraryOut(ruleContext.getImplicitOutputArtifact(AndroidRuleClasses.ANDROID_RESOURCES_AAPT2_LIBRARY_APK));
  }
  return builder.build(ruleContext,merged);
}