cxf-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Luz (JIRA)" <j...@apache.org>
Subject [jira] [Updated] (CXF-6684) A Warning is logged on every JAX-RS call
Date Thu, 19 Nov 2015 08:35:10 GMT

     [ https://issues.apache.org/jira/browse/CXF-6684?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

Luz updated CXF-6684:
---------------------
    Description: 
A Warning is logged on every JAX-RS call: " Both Object#method and Object#method are equal
candidates for handling the current request which can lead to unpredictable results". This
occurs even with no configuration errors (only one service with one method).

This bug seems to be introduced by commit d58606e554418899e905cd2f3bc7e8c465eff451.

org.apache.cxf.jaxrs.utils.JAXRSUtils#findTargetMethod uses a java.util.TreeMap with org.apache.cxf.jaxrs.model.OperationResourceInfoComparator.
But java.util.TreeMap.put(K, V) calls compare(key, key) internally.


{code:title=Test.java}
    @Test
    public void testWarning() throws Exception
    {
        Message m = new MessageImpl();
        Exchange e = new ExchangeImpl();
        e.setInMessage(m);
        e.put(Endpoint.class, Mockito.mock(Endpoint.class));
        OperationResourceInfo k = new OperationResourceInfo(getClass().getMethod("toString"),
                new ClassResourceInfo(getClass()));
        k.setURITemplate(new URITemplate("template"));

        new TreeMap<>(new OperationResourceInfoComparator(m, "GET")).put(k, new Object());
    }
}
{code}

  was:
A Warning is logged on every JAX-RS call: " Both Object#method and Object#method are equal
candidates for handling the current request which can lead to unpredictable results". This
occurs even with no configuration errors (only one service with one method).

This bug seems to be introduced by commit d58606e554418899e905cd2f3bc7e8c465eff451.

org.apache.cxf.jaxrs.utils.JAXRSUtils#findTargetMethod uses a java.util.TreeMap with org.apache.cxf.jaxrs.model.OperationResourceInfoComparator.
But java.util.TreeMap.put(K, V) callscompare(key, key) internally.


{code:title=Test.java}
    @Test
    public void testWarning() throws Exception
    {
        Message m = new MessageImpl();
        Exchange e = new ExchangeImpl();
        e.setInMessage(m);
        e.put(Endpoint.class, Mockito.mock(Endpoint.class));
        OperationResourceInfo k = new OperationResourceInfo(getClass().getMethod("toString"),
                new ClassResourceInfo(getClass()));
        k.setURITemplate(new URITemplate("template"));

        new TreeMap<>(new OperationResourceInfoComparator(m, "GET")).put(k, new Object());
    }
}
{code}


> A Warning is logged on every JAX-RS call
> ----------------------------------------
>
>                 Key: CXF-6684
>                 URL: https://issues.apache.org/jira/browse/CXF-6684
>             Project: CXF
>          Issue Type: Bug
>          Components: JAX-RS
>    Affects Versions: 2.7.17
>            Reporter: Luz
>
> A Warning is logged on every JAX-RS call: " Both Object#method and Object#method are
equal candidates for handling the current request which can lead to unpredictable results".
This occurs even with no configuration errors (only one service with one method).
> This bug seems to be introduced by commit d58606e554418899e905cd2f3bc7e8c465eff451.
> org.apache.cxf.jaxrs.utils.JAXRSUtils#findTargetMethod uses a java.util.TreeMap with
org.apache.cxf.jaxrs.model.OperationResourceInfoComparator. But java.util.TreeMap.put(K, V)
calls compare(key, key) internally.
> {code:title=Test.java}
>     @Test
>     public void testWarning() throws Exception
>     {
>         Message m = new MessageImpl();
>         Exchange e = new ExchangeImpl();
>         e.setInMessage(m);
>         e.put(Endpoint.class, Mockito.mock(Endpoint.class));
>         OperationResourceInfo k = new OperationResourceInfo(getClass().getMethod("toString"),
>                 new ClassResourceInfo(getClass()));
>         k.setURITemplate(new URITemplate("template"));
>         new TreeMap<>(new OperationResourceInfoComparator(m, "GET")).put(k, new
Object());
>     }
> }
> {code}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Mime
View raw message