Matthias,

mind attaching this to the issue as well ?

Werner

Matthias Epheser wrote:
Werner Guttmann schrieb:
Matthias,

can you please have a look at

http://jira.codehaus.org/browse/CASTOR-2035

and my comments at the bottom in particular ? I have attached a JUnit test case to the issue that clearly shows that with the mapping/classes provided, there's a ClassCastException occurring .. :-(.

Any feedback appreciated.

I just debugged your junit test, and you are right, the cast to String is the problem in this particular case. But I don't think just chanching the String to Object in IDRefValidator does the trick.

I'm trying to get the big picture, let me just tell you my first unstructured thoughts, maybe we find a solution together:

- the IDValidator is only used with XSId. XSId maps to java.lang.String. So the IDValidator extends StringValidator, it evens throws a validation exception if the given object is no string.

-the id*REF*validator just implements TypeValidator, as XSIDREF refers to java.lang.Object

- looking at their behavior, it only makes sense to use them together: idrefvalidator puts unresolved ids into a collection, idvalidator takes occuring ids out of this collection. if the collections is empty in the end -> everything is fine

- in our case - just marshalling with a mapping file, without descriptor classses - we have a strange situation: The XmlClassDescriptors describing the objects are created dynamicaly and they create the following:

* Class A:
    FieldDescriptor for "aid" with a FieldValidator (no IDValidator)
* Class B:
    FieldDescriptor for "aRef" with a FV WITH IDRefValidator

So attribute A.aId is treated as normal field (not as id), but B.aref is treated as IDREF.

- But it makes no sense to use the idrefvalidator without a idvalidator. Being nosy, I changed the String cast in idrefvalidator into object, and our testcase succeeds. So the final "are-there-unreferenced-ids-left-check" is not performed.

- I'm currently debugging the whole validation process during this test, I need to know more about the dynamic creation of the FieldDescriptors.

This is a dump of my first unstructured impressions, I'll try to look more deeply into the FieldDescriptor creation now to give more reasonable feedback.

Regards
Matthias






---------------------------------------------------------------------
To unsubscribe from this list please visit:

   http://xircles.codehaus.org/manage_email




---------------------------------------------------------------------
To unsubscribe from this list please visit:

   http://xircles.codehaus.org/manage_email

Reply via email to