aboutsummaryrefslogtreecommitdiffstats
path: root/src/java
diff options
context:
space:
mode:
authorVincent Hennebert <vhennebert@apache.org>2012-04-25 18:09:51 +0000
committerVincent Hennebert <vhennebert@apache.org>2012-04-25 18:09:51 +0000
commit65ff8fa968cfbea583a779444ded2b343c498ee7 (patch)
treebbc189feea5ac84936c505e2da96e0fd1b1c70f9 /src/java
parentbdf4d4148a983ed545ebe6c4eb18ce79eda7d207 (diff)
downloadxmlgraphics-fop-65ff8fa968cfbea583a779444ded2b343c498ee7.tar.gz
xmlgraphics-fop-65ff8fa968cfbea583a779444ded2b343c498ee7.zip
Fixed FindBugs warnings
git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@1330453 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src/java')
-rw-r--r--src/java/org/apache/fop/fo/properties/FontFamilyProperty.java30
-rw-r--r--src/java/org/apache/fop/fo/properties/SpaceProperty.java24
2 files changed, 24 insertions, 30 deletions
diff --git a/src/java/org/apache/fop/fo/properties/FontFamilyProperty.java b/src/java/org/apache/fop/fo/properties/FontFamilyProperty.java
index ff7619928..b59c22de6 100644
--- a/src/java/org/apache/fop/fo/properties/FontFamilyProperty.java
+++ b/src/java/org/apache/fop/fo/properties/FontFamilyProperty.java
@@ -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 extends ListProperty {
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 extends ListProperty {
}
}
- /** {@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;
- }
}
diff --git a/src/java/org/apache/fop/fo/properties/SpaceProperty.java b/src/java/org/apache/fop/fo/properties/SpaceProperty.java
index 641ec3baf..f7bdc60d7 100644
--- a/src/java/org/apache/fop/fo/properties/SpaceProperty.java
+++ b/src/java/org/apache/fop/fo/properties/SpaceProperty.java
@@ -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 LengthRangeProperty {
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);
+ }
+
}