Details
Description
An exception occurs when trying to unmarshall xml, when both validation is set to true and an idresolver is registered for the unmarshaller. Disabling the validation will cause the xml to be correctly unmarshalled.
Sample code that will cause an error:
Unmarshaller unmarshaller = createUnmarsahllerFromMapping(LIBRARY_MAPPING_FILE);
unmarshaller.setValidation(true);
unmarshaller.setIDResolver(idResolver);
Object result = unmarshal(unmarshaller, ID_REF_INPUT_STRING);
Stack trace:
org.exolab.castor.xml.MarshalException: ValidationException: ClassDescriptorResolver from context must not be null!{File: [not available]; line: 1; column: 272}
at org.exolab.castor.xml.Unmarshaller.convertSAXExceptionToMarshalException(Unmarshaller.java:873)
at org.exolab.castor.xml.Unmarshaller.unmarshal(Unmarshaller.java:770)
at org.exolab.castor.xml.Unmarshaller.unmarshal(Unmarshaller.java:636)
at org.exolab.castor.xml.TestUnmarshaller.unmarshal(TestUnmarshaller.java:600)
at org.exolab.castor.xml.TestUnmarshaller.testIDResolver(TestUnmarshaller.java:533)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
Atached patch will failing test.
Issue Links
- is related to
-
CASTOR-3133
XML Marshaller and Unmarshaller tests
-