Author: remy.maucherat(a)jboss.com
Date: 2009-11-09 10:24:30 -0500 (Mon, 09 Nov 2009)
New Revision: 1257
Modified:
trunk/java/org/apache/el/ValueExpressionImpl.java
Log:
- Proper comparable representation.
Modified: trunk/java/org/apache/el/ValueExpressionImpl.java
===================================================================
--- trunk/java/org/apache/el/ValueExpressionImpl.java 2009-11-09 04:36:50 UTC (rev 1256)
+++ trunk/java/org/apache/el/ValueExpressionImpl.java 2009-11-09 15:24:30 UTC (rev 1257)
@@ -197,16 +197,22 @@
* @see java.lang.Object#hashCode()
*/
public int hashCode() {
- StringBuilder hash = new StringBuilder(getNode().toString());
- for (int i = 0; i < getNode().jjtGetNumChildren(); i++) {
- Node child = getNode().jjtGetChild(i);
- String childToString = child.toString();
- if (childToString != null) {
- hash.append('[').append(childToString).append(']');
- }
- }
+ StringBuilder hash = new StringBuilder();
+ comparableRepresentation(hash, getNode());
return hash.toString().hashCode();
}
+
+ private void comparableRepresentation(StringBuilder string, Node node) {
+ if (node.toString() != null) {
+ string.append(node.toString());
+ }
+ for (int i = 0; i < node.jjtGetNumChildren(); i++) {
+ Node child = node.jjtGetChild(i);
+ string.append('[');
+ comparableRepresentation(string, child);
+ string.append(']');
+ }
+ }
/*
* (non-Javadoc)
@@ -267,7 +273,6 @@
}
public ValueReference getValueReference(ELContext context) {
- System.out.println("Node: " + this.getNode() + " Image: " +
this.getNode().getImage());
EvaluationContext ctx = new EvaluationContext(context, this.fnMapper,
this.varMapper);
return this.getNode().getValueReference(ctx);
Show replies by date