You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@camel.apache.org by "Radek Mensik (JIRA)" <ji...@apache.org> on 2018/02/23 15:40:00 UTC

[jira] [Commented] (CAMEL-12289) URISyntaxException in AbstractSpanDecorator

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

Radek Mensik commented on CAMEL-12289:
--------------------------------------

I can submit fix with only changes in AbstractSpanDecorator:
{code:java}
Index: components/camel-opentracing/src/main/java/org/apache/camel/opentracing/decorators/AbstractSpanDecorator.java
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
--- components/camel-opentracing/src/main/java/org/apache/camel/opentracing/decorators/AbstractSpanDecorator.java    (revision 65b5394ff4645cb47e1bdd6060d100bfe4293a09)
+++ components/camel-opentracing/src/main/java/org/apache/camel/opentracing/decorators/AbstractSpanDecorator.java    (date 1519316576424)
@@ -27,6 +27,7 @@
 import org.apache.camel.Exchange;
 import org.apache.camel.opentracing.SpanDecorator;
 import org.apache.camel.util.URISupport;
+import org.apache.camel.util.StringHelper;
 
 /**
  * An abstract base implementation of the {@link SpanDecorator} interface.
@@ -69,11 +70,13 @@
 
     @Override
     public void pre(Span span, Exchange exchange, Endpoint endpoint) {
-        span.setTag(Tags.COMPONENT.getKey(), CAMEL_COMPONENT + URI.create(endpoint.getEndpointUri()).getScheme());
+        String endpointUri = endpoint.getEndpointUri();
+        endpointUri = endpointUri.replace("{","(").replace("}",")");
+        span.setTag(Tags.COMPONENT.getKey(), CAMEL_COMPONENT + URI.create(endpointUri).getScheme());
 
         // Including the endpoint URI provides access to any options that may have been provided, for
         // subsequent analysis
-        span.setTag("camel.uri", URISupport.sanitizeUri(endpoint.getEndpointUri()));
+        span.setTag("camel.uri", URISupport.sanitizeUri(endpointUri));
     }
 
     @Override

{code}
This solves my problem with restlet component, but not sure if it is optimal solution...

> URISyntaxException in AbstractSpanDecorator
> -------------------------------------------
>
>                 Key: CAMEL-12289
>                 URL: https://issues.apache.org/jira/browse/CAMEL-12289
>             Project: Camel
>          Issue Type: Bug
>          Components: camel-opentracing
>    Affects Versions: 2.20.2
>            Reporter: Radek Mensik
>            Priority: Major
>
> Fix provided in CAMEL-12098 does not solve whole problem. As there are still curly brackets in URL, it fails  in AbstractDecorator in method pre(...), where is again used URI.createSchema().
> I checked and URI.create(endpoint.getEndpointUri()) is also in 2 other decorators, but there is probably not happening that {} are used in path..
>  



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