]> source.dussan.org Git - xmlgraphics-fop.git/commitdiff
Resolve Findbugs warning
authorChris Bowditch <cbowditch@apache.org>
Fri, 29 Mar 2019 15:01:48 +0000 (15:01 +0000)
committerChris Bowditch <cbowditch@apache.org>
Fri, 29 Mar 2019 15:01:48 +0000 (15:01 +0000)
git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@1856546 13f79535-47bb-0310-9956-ffa450edef68

fop-core/src/main/java/org/apache/fop/fo/properties/OptionalCharacterProperty.java
fop-core/src/tools/resources/findbugs/exclusions.xml

index 73c1f86263066b64f09b7852dc61732bd4c6d09a..2d67dbef0ff6344d6737fa644bc6271fe65cb1f9 100644 (file)
@@ -101,9 +101,11 @@ public final class OptionalCharacterProperty extends Property {
     public boolean equals(Object obj) {
         if (obj instanceof OptionalCharacterProperty) {
             OptionalCharacterProperty ocp = (OptionalCharacterProperty) obj;
-            return character == ocp.character
-                   || character != null
-                      && character.equals(ocp.character);
+            if (character == null && ocp.character == null) {
+                return true;
+            } else {
+                return (character != null && character.equals(ocp.character));
+            }
         } else {
             return false;
         }
index c78ba0577edf0fc774346f915f00801bbc9c01ed..facf7a4001b88b227723e0ee7a316b6e776a8316 100644 (file)
       <Class name="org.apache.fop.servlet.FopServlet"/>
     </And>    
   </Match>
+  <!-- Bug in findbugs? -->
+  <Match>
+    <Bug pattern="RC_REF_COMPARISON"/>
+    <Or>
+      <And>
+        <Class name="org.apache.fop.fo.properties.OptionalCharacterProperty"/>
+        <Method name="equals"/>
+      </And>
+    </Or>
+  </Match>
   
   <!-- END - TEMPORARY (UNAPPROVED) EXCLUSIONS -->