From: Andreas L. Delmelle Date: Sat, 23 Dec 2006 12:00:42 +0000 (+0000) Subject: Slight improvement of the check in equals(); make sure String.equals() gets called... X-Git-Tag: fop-0_94~269 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=c82ad5735d15d094a084039f537a5d034c30d308;p=xmlgraphics-fop.git Slight improvement of the check in equals(); make sure String.equals() gets called only as a last resort (for non-canonical Strings) git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@489886 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/src/java/org/apache/fop/fo/properties/EnumProperty.java b/src/java/org/apache/fop/fo/properties/EnumProperty.java index 93dab72e2..a2d3728b5 100644 --- a/src/java/org/apache/fop/fo/properties/EnumProperty.java +++ b/src/java/org/apache/fop/fo/properties/EnumProperty.java @@ -100,16 +100,20 @@ public class EnumProperty extends Property { /** * @return this.value cast as an Object */ - public Object getObject() { + protected Object getObject() { return text; } + /** + * @see java.lang.Object#equals(Object) + */ public boolean equals(Object obj) { if (obj instanceof EnumProperty) { EnumProperty ep = (EnumProperty)obj; - return ep.value == this.value && - ((ep.text == null && this.text == null) - || ep.text.equals(this.text)); + return (ep.value == this.value) + && ((ep.text == this.text) + || (ep.text != null + && ep.text.equals(this.text))); } else { return false; }