Mark Struberg created JOHNZON-144:
-------------------------------------

             Summary: Using a @JohnzonConverter with Jsonb leads to an Exception
                 Key: JOHNZON-144
                 URL: https://issues.apache.org/jira/browse/JOHNZON-144
             Project: Johnzon
          Issue Type: Bug
          Components: JSON-B
    Affects Versions: 1.1.5
            Reporter: Mark Struberg
             Fix For: 1.1.5


Converting a class which has a @JohnzonConverter annotation via Jsonb leads to 
a ClassCast exception:

{noformat}
java.lang.ClassCastException: 
org.apache.johnzon.jsonb.JohnzonConverterInJsonbTest$TestInstantConverter 
cannot be cast to org.apache.johnzon.mapper.ObjectConverter$Writer

        at 
org.apache.johnzon.jsonb.JsonbAccessMode$WriterConverters.<init>(JsonbAccessMode.java:773)
        at 
org.apache.johnzon.jsonb.JsonbAccessMode.findReaders(JsonbAccessMode.java:405)
        at 
org.apache.johnzon.mapper.Mappings.createClassMapping(Mappings.java:365)
        at 
org.apache.johnzon.mapper.Mappings.findOrCreateClassMapping(Mappings.java:338)
        at 
org.apache.johnzon.mapper.Mapper.isDeduplicateObjects(Mapper.java:138)
        at org.apache.johnzon.mapper.Mapper.writeObject(Mapper.java:132)
        at org.apache.johnzon.mapper.Mapper.writeObjectAsString(Mapper.java:193)
        at org.apache.johnzon.jsonb.JohnzonJsonb.toJson(JohnzonJsonb.java:216)
        at 
org.apache.johnzon.jsonb.JohnzonConverterInJsonbTest.testJohnzonConverter(JohnzonConverterInJsonbTest.java:43)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at 
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:498)
        at 
org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)
        at 
org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
        at 
org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)
        at 
org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
        at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325)
        at 
org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78)
        at 
org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57)
        at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
        at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
        at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
        at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
        at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
        at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
        at org.junit.runner.JUnitCore.run(JUnitCore.java:137)
        at 
com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:68)
        at 
com.intellij.rt.execution.junit.IdeaTestRunner$Repeater.startRunnerWithArgs(IdeaTestRunner.java:47)
        at 
com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:242)
        at 
com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:70)
{noformat}

In older Johnzon version the Converter simply got ignored. 
We now try to pick up the Converter but seem to mess up this part due to our 
work on JOHNZON-77.



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

Reply via email to