From: markt Date: Sat, 16 Jan 2010 13:54:04 +0000 (+0000) Subject: TCK failure: Can't use the string representation to test for equality as whitespace... X-Git-Url: https://git.internetallee.de/?a=commitdiff_plain;h=576b8f669edbdeed0c9a761e965895383f398d01;p=tomcat7.0 TCK failure: Can't use the string representation to test for equality as whitespace must be ignored. Use the parsed nodes instead. git-svn-id: https://svn.apache.org/repos/asf/tomcat/trunk@899949 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/java/org/apache/el/ValueExpressionImpl.java b/java/org/apache/el/ValueExpressionImpl.java index 0fd2a7791..a511db7db 100644 --- a/java/org/apache/el/ValueExpressionImpl.java +++ b/java/org/apache/el/ValueExpressionImpl.java @@ -203,7 +203,7 @@ public final class ValueExpressionImpl extends ValueExpression implements */ @Override public int hashCode() { - return this.expr.hashCode(); + return this.getNode().hashCode(); } /* diff --git a/java/org/apache/el/parser/SimpleNode.java b/java/org/apache/el/parser/SimpleNode.java index 747fcc358..07824d7bd 100644 --- a/java/org/apache/el/parser/SimpleNode.java +++ b/java/org/apache/el/parser/SimpleNode.java @@ -18,6 +18,8 @@ package org.apache.el.parser; +import java.util.Arrays; + import javax.el.ELException; import javax.el.MethodInfo; import javax.el.PropertyNotWritableException; @@ -164,6 +166,45 @@ public abstract class SimpleNode extends ELSupport implements Node { throw new UnsupportedOperationException(); } + + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + Arrays.hashCode(children); + result = prime * result + id; + result = prime * result + ((image == null) ? 0 : image.hashCode()); + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) { + return true; + } + if (obj == null) { + return false; + } + if (!(obj instanceof SimpleNode)) { + return false; + } + SimpleNode other = (SimpleNode) obj; + if (!Arrays.equals(children, other.children)) { + return false; + } + if (id != other.id) { + return false; + } + if (image == null) { + if (other.image != null) { + return false; + } + } else if (!image.equals(other.image)) { + return false; + } + return true; + } + /** * @since EL 2.2 */