Program: 110822
Project: 110822
Buggy source:
/** 
 * Validates the proto attributes for this target. <ul> <li>Validates that there are protos specified to be compiled. <li>Validates that, when enabling the open source protobuf library, the options for the PB2 are not specified also. <li>Validates that, when enabling the open source protobuf library, the rule specifies at least one portable proto filter file. </ul>
 */
public void validate() throws RuleErrorException {
  PrerequisiteArtifacts prerequisiteArtifacts=ruleContext.getPrerequisiteArtifacts("String_Node_Str",Mode.TARGET);
  ImmutableList<Artifact> protos=prerequisiteArtifacts.filter(FileType.of("String_Node_Str")).list();
  if (!protos.isEmpty()) {
    ruleContext.attributeWarning("String_Node_Str",FILES_DEPRECATED_WARNING);
  }
  if (ruleContext.attributes().isAttributeValueExplicitlySpecified(ObjcProtoLibraryRule.PORTABLE_PROTO_FILTERS_ATTR)) {
    if (getProtoFiles().isEmpty() && !hasObjcProtoLibraryDependencies()) {
      ruleContext.throwWithRuleError(NO_PROTOS_ERROR);
    }
    if (getPortableProtoFilters().isEmpty()) {
      ruleContext.throwWithRuleError(PORTABLE_PROTO_FILTERS_EMPTY_ERROR);
    }
    if (usesObjcHeaderNames() || needsPerProtoIncludes() || getOptionsFile().isPresent()) {
      ruleContext.throwWithRuleError(PORTABLE_PROTO_FILTERS_NOT_EXCLUSIVE_ERROR);
    }
    if (hasPB2Dependencies()) {
      ruleContext.throwWithRuleError(PROTOCOL_BUFFERS2_IN_PROTOBUF_DEPS_ERROR);
    }
  }
 else {
    if (getProtoFiles().isEmpty()) {
      ruleContext.throwWithRuleError(NO_PROTOS_ERROR);
    }
    if (!usesObjcHeaderNames()) {
      ruleContext.ruleWarning("String_Node_Str" + "String_Node_Str");
    }
    if (hasObjcProtoLibraryDependencies()) {
      ruleContext.throwWithRuleError(OBJC_PROTO_LIB_DEP_IN_PROTOCOL_BUFFERS2_DEPS_ERROR);
    }
  }
}

Fixed version (ground truth):
/** 
 * Validates the proto attributes for this target. <ul> <li>Validates that there are protos specified to be compiled. <li>Validates that, when enabling the open source protobuf library, the options for the PB2 are not specified also. <li>Validates that, when enabling the open source protobuf library, the rule specifies at least one portable proto filter file. </ul>
 */
public void validate() throws RuleErrorException {
  PrerequisiteArtifacts prerequisiteArtifacts=ruleContext.getPrerequisiteArtifacts("String_Node_Str",Mode.TARGET);
  ImmutableList<Artifact> protos=prerequisiteArtifacts.filter(FileType.of("String_Node_Str")).list();
  if (ruleContext.attributes().isAttributeValueExplicitlySpecified(ObjcProtoLibraryRule.PORTABLE_PROTO_FILTERS_ATTR)) {
    if (!protos.isEmpty()) {
      ruleContext.throwWithAttributeError("String_Node_Str",FILES_NOT_ALLOWED_ERROR);
    }
    if (getProtoFiles().isEmpty() && !hasObjcProtoLibraryDependencies()) {
      ruleContext.throwWithRuleError(NO_PROTOS_ERROR);
    }
    if (getPortableProtoFilters().isEmpty()) {
      ruleContext.throwWithRuleError(PORTABLE_PROTO_FILTERS_EMPTY_ERROR);
    }
    if (usesObjcHeaderNames() || needsPerProtoIncludes() || getOptionsFile().isPresent()) {
      ruleContext.throwWithRuleError(PORTABLE_PROTO_FILTERS_NOT_EXCLUSIVE_ERROR);
    }
    if (hasPB2Dependencies()) {
      ruleContext.throwWithRuleError(PROTOCOL_BUFFERS2_IN_PROTOBUF_DEPS_ERROR);
    }
  }
 else {
    if (!protos.isEmpty()) {
      ruleContext.attributeWarning("String_Node_Str",FILES_DEPRECATED_WARNING);
    }
    if (getProtoFiles().isEmpty()) {
      ruleContext.throwWithRuleError(NO_PROTOS_ERROR);
    }
    if (!usesObjcHeaderNames()) {
      ruleContext.ruleWarning("String_Node_Str" + "String_Node_Str");
    }
    if (hasObjcProtoLibraryDependencies()) {
      ruleContext.throwWithRuleError(OBJC_PROTO_LIB_DEP_IN_PROTOCOL_BUFFERS2_DEPS_ERROR);
    }
  }
}