castor
  1. castor
  2. CASTOR-1551

Mapping of a map with a nested map

    Details

    • Type: Bug Bug
    • Status: Closed Closed
    • Priority: Minor Minor
    • Resolution: Fixed
    • Affects Version/s: 1.0.2, 1.0.3
    • Fix Version/s: 1.0.4
    • Component/s: XML
    • Labels:
      None
    • Environment:
      Gentoo x86, Eclipse 3.2
    • Testcase included:
      yes
    • Number of attachments :
      5

      Description

      I tried to marshal the following map with a nested map:

      TreeMap<String, TreeMap<String, String>>

      The result is this exception:

      org.exolab.castor.mapping.MappingException: The return type for method public java.lang.Object org.exolab.castor.mapping.MapItem.getValue() does not match the declared field type java.util.Map
      at org.exolab.castor.mapping.loader.AbstractMappingLoader.findAccessor(AbstractMappingLoader.java:991)
      at org.exolab.castor.mapping.loader.AbstractMappingLoader.createFieldHandler(AbstractMappingLoader.java:744)
      at org.exolab.castor.mapping.loader.AbstractMappingLoader.createFieldDesc(AbstractMappingLoader.java:550)
      at org.exolab.castor.xml.XMLMappingLoader.createFieldDesc(XMLMappingLoader.java:371)
      at org.exolab.castor.mapping.loader.AbstractMappingLoader.createFieldDescs(AbstractMappingLoader.java:440)
      at org.exolab.castor.mapping.loader.AbstractMappingLoader.createDescriptor(AbstractMappingLoader.java:298)
      at org.exolab.castor.xml.XMLMappingLoader.createDescriptor(XMLMappingLoader.java:228)
      at org.exolab.castor.xml.XMLMappingLoader.createFieldDesc(XMLMappingLoader.java:483)
      at org.exolab.castor.mapping.loader.AbstractMappingLoader.createFieldDescs(AbstractMappingLoader.java:440)
      at org.exolab.castor.mapping.loader.AbstractMappingLoader.createDescriptor(AbstractMappingLoader.java:298)
      at org.exolab.castor.xml.XMLMappingLoader.createDescriptor(XMLMappingLoader.java:228)
      at org.exolab.castor.mapping.loader.AbstractMappingLoader.loadMappingInternal(AbstractMappingLoader.java:190)
      at org.exolab.castor.mapping.loader.AbstractMappingLoader2.loadMapping(AbstractMappingLoader2.java:140)
      at org.castor.mapping.MappingUnmarshaller.getMappingLoader(MappingUnmarshaller.java:132)
      at org.castor.mapping.MappingUnmarshaller.getMappingLoader(MappingUnmarshaller.java:99)
      at org.exolab.castor.xml.Marshaller.setMapping(Marshaller.java:565)
      at explorations.TreeMapWithTreeMap.testMarshalling(TreeMapWithTreeMap.java:48)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      at java.lang.reflect.Method.invoke(Method.java:585)
      at junit.framework.TestCase.runTest(TestCase.java:154)
      at junit.framework.TestCase.runBare(TestCase.java:127)
      at junit.framework.TestResult$1.protect(TestResult.java:106)
      at junit.framework.TestResult.runProtected(TestResult.java:124)
      at junit.framework.TestResult.run(TestResult.java:109)
      at junit.framework.TestCase.run(TestCase.java:118)
      at junit.framework.TestSuite.runTest(TestSuite.java:208)
      at junit.framework.TestSuite.run(TestSuite.java:203)
      at org.eclipse.jdt.internal.junit.runner.junit3.JUnit3TestReference.run(JUnit3TestReference.java:128)
      at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
      at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:460)
      at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:673)
      at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:386)
      at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196)

      1. patch_1551_20060924.txt
        106 kB
        Steven Dolg
      2. patch_1551_20060925.txt
        22 kB
        Steven Dolg
      3. patch.c1551.20060925.txt
        109 kB
        Werner Guttmann
      4. TreeMapWithTreeMap.java
        1 kB
        Ontje Lünsdorf
      5. TreeMapWithTreeMap.mapping
        0.9 kB
        Ontje Lünsdorf

        Issue Links

          Activity

          Hide
          Steven Dolg added a comment -

          As requested, a minimal patch containing the necessary changes only.
          Including the CTF tests from Werner.
          Relative to src.

          Show
          Steven Dolg added a comment - As requested, a minimal patch containing the necessary changes only. Including the CTF tests from Werner. Relative to src.
          Hide
          Werner Guttmann added a comment -

          FYI: had to change a statement in MapOfArrays.java to Arrays.toList(Object).toString(), as Arrays.toString(Object[]) has only beed added with Java 5.0. In other words, please make sure you use Java 1.4 when compiling and testing code.

          Show
          Werner Guttmann added a comment - FYI: had to change a statement in MapOfArrays.java to Arrays.toList(Object).toString(), as Arrays.toString(Object[]) has only beed added with Java 5.0. In other words, please make sure you use Java 1.4 when compiling and testing code.
          Hide
          Werner Guttmann added a comment -

          Patch committed as is (well, apart from the little Java 1.4 vs 5.0 issue .. ). I'd still appreciate any patch for the relevant XML HOW-TO ...

          Show
          Werner Guttmann added a comment - Patch committed as is (well, apart from the little Java 1.4 vs 5.0 issue .. ). I'd still appreciate any patch for the relevant XML HOW-TO .. .
          Hide
          Ralf Joachim added a comment -

          Thank you Steven for the additional work to pull out the necessary changes only into a separate patch.

          Steven or Werner, do one of you take care not to loose the great refactoring of AbstractMappingLoader included in the earlier patches or shell I take it?

          Show
          Ralf Joachim added a comment - Thank you Steven for the additional work to pull out the necessary changes only into a separate patch. Steven or Werner, do one of you take care not to loose the great refactoring of AbstractMappingLoader included in the earlier patches or shell I take it?
          Hide
          Werner Guttmann added a comment -

          Ralf, I guess (hope) Steven will provide us with a new patch for the AbstractMappingLoader, which I shall take care fo once he's provided it .. .

          Show
          Werner Guttmann added a comment - Ralf, I guess ( hope ) Steven will provide us with a new patch for the AbstractMappingLoader, which I shall take care fo once he's provided it .. .

            People

            • Assignee:
              Steven Dolg
              Reporter:
              Ontje Lünsdorf
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: