You are viewing a plain text version of this content. The canonical link for it is here.
Posted to fop-commits@xmlgraphics.apache.org by vh...@apache.org on 2012/04/25 20:09:51 UTC

svn commit: r1330453 - in /xmlgraphics/fop/trunk: findbugs-exclude.xml src/java/org/apache/fop/fo/properties/FontFamilyProperty.java src/java/org/apache/fop/fo/properties/SpaceProperty.java

Author: vhennebert
Date: Wed Apr 25 18:09:51 2012
New Revision: 1330453

URL: http://svn.apache.org/viewvc?rev=1330453&view=rev
Log:
Fixed FindBugs warnings

Modified:
    xmlgraphics/fop/trunk/findbugs-exclude.xml
    xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/properties/FontFamilyProperty.java
    xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/properties/SpaceProperty.java

Modified: xmlgraphics/fop/trunk/findbugs-exclude.xml
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/findbugs-exclude.xml?rev=1330453&r1=1330452&r2=1330453&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/findbugs-exclude.xml (original)
+++ xmlgraphics/fop/trunk/findbugs-exclude.xml Wed Apr 25 18:09:51 2012
@@ -1,5 +1,21 @@
 <?xml version="1.0" encoding="utf-8"?>
 <FindBugsFilter>
+  <Match>
+    <Class name="org.apache.fop.fo.properties.FontFamilyProperty"/>
+    <Bug pattern="EQ_DOESNT_OVERRIDE_EQUALS"/>
+  </Match>
+  <Match>
+    <Class name="org.apache.fop.fo.properties.CondLengthProperty"/>
+    <Bug pattern="UWF_FIELD_NOT_INITIALIZED_IN_CONSTRUCTOR"/>
+  </Match>
+  <Match>
+    <Class name="org.apache.fop.pdf.xref.TrailerDictionary$1FileID"/>
+    <Bug pattern="SIC_INNER_SHOULD_BE_STATIC_ANON"/>
+  </Match>
+  <Match>
+    <Class name="org.apache.fop.fo.properties.ToBeImplementedProperty"/>
+    <Bug pattern="EQ_ALWAYS_TRUE"/>
+  </Match>
    <Match>
       <Class name="org.apache.fop.render.intermediate.IFStructureTreeBuilder"/>
       <Field name="delegate"/>

Modified: xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/properties/FontFamilyProperty.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/properties/FontFamilyProperty.java?rev=1330453&r1=1330452&r2=1330453&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/properties/FontFamilyProperty.java (original)
+++ xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/properties/FontFamilyProperty.java Wed Apr 25 18:09:51 2012
@@ -19,8 +19,6 @@
 
 package org.apache.fop.fo.properties;
 
-import java.util.Iterator;
-
 import org.apache.fop.fo.FObj;
 import org.apache.fop.fo.PropertyList;
 import org.apache.fop.fo.expr.PropertyException;
@@ -34,8 +32,6 @@ public final class FontFamilyProperty ex
     private static final PropertyCache<FontFamilyProperty> CACHE
             = new PropertyCache<FontFamilyProperty>();
 
-    private int hash = 0;
-
     /**
      * Inner class for creating instances of ListProperty
      */
@@ -151,30 +147,4 @@ public final class FontFamilyProperty ex
         }
     }
 
-    /** {@inheritDoc} */
-    public boolean equals(Object o) {
-        if (this == o) {
-            return true;
-        }
-
-        if (o instanceof FontFamilyProperty) {
-            FontFamilyProperty ffp = (FontFamilyProperty) o;
-            return (this.list != null
-                    && this.list.equals(ffp.list));
-        }
-        return false;
-    }
-
-    /** {@inheritDoc} */
-    public int hashCode() {
-        if (this.hash == 0) {
-            int hash = 17;
-            for (Iterator i = list.iterator(); i.hasNext();) {
-                Property p = (Property) i.next();
-                hash = 37 * hash + (p == null ? 0 : p.hashCode());
-            }
-            this.hash = hash;
-        }
-        return this.hash;
-    }
 }

Modified: xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/properties/SpaceProperty.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/properties/SpaceProperty.java?rev=1330453&r1=1330452&r2=1330453&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/properties/SpaceProperty.java (original)
+++ xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/properties/SpaceProperty.java Wed Apr 25 18:09:51 2012
@@ -23,6 +23,7 @@ import org.apache.fop.fo.Constants;
 import org.apache.fop.fo.FObj;
 import org.apache.fop.fo.PropertyList;
 import org.apache.fop.fo.expr.PropertyException;
+import org.apache.fop.util.CompareUtil;
 
 /**
  * Base class used for handling properties of the fo:space-before and
@@ -168,4 +169,27 @@ public class SpaceProperty extends Lengt
         return this;
     }
 
+    @Override
+    public int hashCode() {
+        final int prime = 31;
+        int result = super.hashCode();
+        result = prime * result + CompareUtil.getHashCode(precedence);
+        result = prime * result + CompareUtil.getHashCode(conditionality);
+        return result;
+    }
+
+    @Override
+    public boolean equals(Object obj) {
+        if (this == obj) {
+            return true;
+        }
+        if (!(obj instanceof SpaceProperty)) {
+            return false;
+        }
+        SpaceProperty other = (SpaceProperty) obj;
+        return super.equals(obj)
+                && CompareUtil.equal(precedence, other.precedence)
+                && CompareUtil.equal(conditionality, other.conditionality);
+    }
+
 }



---------------------------------------------------------------------
To unsubscribe, e-mail: fop-commits-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-commits-help@xmlgraphics.apache.org