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

Mingu Song commented on CAMEL-17501:
------------------------------------

Ok, our project use camel xml format with spring boot. 
(camel-spring-boot-starter:3.7.5)

Please see the attachment "sample_xml.txt". (This xml has syntax errors.)

And I test as blow.

In processing addRouteDefinitions, URISupport.sanitizeUri() function was not 
finished in FailedToCreateRouteException.getRouteMessage().
{code:java}
ExtendedCamelContext extendedCamelContext = 
camelContext.adapt(ExtendedCamelContext.class);
ModelCamelContext modelCamelContext = 
camelContext.adapt(ModelCamelContext.class);

try {
    InputStream is = new 
ByteArrayInputStream(routeXml.getBytes(StandardCharsets.UTF_8));
    RoutesDefinition routes = (RoutesDefinition) 
extendedCamelContext.getXMLRoutesDefinitionLoader().loadRoutesDefinition(camelContext,
 is);

    camelContext.getShutdownStrategy().setTimeout(5);
    camelContext.getShutdownStrategy().setSuppressLoggingOnTimeout(true);
    camelContext.getShutdownStrategy().setLogInflightExchangesOnTimeout(true);
    
camelContext.setShutdownRunningTask(ShutdownRunningTask.CompleteCurrentTaskOnly);
    modelCamelContext.addRouteDefinitions(routes.getRoutes());
} catch (Exception exception) {
    exception.printStackTrace();
} {code}

> FailedToCreateRouteException does not finish
> --------------------------------------------
>
>                 Key: CAMEL-17501
>                 URL: https://issues.apache.org/jira/browse/CAMEL-17501
>             Project: Camel
>          Issue Type: Bug
>          Components: camel-core
>    Affects Versions: 3.7.5
>            Reporter: Mingu Song
>            Priority: Minor
>         Attachments: sample_xml.txt
>
>
> In my case, the route string is a bit complex and long.
> So the sanitizeUri function was not finished and camel context was stuck.
> How about cut the route string first, then check and sanitize string.
> I think it is better way and improving performance.
> Please check this and let me change this.
> {code:java}
> protected static String getRouteMessage(String route) {
>     // ensure to sanitize uri's in the route so we do not show sensitive 
> information such as passwords
>     route = URISupport.sanitizeUri(route);
>     // cut the route after 60 chars so it won't be too big in the message
>     // users just need to be able to identify the route so they know where to 
> look
>     if (route.length() > 60) {
>         return route.substring(0, 60) + "...";
>     } else {
>         return route;
>     }
> } {code}



--
This message was sent by Atlassian Jira
(v8.20.1#820001)

Reply via email to