Martin Basovnik created CXF-7647:
------------------------------------

             Summary: MethodDispatcher may return invalid method for 
OperationResourceInfo object
                 Key: CXF-7647
                 URL: https://issues.apache.org/jira/browse/CXF-7647
             Project: CXF
          Issue Type: Bug
          Components: JAX-WS Runtime
    Affects Versions: 3.2.2
            Reporter: Martin Basovnik


Imagine the following JAX-RS resource classes:

{code:java}
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);
    }

}
{code}

{code:java}
@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);
    }
    
    ...
    
}
{code}

[MethodDispatcher|https://github.com/apache/cxf/blob/master/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/model/MethodDispatcher.java#L29]
 contains its internal collections in *non-deterministic* order.
There are two mappings for method {{updateByPost}} and two possible returned 
methods:

*a)*
{code:java}
public default Response UserResource.updateByPost(RequestParam, IfMatchHeader, 
java.lang.Object)
{code}
{{RequestParam}} is abstract class which results in {{InstantiationException}} 
[later|https://github.com/apache/cxf/blob/cxf-3.1.11/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/JAXRSUtils.java#L1054].

*b)*
{code:java}
public default Response UserResource.updateByPost(UserIdParam, IfMatchHeader, 
java.lang.Object)
{code}
In this case everything works.



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






--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to