db-ojb-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Martin Kalén <mka...@apache.org>
Subject RemovalAwareCollection and clear()
Date Fri, 25 Feb 2005 20:48:23 GMT
  while running the test suite for OJB_1_0_RELEASE-branch with the 
patched Torque, I noticed that both oracle9 and hdqldb profiles were 
failing in one OTM test case, namely:


I think this test was written when ProductGroup was mapped to Article 
without proxy objects, and so on line 351 the test asserts that:
"size of all articles in product group = 0" after performing a 
clear()-call on the product group collection of articles.

Since the mapping is now using proxy objects, there will be a 
RemovalAwareCollection in place, which does _NOT_ overload the clear() 
call defined in java.util.Vector.

1. take a removal aware collection with size > 0
2. issue collection.clear()
3. check collection.size() and you will get a value > 0

To me this smells wrong. ;) RemovalAwareCollection extends 
java.util.Vector and should be bound by the same API contract, right?
A check with Sun (vector is no news so 1.3.1 will do):
"public void clear()

     Removes all of the elements from this Vector. The Vector will be 
empty after this call returns (unless it throws an exception)."

Not true for RAC as stated in the 1,2,3-example above.

If I add this to RAC:
      * @see java.util.Vector#clear()
     public void clear()

The elements will indeed be registered for removal when someone calls 
.clear(), but when I set a breakpoint in RAC#afterStore there is a call 
that effectively reverses this operation.

The comment says "make sure allObjectsToBeRemoved does not contain any 
instances that got re-added to the list". To me that does not compute, 
so I am a bit unsure how to go ahead with this...

Could someone that know how RAC and/or OTM _should_ work go ahead with this?


P.S. If anyone does make a change to RAC, please remove the TODO at line 
  50 since line 51 is already (as of 2003-04-09, r1.2) doing what the 
TODO says.

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

View raw message