#277 DateFormat instantiation fails

Dozer v5.3.0
closed-fixed
5
2010-09-03
2010-09-02
No

When you get instance of a DateFormat field it returns a SimpleDateFormat object which is an instanceof DateFormat. When trying to map this instamtiation will fail. This is from a test where there was no conversion, simple DateFormat from one object to the next.

Sep 2, 2010 4:43:39 PM org.dozer.MappingProcessor mapField
SEVERE: Field mapping error -->
MapId: null
Type: null
Source parent class: com.stw.ws.test.TestCustConvXMLGCIObject
Source field name: dateFormat
Source field type: class java.text.SimpleDateFormat
Source field value: java.text.SimpleDateFormat@f85ae543
Dest parent class: com.stw.ws.test.TestCustConvXMLGCIObjectPrime
Dest field name: dateFormat
Dest field type: java.text.DateFormat
org.dozer.MappingException: java.lang.InstantiationException
at org.dozer.util.MappingUtils.throwMappingException(MappingUtils.java:88)
at org.dozer.factory.ConstructionStrategies$ByConstructor.newInstance(ConstructionStrategies.java:252)
at org.dozer.factory.ConstructionStrategies$ByConstructor.create(ConstructionStrategies.java:217)
at org.dozer.factory.DestBeanCreator.create(DestBeanCreator.java:66)
at org.dozer.MappingProcessor.mapCustomObject(MappingProcessor.java:453)
at org.dozer.MappingProcessor.mapOrRecurseObject(MappingProcessor.java:423)
at org.dozer.MappingProcessor.mapFromFieldMap(MappingProcessor.java:320)
at org.dozer.MappingProcessor.mapField(MappingProcessor.java:266)
at org.dozer.MappingProcessor.map(MappingProcessor.java:235)
at org.dozer.MappingProcessor.map(MappingProcessor.java:179)
at org.dozer.MappingProcessor.map(MappingProcessor.java:124)
at org.dozer.MappingProcessor.map(MappingProcessor.java:119)
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:597)
at org.dozer.stats.StatisticsInterceptor.invoke(StatisticsInterceptor.java:43)
at $Proxy5.map(Unknown Source)
at org.dozer.DozerBeanMapper.map(DozerBeanMapper.java:92)
at com.stw.test.main.CustomXMLGCIConverterMappingTest.testCustomXMLGCIConverterMapping(CustomXMLGCIConverterMappingTest.java:76)
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:597)
at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:44)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)
at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:41)
at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:20)
at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:28)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:76)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:50)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:193)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:52)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:191)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:42)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:184)
at org.junit.runners.ParentRunner.run(ParentRunner.java:236)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:46)
at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)

Discussion

  • dmitry (lv)

    dmitry (lv) - 2010-09-03

    Closed in trunk. Getting DateFormat using getInstance now.

     
  • dmitry (lv)

    dmitry (lv) - 2010-09-03
    • milestone: 1129554 --> Dozer v5.3.0
    • assigned_to: nobody --> buzdin
    • status: open --> closed-fixed
     

Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:





No, thanks