db-torque-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Scott Eade <se...@backstagetech.com.au>
Subject Re: TRQS321: Criteria Serialization
Date Wed, 09 Nov 2005 13:51:14 GMT
Thomas Fischer wrote:

>I took a quick glance at the issue, and when I uncommented the test case
>you checked in and resolved an issue of visibility (use
>"Criteria.getNewCriterion()" instead of "new Criteria.Criterion"), the test
>case did not produce an error.
This is interesting.  What JVM are you using?  I am using J2SE 1.4.2_06
from Sun for Win32.

>Then I looked what the test case does, and it uses Criteria.equals(Object)
>to test whether the two criteria are equal. This is not enough, since
>Criteria.equals does not compare aliases and asColumns. There are two
>possibilities to remedy this:
>- The first is to change criteria.equals, which I did not want to do
>between release candidates, but if somebody else is of another opinion
>here,  we need to discuss it.
If equals() is performing its function correctly then this is IMO a bug
and most bugs warrant fixing - even between release candidates (though
preferably not between the last rc and the final release).
The test case is cloning the Criteria object using serialization - it
would only pick up this problem if the Criteria in use actually used
aliases or asColumns which it does not.
As I said earlier, this has been broken (at least for me) for a while, I
wouldn't hold off 3.2 for this issue as nobody spoke up earlier or felt
that it was worth investing their own time to fix (me included).

>- the second one is to write a custom comparison for the test case and
>remove it once Criteria.equals() is fixed. I admit I was too lazy to do it.
I certainly wouldn't bother doing this.  Note however that the problem
that is encountered is nothing to do with equals(), it is that the
"value" of the Criterion is incorrectly deserialized - the following
assertion (replace the last line in the test case) fails for me:
        junit.framework.AssertionFailedError: expected:<author> but

>So the question is how we should proceed. If you wish, I can check in the
>modified test case which runs for me, and then we can check whether it runs
>for you also.
>Then, I'm going to look at the old mails where the problem is described and
>see whether I can reproduce it. Maybe the problem has dissolved into thin
>air ??? (it is time for another miracle :-) )
According to Bloch (Effective Java Item 54) the default serialized form
of an inner class is ill-defined.  This could lead to varying behaviour
between different JVMs.  The answer may be to add custom serialization
code to Criterion.


Scott Eade
Backstage Technologies Pty. Ltd.

To unsubscribe, e-mail: torque-dev-unsubscribe@db.apache.org
For additional commands, e-mail: torque-dev-help@db.apache.org

View raw message