users@jaxb.java.net

Bug in valdiator cycle detection?

From: Jonathan Emmett <jonathan.emmett_at_cloakware.com>
Date: Thu, 05 Feb 2004 10:18:26 -0500

Hi,

It seems that on-demand validation can be a little overzealous in
detecting cycles in the context tree. Specifically adding the same
object more than once in the context tree causes validation errors, even
if there is no actual cycle (the two objects appear at the same level,
not nested). It seems that cycles are detected by adding objects to a
map and looking in that map to determine if the object has already been
found. However, objects never appear to be removed from this map, so
adding the same object multiple times triggers the cycle detection.
This can be reproduced easily with any collection type that holds
complex types:

someObject.getList().add(foo);
someObject.getList().add(foo);

Where "foo" is an instance of some complex type.

I realize that upon unmarshalling I will get distinct objects with the
same contents in the list, but this was just a convenient shortcut for
us to take (as opposed to cloning foo before adding it a second time).
Is this a bug in the validator, or is this behaving as designed?

I filed a bug report on this on the java bug parade in November when I
first discovered it, worked around it, then forgot all about it.
Recently I've been caught by it again and the bug report seems to have
disappeared from the database, so my apologies if this has been handled
before. If it actually is a bug I can open an issue with example code.

Thanks,

-- 
Jonathan Emmett
Cloakware Corporation -- http://www.cloakware.com
"secure software ... from the inside out"
jonathan.emmett_at_cloakware.com 1-613-271-9446 x237
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe_at_jaxb.dev.java.net
For additional commands, e-mail: users-help_at_jaxb.dev.java.net