Skip to content

Validation of references fails with lists #78

@pfhartma

Description

@pfhartma

During unmarshalling, Castor throws a validation error concerning unresolved id reference. This seems to be a false positive, as everything looks fine with lenient id validation enabled.

I've created a minimal example to demonstrate the issue:

example.zip

The problem seems to be, that the referenced object is located inside a list. The validator does not step into the list element and does not register the referenced object.


Castor Version: 1.4.1
Stack trace:

Exception in thread "main" org.exolab.castor.xml.MarshalException: ValidationException: ClassDescriptorResolver from context must not be null!{File: [not available]; line: 14; column: 12}
	at org.exolab.castor.xml.Unmarshaller.convertSAXExceptionToMarshalException(Unmarshaller.java:832)
	at org.exolab.castor.xml.Unmarshaller.unmarshal(Unmarshaller.java:703)
	at org.exolab.castor.xml.Unmarshaller.unmarshal(Unmarshaller.java:589)
	at de.CastorValidateTest.main(CastorValidateTest.java:96)
Caused by: ValidationException: ClassDescriptorResolver from context must not be null!
	at org.exolab.castor.xml.Validator.checkUnresolvedIdrefs(Validator.java:185)
	at org.exolab.castor.xml.EndElementProcessor.compute(EndElementProcessor.java:377)
	at org.exolab.castor.xml.UnmarshalHandler.endElement(UnmarshalHandler.java:473)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions