On Wed, Mar 5, 2008 at 9:56 PM, Dale Newfield <[EMAIL PROTECTED]> wrote:
> Chris Pratt wrote:
>  > <!-- Equals(): <s:property
>  > value='%{originalMember.name.equals(currentMember.name)}'/> -->
>
>  Just to be pedantic, can you also verify that:
>
>  <!-- Equals(): <s:property
>  value='%{currentMember.name.equals(originalMember.name)}'/> -->
>
>  yields:
>
>  <!-- Equals(): true -->
>
>  ?
>  All correctly implemented equals methods are symmetric, so in the event
>  OGNL decides that neither of these are null and that it should call the
>  equals() method, it could theoretically do so in either order.  If the
>  reversed order (above) throws an exception then that would explain the
>  observed output.

Yup, running:

<!-- Original: "<s:property value='%{originalMember.name}'/>" -->
<!-- Current:  "<s:property value='%{currentMember.name}'/>" -->
<!-- Equals(): <s:property
value='%{originalMember.name.equals(currentMember.name)}'/> -->
<!-- Equals(): <s:property
value='%{CurrentMember.name.equals(originalMember.name)}'/> -->
<!-- Equals:   <s:property value='%{originalMember.name ==
currentMember.name}'/> -->


Yields:

<!-- Original: "CHRIS PRATT" -->
<!-- Current:  "CHRIS PRATT" -->
<!-- Equals(): true -->
<!-- Equals(): true -->
<!-- Equals:    -->


>
>  Assuming that's not it, I'd suggest instrumenting your model to log when
>  the equals and getName methods are called so you can verify it's making
>  the calls you expect.

I added some instrumentation and it appears that OGNL is not calling
the equals method when I use the == operator, only when I explicitly
call .equals().

>
>  I agree it does seem strange.
>  Also:  Which version of ognl are you using?
>

I'm using the one that comes with 2.0.11.1 (and I've seen this on
2.0.11 also), I believe the jar file is ognl-2.6.11.jar
  (*Chris*)

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to