Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Presence of PropertyNamingStrategy Makes Deserialization Fail #815

Closed
gilbode opened this issue Jun 4, 2015 · 5 comments
Closed

Presence of PropertyNamingStrategy Makes Deserialization Fail #815

gilbode opened this issue Jun 4, 2015 · 5 comments
Milestone

Comments

@gilbode
Copy link

gilbode commented Jun 4, 2015

I originally came across this issue using Dropwizard - dropwizard/dropwizard#1095. But it looks like this is a Jackson issue. Here's the rerproducer:

public class TestPropertyNamingStrategyIssue {
  public static class ClassWithObjectNodeField {
    public String id;
    public ObjectNode json;
  }

  @Test
  public void reproducer() throws Exception {
    ObjectMapper mapper = new ObjectMapper();
    mapper.setPropertyNamingStrategy(PropertyNamingStrategy.LOWER_CASE);
    ClassWithObjectNodeField deserialized =
        mapper.readValue(
            "{ \"id\": \"1\", \"json\": { \"foo\": \"bar\", \"baz\": \"bing\" } }",
            ClassWithObjectNodeField.class);
  }
}

Looks like the presence of any PropertyNamingStrategy make deserialization to ObjectNode fail. This works fine if I remove the property naming strategy.

@cowtowncoder
Copy link
Member

Sounds like a problem. Which version of Jackson are you using? If possible, can you try it with 2.5.3, if not yet using that (DW baseline is 2.5.1 or so I think). There have been some fixes related to handling of JsonNode deserialization, although I don't recall issues with naming strategy.

@gilbode
Copy link
Author

gilbode commented Jun 4, 2015

We're using Jackson 2.5.3 (newer than the DW baseline) and the issue still exists.

@cowtowncoder
Copy link
Member

Ok thank you for confirming this.

@cowtowncoder
Copy link
Member

Interesting. Yes, it's bit tricky. I can patch 2.5.x by adding an annotation, but there is the bigger problem (to be tackled for 2.6) with reporting potential problems before they would be actual problem. We have observed this in some other cases already. But fix for that is bit more invasive, hence will do that for master.

@cowtowncoder
Copy link
Member

The only open question is why does the naming convention trigger this problem. Oh well, mystery for another day. :)

Fix will be in 2.5.4.

@cowtowncoder cowtowncoder added this to the 2.5.4 milestone Jun 5, 2015
cowtowncoder added a commit that referenced this issue Jun 5, 2015
… annotation from ObjectNode); also need to move #636 fix along since it will be triggered at bit later point.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants