You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@cxf.apache.org by "Fabrice Daugan (JIRA)" <ji...@apache.org> on 2019/04/15 08:58:00 UTC
[jira] [Commented] (CXF-7647) MethodDispatcher may return invalid
method for OperationResourceInfo object
[ https://issues.apache.org/jira/browse/CXF-7647?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16817662#comment-16817662 ]
Fabrice Daugan commented on CXF-7647:
-------------------------------------
I experience the same issue for CXF 3.3.1.
The issue is in org.apache.cxf.jaxrs.utils.JAXRSUtils#findTargetMethod
The election should consider the inheritance order.
> 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-RS
> Affects Versions: 3.2.2
> Reporter: Martin Basovnik
> Priority: Major
>
> 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)