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

JAXRS UriInfo.getMatchedURIs raises error for templated URI

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Critical
    • Resolution: Fixed
    • 3.1.10
    • 3.1.12, 3.0.14, 3.2.0
    • JAX-RS
    • None
    • Unknown

    Description

      UriInfo.getMatchedURIs() on templated URIs fails.
      See attachment for a junit test case reproducing the error (run testMatchedUris())

      Below is a stack-trace of the error.

      After digging a little bit into, UriInfoImpl.getMatchedURIs(decode) is
      iterating over MethodInvocationInfos that have empty templated values
      instead of expected values (note that private field
      UriInfoImpl.templateParams is set with correct templated values).

      Error stacktrace:

      Apr 28, 2017 3:21:54 PM org.apache.cxf.interceptor.AbstractFaultChainInitiatorObserver onMessage
      SEVERE: Error occurred during error handling, give up!
      org.apache.cxf.interceptor.Fault: Unresolved variables; only 0 value(s) given for 1 unique variable(s)
      	at org.apache.cxf.service.invoker.AbstractInvoker.createFault(AbstractInvoker.java:162)
      	at org.apache.cxf.service.invoker.AbstractInvoker.invoke(AbstractInvoker.java:128)
      	at org.apache.cxf.jaxrs.JAXRSInvoker.invoke(JAXRSInvoker.java:189)
      	at org.apache.cxf.jaxrs.JAXRSInvoker.invoke(JAXRSInvoker.java:99)
      	at org.apache.cxf.interceptor.ServiceInvokerInterceptor$1.run(ServiceInvokerInterceptor.java:59)
      	at org.apache.cxf.interceptor.ServiceInvokerInterceptor.handleMessage(ServiceInvokerInterceptor.java:96)
      	at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:308)
      	at org.apache.cxf.transport.ChainInitiationObserver.onMessage(ChainInitiationObserver.java:121)
      	at org.apache.cxf.transport.local.LocalConduit$LocalConduitOutputStream$1.run(LocalConduit.java:88)
      	at org.apache.cxf.workqueue.AutomaticWorkQueueImpl$3.run(AutomaticWorkQueueImpl.java:428)
      	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
      	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
      	at org.apache.cxf.workqueue.AutomaticWorkQueueImpl$AWQThreadFactory$1.run(AutomaticWorkQueueImpl.java:353)
      	at java.lang.Thread.run(Thread.java:745)
      Caused by: java.lang.IllegalArgumentException: Unresolved variables; only 0 value(s) given for 1 unique variable(s)
      	at org.apache.cxf.jaxrs.impl.UriBuilderImpl.substituteVarargs(UriBuilderImpl.java:286)
      	at org.apache.cxf.jaxrs.impl.UriBuilderImpl.doBuildUriParts(UriBuilderImpl.java:121)
      	at org.apache.cxf.jaxrs.impl.UriBuilderImpl.doBuild(UriBuilderImpl.java:101)
      	at org.apache.cxf.jaxrs.impl.UriBuilderImpl.buildFromEncoded(UriBuilderImpl.java:230)
      	at org.apache.cxf.jaxrs.impl.UriInfoImpl.createMatchedPath(UriInfoImpl.java:208)
      	at org.apache.cxf.jaxrs.impl.UriInfoImpl.getMatchedURIs(UriInfoImpl.java:191)
      	at org.apache.cxf.jaxrs.impl.UriInfoImpl.getMatchedURIs(UriInfoImpl.java:170)
      	at org.apache.cxf.jaxrs.impl.tl.ThreadLocalUriInfo.getMatchedURIs(ThreadLocalUriInfo.java:96)
      	at misc.TestCxfJaxrs$Resource.getMatchedUris(TestCxfJaxrs.java:63)
      	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
      	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      	at java.lang.reflect.Method.invoke(Method.java:498)
      	at org.apache.cxf.service.invoker.AbstractInvoker.performInvocation(AbstractInvoker.java:180)
      	at org.apache.cxf.service.invoker.AbstractInvoker.invoke(AbstractInvoker.java:96)
      	... 12 more
      

      Attachments

        1. uriinfo-issues.jar
          6 kB
          Nicolas Lenoire

        Activity

          People

            sergey_beryozkin Sergey Beryozkin
            nlenoire Nicolas Lenoire
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: