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

@RegisterProvider does not honor priority from @Priority

XMLWordPrintable

      When using MP Rest Client @RegisterProvider, the priority parameter states:

      the priority of the provider. If not specified, reads the priority from the annotation javax.annotation.Priority as defined on the class.

      Unfortunately, this does not work due to how the annotation value is set up and how the priority is read:

      The priority value is read as an int (as -1, the default annotation value):
      https://github.com/resteasy/Resteasy/blob/c4a1715c8b389d5ec202a35f47370053c4dc27c1/resteasy-client-microprofile-base/src/main/java/org/jboss/resteasy/microprofile/client/RestClientBuilderImpl.java#L185

      The read priority is converted to a wrapper Integer type and check for null, which is not because it is -1:
      https://github.com/resteasy/Resteasy/blob/7f718a8955eba609f9a0bbef3bc460d5c39fc673/resteasy-core/src/main/java/org/jboss/resteasy/core/providerfactory/ClientHelper.java#L185
      https://github.com/resteasy/Resteasy/blob/7f718a8955eba609f9a0bbef3bc460d5c39fc673/resteasy-core/src/main/java/org/jboss/resteasy/core/providerfactory/Utils.java#L54

      Then the actual priority stays at -1.

      Apparently, adding an extra check for -1 should be enough to fix this. I'm happy to send a PR for it.

            rcortez@redhat.com Roberto Cortez
            radcortez@yahoo.com Roberto Cortez (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: