Closed GoogleCodeExporter closed 9 years ago
Yes, it a bug. It seams that JsonObjectMapper.registerModule has to be called
each time the inner module object is changed (using setSerializers or
setDeserializers methods)
Original comment by ragno...@gmail.com
on 5 Feb 2014 at 7:03
I've used your gist and updated JsonTranscoderTest. The test was extended to
cover also custom deserializers. There is important concept that to deserialize
object a correct deserializer has to be selected. It is achieved by including
object type into serialized string. Because an object type (full java class
name) can be long an abbreviation can be registered.
If you are interested in above features in JsonTranscoderTest you'll find
examples.
Original comment by ragno...@gmail.com
on 5 Feb 2014 at 7:57
Fix in trunk
Original comment by ragno...@gmail.com
on 5 Feb 2014 at 7:58
Thanks. I just wanted to setup a very basic sample. Your test code is very well
and I liked it very much.
By the way, have you ever considered to move this project over Github? It can
gain more traction and would be easier to be contributed.
Original comment by cemalettin.koc@gmail.com
on 5 Feb 2014 at 8:05
If you are interested in contributing to SSM then I'll think about moving to
Github. The only thing that keeping me here (on Google code) is the 'Download'
section.
Original comment by ragno...@gmail.com
on 5 Feb 2014 at 8:34
I am not familiar memcache protocol but I will try to do my best.
Maybe you missed, there is a new feature at Github. See the details here:
https://github.com/blog/1547-release-your-software
Is this enough for you?
Original comment by cemalettin.koc@gmail.com
on 5 Feb 2014 at 9:21
Detail knowledge about memcache protocol is not required because it is handled
by underlying providers: spymemcached or xmemcached. SSM never talks 'directly'
to memcached server.
Yes, I think the release feature on github is enough. Next week I'll try to
move the project.
BTW there is nothing more that keeps me on Google code, a few days ago the
'Downloads' section was disabled by Google so new artifacts cannot be added.
It's high time to move to github.
Original comment by ragno...@gmail.com
on 6 Feb 2014 at 6:28
https://gist.github.com/cemo/1460e0080d91d5550eb2
Is this also a bug?
Original comment by cemalettin.koc@gmail.com
on 6 Feb 2014 at 9:48
Unfortunately until next Monday I won't be able to execute, check and fix it.
What is the result? How does the Jackson serialize this list of Points?
Original comment by ragno...@gmail.com
on 6 Feb 2014 at 9:57
Serialization is ok but Deserialization raising an error. Here is the details:
java.lang.RuntimeException:
com.fasterxml.jackson.databind.JsonMappingException: Can not deserialize
instance of java.lang.Object out of END_OBJECT token
at [Source: java.io.ByteArrayInputStream@69ce31e; line: 1, column: 52] (through reference chain: com.google.code.ssm.json.Holder["v"])
at com.google.code.ssm.transcoders.JsonTranscoder.decode(JsonTranscoder.java:80)
at com.google.code.ssm.transcoders.JsonTranscoderTest.testEncodeAndDecodeWithCustomSerializerAndDeserializerWithTypeInfoInsideAndShorterClassIdentifierList(JsonTranscoderTest.java:190)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:47)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:44)
at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:271)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:70)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:50)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:238)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:63)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:236)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:53)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:229)
at org.junit.runners.ParentRunner.run(ParentRunner.java:309)
at org.junit.runner.JUnitCore.run(JUnitCore.java:160)
at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:74)
at com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:202)
at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:65)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at com.intellij.rt.execution.application.AppMain.main(AppMain.java:120)
Caused by: com.fasterxml.jackson.databind.JsonMappingException: Can not
deserialize instance of java.lang.Object out of END_OBJECT token
at [Source: java.io.ByteArrayInputStream@69ce31e; line: 1, column: 52] (through reference chain: com.google.code.ssm.json.Holder["v"])
at com.fasterxml.jackson.databind.JsonMappingException.from(JsonMappingException.java:164)
at com.fasterxml.jackson.databind.DeserializationContext.mappingException(DeserializationContext.java:691)
at com.fasterxml.jackson.databind.DeserializationContext.mappingException(DeserializationContext.java:685)
at com.fasterxml.jackson.databind.deser.std.UntypedObjectDeserializer.deserializeWithType(UntypedObjectDeserializer.java:283)
at com.fasterxml.jackson.databind.deser.std.CollectionDeserializer.deserialize(CollectionDeserializer.java:229)
at com.fasterxml.jackson.databind.deser.std.CollectionDeserializer.deserialize(CollectionDeserializer.java:204)
at com.fasterxml.jackson.databind.deser.std.CollectionDeserializer.deserialize(CollectionDeserializer.java:23)
at com.fasterxml.jackson.databind.jsontype.impl.AsWrapperTypeDeserializer._deserialize(AsWrapperTypeDeserializer.java:126)
at com.fasterxml.jackson.databind.jsontype.impl.AsWrapperTypeDeserializer.deserializeTypedFromAny(AsWrapperTypeDeserializer.java:78)
at com.fasterxml.jackson.databind.deser.std.UntypedObjectDeserializer.deserializeWithType(UntypedObjectDeserializer.java:238)
at com.fasterxml.jackson.databind.deser.SettableBeanProperty.deserialize(SettableBeanProperty.java:523)
at com.fasterxml.jackson.databind.deser.impl.MethodProperty.deserializeAndSet(MethodProperty.java:99)
at com.fasterxml.jackson.databind.deser.BeanDeserializer.vanillaDeserialize(BeanDeserializer.java:242)
at com.fasterxml.jackson.databind.deser.BeanDeserializer.deserialize(BeanDeserializer.java:118)
at com.fasterxml.jackson.databind.ObjectMapper._readMapAndClose(ObjectMapper.java:2993)
at com.fasterxml.jackson.databind.ObjectMapper.readValue(ObjectMapper.java:2144)
at com.google.code.ssm.transcoders.JsonTranscoder.decode(JsonTranscoder.java:77)
... 27 more
Original comment by cemalettin.koc@gmail.com
on 6 Feb 2014 at 10:00
My bad, this point deserialization is wrong because doesn't read all data (the
'}' is not read from stream). Change it to below and check:
static class PointDeserializer extends JsonDeserializer<Point> {
@Override
public Point deserialize(final JsonParser jp, final DeserializationContext ctxt) throws IOException, JsonProcessingException {
jp.nextToken();
String value = jp.nextTextValue();
jp.nextToken();
String[] parts = value.split("x");
return new Point(Integer.valueOf(parts[0]), Integer.valueOf(parts[1]));
}
}
Original comment by ragno...@gmail.com
on 6 Feb 2014 at 10:08
Ok It fixed.
Original comment by cemalettin.koc@gmail.com
on 6 Feb 2014 at 11:02
Original comment by ragno...@gmail.com
on 13 Feb 2014 at 8:41
I've just moved SSM to github:
https://github.com/ragnor/simple-spring-memcached. Currently source code and
issue tracker were moved.
Please use github to report new issues.
Original comment by ragno...@gmail.com
on 19 Feb 2014 at 9:48
This issue has been moved to github:
https://github.com/ragnor/simple-spring-memcached/issues/29
Original comment by ragno...@gmail.com
on 24 Feb 2014 at 5:51
Original comment by ragno...@gmail.com
on 1 Apr 2014 at 7:26
Original issue reported on code.google.com by
cemalettin.koc@gmail.com
on 5 Feb 2014 at 2:02