Uploaded image for project: 'CXF'
  1. CXF
  2. CXF-7647

MethodDispatcher may return invalid method for OperationResourceInfo object

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Open
    • Major
    • Resolution: Unresolved
    • 3.2.2
    • None
    • JAX-RS
    • None
    • Unknown

    Description

      Imagine the following JAX-RS resource classes:

      public interface VersionedResource<CDTO, UDTO, ID extends RequestParam<UUID>> extends Resource<CDTO, ID> {
      
          Response update(ID idParam, IfMatchHeader ifMatchHeader, UDTO updateDto);
      
          @Deprecated
          default Response updateByPost(ID idParam, IfMatchHeader ifMatchHeader, UDTO updateDto) {
              return update(idParam, ifMatchHeader, updateDto);
          }
      
      }
      
      @Path(BASE_PATH + USERS_PATH)
      public interface UserResource extends VersionedResource<UserCreateDto, UserUpdateDto, UserIdParam> {
      
          ...
          
          @PATCH
          @Path(UserId.PATH)
          @Override
          Response update(
                  @BeanParam UserIdParam userIdParam,
                  @BeanParam IfMatchHeader ifMatchHeader,
                  @Valid UserUpdateDto userUpdateDto
          );
      
          @POST
          @Path(UserId.PATH)
          @Override
          default Response updateByPost(
                  @BeanParam UserIdParam userIdParam,
                  @BeanParam IfMatchHeader ifMatchHeader,
                  @Valid UserUpdateDto userUpdateDto) {
              return VersionedResource.super.updateByPost(userIdParam, ifMatchHeader, userUpdateDto);
          }
          
          ...
          
      }
      

      MethodDispatcher contains its internal collections in non-deterministic order.
      There are two mappings for method updateByPost and two possible returned methods:

      a)

      public default Response UserResource.updateByPost(RequestParam, IfMatchHeader, java.lang.Object)
      

      RequestParam is abstract class which results in InstantiationException later.

      b)

      public default Response UserResource.updateByPost(UserIdParam, IfMatchHeader, java.lang.Object)
      

      In this case everything works.

      Is it possible to somehow detect overridden methods and filter them from evaluation?

      Attachments

        Activity

          People

            Unassigned Unassigned
            basovnik Martin Basovnik
            Votes:
            1 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated: