Uploaded image for project: 'Thorntail'
  1. Thorntail
  2. THORN-1529

Exception mapperfor JsonParseException is ignored

    Details

    • Story Points:
      5
    • Steps to Reproduce:
      Hide

      Steps to reproduce:

      git clone https://github.com/marchev/jackson-issue.git && cd jackson-issue
      mvn wildfly-swarm:run
      curl -H "Content-Type: application/json" -X POST -d '{ invalidJson }' -D - http://localhost:8080/echo
      

      Expected response:

      HTTP/1.1 400 Bad Request
      Connection: keep-alive
      Content-Type: application/json
      Content-Length: 191
      Date: Fri, 25 Aug 2017 11:08:40 GMT
      
      {"message":"Unexpected character ('i' (code 105)): was expecting double-quote to start field name\n at [Source: io.undertow.servlet.spec.ServletInputStreamImpl@10c56b01; line: 1, column: 4]"}
      

      Actual response:

      HTTP/1.1 400 Bad Request
      Connection: keep-alive
      Content-Type: text/plain
      Content-Length: 176
      Date: Fri, 25 Aug 2017 11:01:27 GMT
      
      Unexpected character ('i' (code 105)): was expecting double-quote to start field name
       at [Source: io.undertow.servlet.spec.ServletInputStreamImpl@3245820f; line: 1, column: 4]
      
      Show
      Steps to reproduce: git clone https: //github.com/marchev/jackson-issue.git && cd jackson-issue mvn wildfly-swarm:run curl -H "Content-Type: application/json" -X POST -d '{ invalidJson }' -D - http: //localhost:8080/echo Expected response: HTTP/1.1 400 Bad Request Connection: keep-alive Content-Type: application/json Content-Length: 191 Date: Fri, 25 Aug 2017 11:08:40 GMT { "message" : "Unexpected character ( 'i' (code 105)): was expecting double -quote to start field name\n at [Source: io.undertow.servlet.spec.ServletInputStreamImpl@10c56b01; line: 1, column: 4]" } Actual response: HTTP/1.1 400 Bad Request Connection: keep-alive Content-Type: text/plain Content-Length: 176 Date: Fri, 25 Aug 2017 11:01:27 GMT Unexpected character ( 'i' (code 105)): was expecting double -quote to start field name at [Source: io.undertow.servlet.spec.ServletInputStreamImpl@3245820f; line: 1, column: 4]

      Description

      Microprofile in Wildfly Swarm 2017.8.1 is shipped with com.fasterxml.jackson.jaxrs:jackson-jaxrs-json-provider:jar:2.7.4 which contains built-in exception mappers for JsonParseException and JsonMappingExceptionMapper annotated with @Provider. Those exception mappers are picked up by Resteasy's auto-scanning and thus custom exception mappers cannot be registered (https://github.com/fasterxml/jackson-jaxrs-providers/issues/22).

      This issue could be easily fixed by upgrading com.fasterxml.jackson.jaxrs:jackson-jaxrs-json-provider:jar to version 2.8.0+.

        Gliffy Diagrams

          Attachments

            Activity

              People

              • Assignee:
                juagonza Juan Gonzalez
                Reporter:
                marchev Martin Marchev
              • Votes:
                0 Vote for this issue
                Watchers:
                3 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: