jersey
  1. jersey
  2. JERSEY-2087

Cannot deserialize JSON to java.util.Map with Moxy JSON providers.

    Details

    • Type: Bug Bug
    • Status: Resolved
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 2.6
    • Component/s: None
    • Labels:
      None

      Description

      With Jackson I can deserialize JSON into a map:

      final Map result = response.readEntity(Map.class);
      

      With Moxy JSON support in jersey I get result = null. I have tried that with GenericType but it does not work neither.

      Jersey 1.x probably had support for this with Moxy.

        Activity

        Hide
        Adam Lindenthal added a comment -

        MOXy does not support root level maps yet - see MOXy issue 419169

        Also MOXyJsonProvider in the version we are using (2.5.0) does not perform the check for map (and also primitive types) in its isReadable and isWritable methods. The primitive types (and now also the check for maps added) are prevented from being written by our wrapping ConfigurableMoxyJsonProvider. This behaviour (for both primitives and maps) was fixed in MOXy 2.5.2 (see MOXy issue 417725).

        As Jersey was handling this problem relatively silently (low level - FINE - log message, that the exception was not mapped and that HTTP 500 response will be returned), some more obvious message was added for the specific case of missing usable message body provider.

        Log messages (SEVERE level) were added to WriterInterceptorExecutor and ReaderInterceptorExecutor if no usable MessageBodyReader / MessageBodyWriter was found.

        This also solved the same problem with Jettison.

        Show
        Adam Lindenthal added a comment - MOXy does not support root level maps yet - see MOXy issue 419169 Also MOXyJsonProvider in the version we are using (2.5.0) does not perform the check for map (and also primitive types) in its isReadable and isWritable methods. The primitive types (and now also the check for maps added) are prevented from being written by our wrapping ConfigurableMoxyJsonProvider . This behaviour (for both primitives and maps ) was fixed in MOXy 2.5.2 (see MOXy issue 417725 ). As Jersey was handling this problem relatively silently (low level - FINE - log message, that the exception was not mapped and that HTTP 500 response will be returned), some more obvious message was added for the specific case of missing usable message body provider. Log messages ( SEVERE level) were added to WriterInterceptorExecutor and ReaderInterceptorExecutor if no usable MessageBodyReader / MessageBodyWriter was found. This also solved the same problem with Jettison.

          People

          • Assignee:
            Adam Lindenthal
            Reporter:
            Miroslav Fuksa
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Time Tracking

              Estimated:
              Original Estimate - 30 minutes Original Estimate - 30 minutes
              30m
              Remaining:
              Remaining Estimate - 0 minutes
              0m
              Logged:
              Time Spent - 9 hours
              9h