<?xml version="1.0"?>

<!--
  Copyright 2011 The Apache Software Foundation
 
  Licensed to the Apache Software Foundation (ASF) under one
  or more contributor license agreements.  See the NOTICE file
  distributed with this work for additional information
  regarding copyright ownership.  The ASF licenses this file
  to you under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0
 
  Unless required by applicable law or agreed to in writing, software
  distributed under the License is distributed on an "AS IS" BASIS,
  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  See the License for the specific language governing permissions and
  limitations under the License.
-->


<!--
  This file enumerates all the findbugs warnings that we want to suppress.
  If you add a spurious warning, you should add it to this file so that it
  does not generate warnings in the official report.

  For each exception you add, include a comment in your <Match> block
  explaining why this is not a bug.
-->
<FindBugsFilter>
  <Match>
    <!-- SQL db can return null for a boolean column; so can we. -->
    <Class name="com.cloudera.sqoop.lib.JdbcWritableBridge" />
    <Method name="readBoolean" />
    <Bug pattern="NP_BOOLEAN_RETURN_NULL" />
  </Match>
  <Match>
    <!-- This mapper intentially triggers an NPE to cause an exception
         which the test case much catch. -->
    <Class name="com.cloudera.sqoop.mapreduce.TestImportJob$NullDereferenceMapper" />
    <Method name="map" />
    <Bug pattern="NP_ALWAYS_NULL" />
  </Match>
  <Match>
    <!-- createRootTable() allows a user-specified table name retrieved
         from properties. This since instance is allowed for now.
    -->
    <Class name="com.cloudera.sqoop.metastore.hsqldb.HsqldbJobStorage" />
    <Method name="createRootTable" />
    <Bug pattern="SQL_NONCONSTANT_STRING_PASSED_TO_EXECUTE" />
  </Match>

  <!-- The following broad categories suppress warnings in test code that do
       not need to be rigidly upheld. -->
  <Match>
    <!-- Performance warnings are ignored in test code. -->
    <Class name="~com\.cloudera\.sqoop\..*Test.*" />
    <Bug category="PERFORMANCE" />
  </Match>
  <Match>
    <!-- More performance warnings to suppress in tests. -->
    <Class name="~com\.cloudera\.sqoop\..*Test.*" />
    <Bug pattern="SBSC_USE_STRINGBUFFER_CONCATENATION" />
  </Match>
  <Match>
    <!-- Security warnings are ignored in test code. -->
    <Class name="~com\.cloudera\.sqoop\..*Test.*" />
    <Bug category="SECURITY" />
  </Match>
  <Match>
    <!-- Ok to use methods to generate SQL statements in tests. -->
    <Class name="~com\.cloudera\.sqoop\..*Test.*" />
    <Bug pattern="SQL_PREPARED_STATEMENT_GENERATED_FROM_NONCONSTANT_STRING" />
  </Match>

</FindBugsFilter>
