Menu

#50 Unable to map to SortedSet

closed
None
5
2014-08-21
2006-08-11
Peter Monks
No

If the target of a collection mapping is a
java.util.SortedSet Dozer fails with the following
exception:

net.sf.dozer.util.mapping.MappingException:
java.lang.IllegalArgumentException: argument type mismatch
at
net.sf.dozer.util.mapping.propertydescriptor.BruteForcePropertyDescriptor.setPropertyValue(BruteForcePropertyDescriptor.java:94)
at
net.sf.dozer.util.mapping.fieldmap.FieldMap.writeDestinationValue(FieldMap.java:119)
at
net.sf.dozer.util.mapping.MappingProcessor.writeDestinationValue(MappingProcessor.java:936)
at
net.sf.dozer.util.mapping.MappingProcessor.mapFromFieldMap(MappingProcessor.java:349)
at
net.sf.dozer.util.mapping.MappingProcessor.mapField(MappingProcessor.java:299)
at
net.sf.dozer.util.mapping.MappingProcessor.map(MappingProcessor.java:242)
at
net.sf.dozer.util.mapping.MappingProcessor.map(MappingProcessor.java:129)
at
net.sf.dozer.util.mapping.MappingProcessor.map(MappingProcessor.java:108)
at
net.sf.dozer.util.mapping.DozerBeanMapper.map(DozerBeanMapper.java:100)
at
net.pmonks.dozer.test.DozerTest.testArrayToSortedSet(DozerTest.java:32)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native
Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown
Source)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown
Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at junit.framework.TestCase.runTest(TestCase.java:164)
at junit.framework.TestCase.runBare(TestCase.java:130)
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:120)
at junit.framework.TestSuite.runTest(TestSuite.java:230)
at junit.framework.TestSuite.run(TestSuite.java:225)
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)
Caused by: java.lang.IllegalArgumentException: argument
type mismatch
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native
Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown
Source)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown
Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at
net.sf.dozer.util.mapping.propertydescriptor.BruteForcePropertyDescriptor.setPropertyValue(BruteForcePropertyDescriptor.java:85)
... 27 more

Dozer should support SortedSets since they're used
quite frequently in Hibernate POJOs.

The attached JUnit test case demonstrates this behaviour.

Discussion

  • Peter Monks

    Peter Monks - 2006-08-11

    JUnit Test demonstrating Dozer behaviour with SortedSets

     
  • Matt Tierney

    Matt Tierney - 2006-08-12
    • assigned_to: nobody --> mhtierney
    • status: open --> closed
     
  • Matt Tierney

    Matt Tierney - 2006-08-12

    Logged In: YES
    user_id=1236069

    Added support for SortedSet subinterface

     
  • Matt Tierney

    Matt Tierney - 2006-08-12
    • status: closed --> pending
     
  • Matt Tierney

    Matt Tierney - 2006-09-02
    • status: pending --> closed
     

Log in to post a comment.