-
Notifications
You must be signed in to change notification settings - Fork 21
Cannot customize String deserialization behavior #59
Comments
Since one major area of optimizations Afterburner does is to "inline" handling of simple datatypes, including Strings, it is possible that override is accidentally removing part of customized handling. If you could provide a complete test case (like unit test), it should be easy for me to figure out a way to fix this (based on similar problems solved earlier). |
I was originally on jackson/afterburner 2.4.2, saw this issue, bumped to 2.6.2, issue remained. So yes, 2.6.2. Complete repro JUnit test:
I demonstrated by commenting out the line configuring the AfterburnerModule, after which it passed. As written, it fails. |
Ok I can reproduce this. Looks like the existing test for non-standard deserializers was only using per-property annotations, not central registration, which is why it did not fail. Unfortunately this may be a tricky thing to resolve because the code that adds optimized handlers does not have access to |
I can't tell. I don't see any changes you made to fix this, but the issue is marked as closed. Was that just a side effect of your commit message? |
Hmmh, odd. I did not mean to (or think I did) close it... it is definitely an issue that needs to be solved. |
Found a way to fix this; not optimal but appears to work. Also fixed a related problem for deserializers. In both cases the issue is that serializer/deserializer is associated at a later point, not during construction (unlike with direct annotations), and needs to be handled after the fact. |
Great. Thanks! |
I have a use case where we use CharacterEscapes to encode a few characters serialized with Jackson. The other side of the coin is that we've long used a simple JsonDeserializer to unencode these same characters. Basically, the intent being that by making an RO into JSON, then converting the JSON back into the RO, there's no changes that occur during the round trip.
Let's be more specific. I want to get the following test to pass. Is there any way that I can accomplish this?
Both the JsonDeserializer I have configured (implementing
public String deserialize(JsonParser parser, DeserializationContext context) throws IOException
) and the StdValueInstantiator I have configured (implementingpublic Object createFromString(DeserializationContext ctxt, String value) throws IOException
) pass the strings through a method which does, basicallyreturn Pattern.compile("&").matcher(string).replaceAll("&");
.Without afterburner, this test passes. With, it fails. Any ideas?
The text was updated successfully, but these errors were encountered: