<!--
  ~ Copyright 2018 Confluent Inc.
  ~
  ~ Licensed under the Confluent Community License (the "License"); you may not use
  ~ this file except in compliance with the License.  You may obtain a copy of the
  ~ License at
  ~
  ~ http://www.confluent.io/confluent-community-license
  ~
  ~ Unless required by applicable law or agreed to in writing, software
  ~ distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
  ~ WARRANTIES OF ANY KIND, either express or implied.  See the License for the
  ~ specific language governing permissions and limitations under the License.
  -->

<!-- Findbugs filtering.

Findbugs is a static code analysis tool run as part of the "check" phase of the build.
This file dictates which categories of bugs and individual false positives that we supress.

For a detailed description of findbugs bug categories, see http://findbugs.sourceforge.net/bugDescriptions.html
-->
<FindBugsFilter>
    <Match>
        <Class name="io.confluent.kafka.schemaregistry.client.rest.entities.ServerClusterId"/>
        <Bug pattern="SS_SHOULD_BE_STATIC"/>
    </Match>

    <Match>
        <Class name="io.confluent.kafka.serializers.AbstractKafkaSchemaSerDe"/>
        <Bug pattern="URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD"/>
    </Match>

    <Match>
        <Class name="io.confluent.kafka.serializers.KafkaAvroDeserializer"/>
        <Bug pattern="URF_UNREAD_FIELD"/>
    </Match>

    <Match>
        <Class name="io.confluent.kafka.serializers.KafkaAvroSerializer"/>
        <Bug pattern="URF_UNREAD_FIELD"/>
    </Match>

    <Match>
        <Class name="io.confluent.kafka.serializers.json.KafkaJsonSchemaDeserializer"/>
        <Bug pattern="URF_UNREAD_FIELD"/>
    </Match>

    <Match>
        <Class name="io.confluent.kafka.serializers.json.KafkaJsonSchemaSerializer"/>
        <Bug pattern="URF_UNREAD_FIELD"/>
    </Match>

    <Match>
        <Class name="io.confluent.kafka.serializers.protobuf.KafkaProtobufDeserializer"/>
        <Bug pattern="URF_UNREAD_FIELD"/>
    </Match>

    <Match>
        <Class name="io.confluent.kafka.serializers.protobuf.KafkaProtobufSerializer"/>
        <Bug pattern="URF_UNREAD_FIELD"/>
    </Match>

    <Match>
        <Class name="io.confluent.kafka.schemaregistry.rest.SchemaRegistryRestApplication"/>
        <Bug pattern="DM_EXIT"/>
    </Match>

    <Match>
        <Class name="io.confluent.kafka.schemaregistry.storage.MD5"/>
        <Bug pattern="EI_EXPOSE_REP"/>
    </Match>

    <Match>
        <Class name="io.confluent.kafka.schemaregistry.storage.MD5"/>
        <Bug pattern="EI_EXPOSE_REP2"/>
    </Match>

    <Match>
        <Class name="io.confluent.connect.avro.AvroData"/>
        <Bug pattern="RC_REF_COMPARISON_BAD_PRACTICE"/>
    </Match>

    <Match>
        <Class name="io.confluent.connect.avro.AvroData"/>
        <Bug pattern="DLS_DEAD_LOCAL_STORE"/>
    </Match>

    <Match>
        <Class name="io.confluent.connect.protobuf.ProtobufData"/>
        <Bug pattern="DLS_DEAD_LOCAL_STORE"/>
    </Match>

    <Match>
        <Class name="io.confluent.connect.json.JsonSchemaData"/>
        <Bug pattern="DLS_DEAD_LOCAL_STORE"/>
    </Match>

    <Match>
        <Class name="io.confluent.kafka.schemaregistry.utils.AppInfoParser"/>
        <Bug pattern="NP_LOAD_OF_KNOWN_NULL_VALUE"/>
    </Match>

    <!-- exclude generated code -->
    <Match>
        <Class name="~io.confluent.schemaregistry.benchmark.generated.*"/>
    </Match>

    <Match>
        <Bug pattern="RCN_REDUNDANT_NULLCHECK_OF_NONNULL_VALUE"/>
    </Match>

    <Match>
        <Bug pattern="RCN_REDUNDANT_NULLCHECK_OF_NULL_VALUE"/>
    </Match>

    <!-- false positive in Java 11, see https://github.com/spotbugs/spotbugs/issues/756 -->
    <Match>
        <Bug pattern="RCN_REDUNDANT_NULLCHECK_WOULD_HAVE_BEEN_A_NPE"/>
    </Match>
</FindBugsFilter>
