Uploaded image for project: 'RESTEasy'
  1. RESTEasy
  2. RESTEASY-1290

Missing value in String format when parsing enums in query param

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • Minor
    • 3.7.0.Final
    • 3.0.14.Final, 3.6.2.Final
    • None
    • None

    Description

      Create a Resource with a Method that has a query parameter that is an Enum.
      Call that method and for the enum, pass an invalid value (one that isn't an existing value for this enum).

      A NotFoundException will be thrown with the following error message:

      RESTEASY003870: Unable to extract parameter from http request: javax.ws.rs.QueryParam("your_enum_param") value is {1} for <your_method>
      

      Where "your_enum_param" is your Query Parameter and <your_method> is the Resource's Method.

      The main issue here is that

      {1}

      does not contain the invalid value. This seems like a String format error.

      Another issue is that this results in a NotFoundException. I would have expected a more specific exception that would have allowed me to return a more interesting error message. I'd love to have the value passed and the Class<> of the enum that was requested. This would allow me to return a message saying "Value X for parameter Y is not valid. Valid values are: A,B,C".

      Attachments

        Issue Links

          Activity

            People

              pjurak Petr Jurak (Inactive)
              GuiSim Gui Sim (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: