[jira] [Commented] (CXF-7638) JAXRS CTS/TCK issue: register(...) should ignore components when invalid contracts are passed in

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

[jira] [Commented] (CXF-7638) JAXRS CTS/TCK issue: register(...) should ignore components when invalid contracts are passed in

JIRA jira@apache.org

    [ https://issues.apache.org/jira/browse/CXF-7638?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16356131#comment-16356131 ]

ASF GitHub Bot commented on CXF-7638:
-------------------------------------

andymc12 opened a new pull request #379: [CXF-7638] Only register provider if it implements specified contracts
URL: https://github.com/apache/cxf/pull/379
 
 
   Per JAX-RS javadoc, all registered components must implement the
   contracts specified in the passed in array of Classes or the map of
   contracts to priorities.  CXF should also log a warning when an invalid
   contract is passed in to alert the user that the call to register has
   been ignored.
   
   Since ServerProviderFactory and CdiServerConfigurableFactory also used
   this same registration mechanism (passing in server side filters/
   interceptors, these parts also needed changes.
   
   Looking for a review because I'm not 100% certain what the supportedContracts flow was really doing or if there are any negative effects from removing it.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[hidden email]


> JAXRS CTS/TCK issue:  register(...) should ignore components when invalid contracts are passed in
> -------------------------------------------------------------------------------------------------
>
>                 Key: CXF-7638
>                 URL: https://issues.apache.org/jira/browse/CXF-7638
>             Project: CXF
>          Issue Type: Bug
>          Components: JAX-RS
>    Affects Versions: 3.2.2
>            Reporter: Andy McCright
>            Assignee: Andy McCright
>            Priority: Major
>             Fix For: 3.2.3
>
>
> We're seeing some failures when running the JAX-RS 2.1 TCK - particularly around the register method. The javadoc states that the implementation MUST ignore the component if the call to register specifies a contract (interface) that the component does not implement.
> So, for example, suppose somebody calls code like this:
>  
> public class MyProvider implements MessageBodyWriter<MyObject> ...
>  
> Client c = ClientBuilder.newClient();
> c.register(MyProvider.class, ContainerRequestFilter.class); // should ignore
> c.register(new MyProvider, ExceptionMapper.class, MessageBodyReader.class); // should ignore
> Map<Class, int> contractPriorityMap = new HashMap<>();
> contractPriorityMap.put(ClientResponseFilter.class, 20);
> c.register(MyProvider.class, contractPriorityMap); // should ignore
> c.register(new MyProvider.class, contractPriorityMap); // should ignore
>  
> The TCK tests basically check that nothing gets registered when a passed-in contract is not assignable to the provider class.  And scenarios like the four mentioned above are failing.
>  



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