Uploaded image for project: 'Camel'
  1. Camel
  2. CAMEL-12098

URISyntaxException in OpenTracingTracer for endpoints with path parameters

    XMLWordPrintableJSON

Details

    • Unknown
    • Regression

    Description

      We're using a lot of endpoints with path parameters, such as: restlet://https://localhost:58530//people/{personId}?restletMethod=GET

      The endpoint URI contains curly brackets, which is invalid and doesn't pass validation in URI.create. Unfortunately, that is exactly what happens in OpenTracingTracer:

      SpanDecorator sd = decorators.get(URI.create(endpoint.getEndpointUri()).getScheme());
      

      Naturally, this results in OpenTracing not working and lots of warnings like this:

      WARN  o.a.c.opentracing.OpenTracingTracer - OpenTracing: Failed to capture tracing data
      java.lang.IllegalArgumentException: Illegal character in path at index 42: restlet://https://localhost:58530//people/{personId}?restletMethod=GET
      	at java.net.URI.create(URI.java:852)
      	at org.apache.camel.opentracing.OpenTracingTracer.getSpanDecorator(OpenTracingTracer.java:192)
      	at org.apache.camel.opentracing.OpenTracingTracer$OpenTracingEventNotifier.notify(OpenTracingTracer.java:218)
      	at org.apache.camel.util.EventHelper.doNotifyEvent(EventHelper.java:1096)
      	at org.apache.camel.util.EventHelper.notifyExchangeSending(EventHelper.java:833)
      	at org.apache.camel.processor.SendProcessor.process(SendProcessor.java:137)
      	at org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:110)
      	at org.apache.camel.processor.RedeliveryErrorHandler.process(RedeliveryErrorHandler.java:548)
      	at org.apache.camel.processor.CamelInternalProcessor.process(CamelInternalProcessor.java:201)
      	at org.apache.camel.processor.Pipeline.process(Pipeline.java:138)
      	at org.apache.camel.processor.Pipeline.process(Pipeline.java:101)
      	at org.apache.camel.processor.CamelInternalProcessor.process(CamelInternalProcessor.java:201)
      	at org.apache.camel.component.direct.DirectProducer.process(DirectProducer.java:62)
      	at org.apache.camel.processor.SendProcessor.process(SendProcessor.java:148)
      	at org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:110)
      	at org.apache.camel.processor.RedeliveryErrorHandler.process(RedeliveryErrorHandler.java:548)
      	at org.apache.camel.processor.CamelInternalProcessor.process(CamelInternalProcessor.java:201)
      	at org.apache.camel.processor.Pipeline.process(Pipeline.java:138)
      	at org.apache.camel.processor.Pipeline.process(Pipeline.java:101)
      	at org.apache.camel.processor.CamelInternalProcessor.process(CamelInternalProcessor.java:201)
      	at org.apache.camel.component.direct.DirectProducer.process(DirectProducer.java:62)
      	at org.apache.camel.processor.SendProcessor.process(SendProcessor.java:148)
      	at org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:110)
      	at org.apache.camel.processor.RedeliveryErrorHandler.process(RedeliveryErrorHandler.java:548)
      	at org.apache.camel.processor.CamelInternalProcessor.process(CamelInternalProcessor.java:201)
      	at org.apache.camel.processor.Pipeline.process(Pipeline.java:138)
      	at org.apache.camel.processor.Pipeline.process(Pipeline.java:101)
      	at org.apache.camel.processor.CamelInternalProcessor.process(CamelInternalProcessor.java:201)
      	at org.apache.camel.component.direct.DirectProducer.process(DirectProducer.java:62)
      	at org.apache.camel.processor.SendProcessor.process(SendProcessor.java:148)
      	at org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:110)
      	at org.apache.camel.processor.RedeliveryErrorHandler.process(RedeliveryErrorHandler.java:548)
      	at org.apache.camel.processor.CamelInternalProcessor.process(CamelInternalProcessor.java:201)
      	at org.apache.camel.processor.Pipeline.process(Pipeline.java:138)
      	at org.apache.camel.processor.Pipeline.process(Pipeline.java:101)
      	at org.apache.camel.processor.CamelInternalProcessor.process(CamelInternalProcessor.java:201)
      	at org.apache.camel.component.timer.TimerConsumer.sendTimerExchange(TimerConsumer.java:197)
      	at org.apache.camel.component.timer.TimerConsumer$2.run(TimerConsumer.java:110)
      	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
      	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
      	at java.lang.Thread.run(Thread.java:748)
      Caused by: java.net.URISyntaxException: Illegal character in path at index 42: restlet://https://localhost:58530//people/{personId}?restletMethod=GET
      	at java.net.URI$Parser.fail(URI.java:2848)
      	at java.net.URI$Parser.checkChars(URI.java:3021)
      	at java.net.URI$Parser.parseHierarchical(URI.java:3105)
      	at java.net.URI$Parser.parse(URI.java:3053)
      	at java.net.URI.<init>(URI.java:588)
      	at java.net.URI.create(URI.java:850)
      	... 40 common frames omitted
      

      Previously Restlet endpoint URI used normal brackets instead of curly brackets, so this wasn't an issue.

      Attachments

        Issue Links

          Activity

            People

              davsclaus Claus Ibsen
              koscejev Anton Koscejev
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: