castor
  1. castor
  2. CASTOR-3135

Exception occurs during unmarshaling, when both idresolver is present and validation is set to true.

    Details

    • Type: Bug Bug
    • Status: Open Open
    • Priority: Major Major
    • Resolution: Unresolved
    • Affects Version/s: 1.3.2
    • Fix Version/s: 1.3.4
    • Component/s: XML
    • Labels:
      None
    • Environment:
      Windows, Java 1.6
    • Testcase included:
      yes
    • Number of attachments :
      2

      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.

      1. CASTOR-3135.patch
        46 kB
        Jakub Narloch
      2. Castor-3135-fix.patch
        5 kB
        Jakub Narloch

        Issue Links

          Activity

            People

            • Assignee:
              Werner Guttmann
              Reporter:
              Jakub Narloch
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated: