<?xml version="1.0" encoding="UTF-8"?>
<!--
    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.
-->

<!-- Exclusion filter for running FindBugs against Apache Harmony -->

<FindBugsFilter>

     
       <!-- Number classes should be able to call Number constructors -->
       <Match>
       <Or>
         <Class name="java.lang.Byte" />
         <Class name="java.lang.Character" />
         <Class name="java.lang.Integer" />
         <Class name="java.lang.Long" />
         <Class name="java.lang.Short" />
       </Or>
       <Bug code="Dm" />
     </Match>
     
     <!-- OK to use signed right shift instead of unsigned because numbers used are positive -->
     <Match>
       <Class name="java.lang.Character$UnicodeBlock" />
       <Method name="of" />
       <Bug code="IM" />
     </Match>
             
     <!-- Javadoc specifies that ByteArrayInputStream's constructors are designed to take a mutable byte array as an argument and not copy it -->
     <Match>
       <Class name="java.io.ByteArrayInputStream" />
       <Bug code="EI2" />
     </Match>
             
     <!-- Javadoc specifies that CharArrayReader's constructors are designed to take a mutable char array as an argument and not copy it -->
     <Match>
       <Class name="java.io.CharArrayReader" />
       <Bug code="EI2" />
     </Match>   

     <!-- Fallthrough in switch statement is meant to be there -->
     <Match>
       <Class name="java.io.LineNumberInputStream" />
       <Method name="read" />
       <Bug code="SF" />
     </Match>
     
     <!-- Fallthrough in switch statement is meant to be there -->
     <Match>
       <Class name="java.io.LineNumberReader" />
       <Method name="read" />
       <Bug code="SF" />
     </Match>
     
     <!-- OK to compare Strings using  using == or != in the String class itself -->
     <Match>
       <Class name="java.lang.String" />
       <Bug code="ES" />
     </Match>
     
     <!-- Ignore this unused private method -->
     <Match>
       <Class name="java.lang.String" />
       <Method name="indexOf" />
       <Bug code="UPM" />
     </Match>
     
     <!-- Field h is required to be non-transient as part of the serialized form specification for Proxy -->
     <Match>
       <Class name="java.lang.reflect.Proxy" />
       <Field name="h" />
       <Bug code="Se" />
     </Match>
     
     <!-- Exceptions have to be ignored because method doesn't throw an Exception in the spec -->
     <Match>
       <Class name="java.lang.SecurityManager" />
       <Method name="checkTopLevelWindow" />
       <Bug code="DE" />
     </Match>
     
     <!-- OK to use mutable Objects for DatagramPacket -->
     <Match>
       <Class name="java.net.DatagramPacket" />
       <Or>
         <Method name="setData" />
         <Method name="getData" />
       </Or>
       <Bug code="EI2, EI" />
     </Match>
     
     <!-- Method is not static in the spec, so can't change it -->
     <Match>
       <Class name="java.net.URLConnection" />
       <Method name="setDefaultUseCaches" />
       <Bug code="ST" />
     </Match>
     
     <!-- Exceptions are supposed to be ignored -->
     <Match>
       <Class name="java.net.URLConnection" />
       <Method name="getContentHandler" />
       <Bug code="DE" />
     </Match>
     
     <!-- Exceptions are supposed to be ignored -->
     <Match>
       <Class name="java.net.URL" />
       <Method name="setupStreamHandler" />
       <Bug code="DE" />
     </Match>
     
     <!-- URLClassLoader needs to use URL.equals() method -->
     <Match>
       <Class name="java.net.URLClassLoader" />
       <Bug code="Dm" />
     </Match>

     <!-- Load of known null value is intended (line 409) -->
     <Match>
       <Class name="java.net.URL" />
       <Bug code="NP" />
     </Match>
     
     <!-- Constructs a new instance instead of using super.clone() -->
     <Match>
     	<Or>
     		<Class name="java.util.jar.Manifest" />
     		<Class name="java.util.zip.ZipEntry" />
     	</Or>
     	<Method name="clone" />
     	<Bug pattern="CN_IDIOM_NO_SUPER_CALL" />     	
     </Match>     
          
     <!-- It does make sense for AbstractList to have a transient field because it has serializable subclasses -->
     <Match>
       <Class name="java.util.AbstractList" />
       <Bug code="Se" />
     </Match>
     
     <!-- False positive caused by compiler -->
     <Match>
       <Class name="java.util.AbstractList" />
       <Method name="addAll" />
       <Bug code="DLS" />
     </Match>
          
     <!-- GregorianCalendar.equals does not need to check for null because it delegates to its superclass, which does -->
     <Match>
       <Class name="java.util.GregorianCalendar" />
       <Method name="equals" />
       <Bug code="NP" />
     </Match>
     
     <!-- PropertyPermission.equals does not need to check for null because it delegates to its superclass, which does -->
     <Match>
       <Class name="java.util.PropertyPermission" />
       <Method name="equals" />
       <Bug code="NP" />
     </Match>
     
     <!-- The comparator field is part of the serialized form specification for both TreeMap and PriorityQueue -->
     <Match>
       <Or>
         <Class name="java.util.TreeMap" />
         <Class name="java.util.PriorityQueue" />
       </Or>
       <Field name="comparator" />
       <Bug code="Se" />
     </Match>
     
     <!-- Ignore this unread field -->
     <Match>
       <Class name="java.util.Timer" />
       <Field name="finalizer" />
       <Bug code="UrF" />
     </Match>
     
     <!-- Exception is ignored on purpose -->
     <Match>
       <Class name="java.util.Timer$TimerImpl" />
       <Method name="run" />
       <Bug code="DE" />
     </Match>
     
     <!-- Access is synchronized - looks like FindBugs got it wrong here -->
     <Match>
       <Class name="java.util.Timer$TimerImpl" />
       <Field name="cancelled" />
       <Bug code="IS" />
     </Match>
     
     <!-- Initialization of Locale.availableLocales doesn't need to be synchronized as it won't matter if it is initialized twice -->
     <Match>
       <Class name="java.util.Locale" />
       <Method name="getAvailableLocales" />
       <Bug code="LI" />
     </Match>
     
     <!-- OK to use signed right shift instead of unsigned because all numbers are positive -->
     <Match>
       <Class name="java.util.Arrays" />
       <Bug code="IM" />
     </Match>     
     
     <!-- OK to use unsynchronized access in Hashtable.HashIterator and Hashtable.HashEnumerator -->
     <!-- NOTE - it would be good to be able to make this exclusion a bit more specific -->
     <Match>
       <Class name="java.util.Hashtable" />
       <Bug code="IS" />
     </Match>
     
     <!-- Comparators are generally Serializable so it's OK for this field not to be transient -->
     <Match>
       <Class name="java.util.Collections$ReverseComparatorWithComparator" />
       <Bug code="Se" />
     </Match>
     
     <!-- Fallthrough in switch statements are meant to be there -->
     <Match>
       <Class name="org.apache.harmony.luni.util.FloatingPointParser" />
       <Or>
       	 <Method name="parseDblName" />
       	 <Method name="parseFltName" />
       </Or>
       <Bug code="SF" />
     </Match>
     
     <!-- OK to throw a NullPointerException if one key is null -->
     <Match>
       <Class name="org.apache.harmony.luni.util.TwoKeyHashMap" />
       <Bug code="NP" />
     </Match>
          
     <!-- Unread fields are used by native code -->
     <Match>
     <Class name="org.apache.harmony.luni.net.GenericIPMreq" />
       <Or>
       	 <Field name="interfaceAddr" />
       	 <Field name="isIPV6Address" />
       	 <Field name="interfaceIdx" />
       </Or>
       <Bug code="UrF" />
     </Match>

     <!-- Ignored result is not important in this case -->
     <Match>
       <Class name="org.apache.harmony.luni.internal.net.www.protocol.ftp.FtpURLConnection" />
       <Method name="getReply" />
       <Bug code="RR" />
     </Match>           
     
     <!-- Invocation of inherited method is intended -->
     <Match>
       <Class name="org.apache.harmony.luni.internal.net.www.protocol.https.HttpsURLConnection$HttpsEngine" />
       <Bug code="IA" />
     </Match>

	<Match>
		<!-- These classes are not serializable. -->
		<Or>
			<Class name="java.util.prefs.NodeChangeEvent" />
			<Class name="java.util.prefs.PreferenceChangeEvent" />
		</Or>	
		<Bug pattern="SE_BAD_FIELD" />
	</Match>
	
	<Match>
		<!-- This method is called from a loop. -->
		<Class name="java.util.prefs.AbstractPreferences$EventDispatcher" />
		<Method name="getEventObject" />
		<Bug pattern="WA_NOT_IN_LOOP" />
	</Match>

     <!-- Exception is ignored on purpose -->
     <Match>
       <Class name="java.util.jar.JarVerifier" />
       <Method name="verifyCertificate" />
       <Bug code="DE" />
     </Match>	
	
     <!-- OK to ignore return value as result is checked in next line -->
     <Match>
       <Class name="java.util.zip.ZipInputStream" />
       <Method name="closeEntry" />
       <Bug code="RR" />
     </Match>	
     
     <!-- OK to return actual byte array as this matches RI's behaviour -->
     <Match>
       <Class name="java.util.zip.ZipEntry" />
       <Method name="getExtra" />
       <Bug code="EI" />
     </Match>	
     
     <!-- OK to use actual byte array as this matches RI's behaviour -->
     <Match>
       <Class name="java.util.zip.ZipEntry" />
       <Method name="setExtra" />
       <Bug code="EI2" />
     </Match>
     
     <!-- OK to use actual byte array as this matches RI's behaviour -->
     <Match>
       <Class name="java.util.zip.Deflater" />
       <Method name="setInput" />
       <Bug code="EI2" />
     </Match>
       
     <!-- Field 'element' is part of the specified serialized form -->
     <Match>
       <Class name="java.lang.annotation.AnnotationTypeMismatchException" />
       <Field name="element" />
       <Bug code="Se" />
     </Match>     
     
     <!-- Exposing internal representation is required by the spec -->
     <Match>
       <Class name="java.lang.instrument.ClassDefinition" />
       <Bug code="EI, EI2" />
     </Match>   
      
     <!-- Access to field 'localPort' is not required to be synchronized -->
     <Match>
       <Class name="org.apache.harmony.nio.internal.SocketChannelImpl" />
       <Field name="localPort" />
       <Bug code="IS" />
     </Match>  
            
</FindBugsFilter>

