Raymond created CAMEL-20920:
-------------------------------

             Summary: RouteLoader: Can't load a valid route with the same 
location after a previous load error
                 Key: CAMEL-20920
                 URL: https://issues.apache.org/jira/browse/CAMEL-20920
             Project: Camel
          Issue Type: Bug
          Components: camel-core
    Affects Versions: 4.6.0
            Reporter: Raymond
         Attachments: routeloader.zip

I load XML routes from String as follows:


{code:java}
// Create resource from String
String route = "<route id=\"test\">\n" +
        "    <from uri=\"timer:xml?period=5s\"/>\n" +
        "    <log message=\"Some log message\"/>\n" +
        "<setHeader name=\"SomeHeader\">\n" +
        "<simple>XYZ</simple>\n" +
        "</setHeader>\n" +
        "</route>";
Resource resource = ResourceHelper.fromString("dummy.xml", route);

// Load the routes
RoutesLoader loader = PluginHelper.getRoutesLoader(context);
loader.updateRoutes(resource); {code}
{color:#cc7832}
{color}In the above code example, I created the resource from String using the 
ResourceHelper class:


{code:java}
Resource resource = ResourceHelper.fromString("dummy.xml", route);
{code}

The fromString method has two parameters "location" and "content". As a String 
doesn't really have a location I just use "dummy.xml" or some ID like this 
"123456.xml". 

This works with correct code and when the content has a mistake like invalid 
XML code, it returns an error. 

This is as expected, however when loading the route again with the correct XML 
Code with the same location parameter the loading fails. The loader still 
returns the previous error. When the location is changed to another name to 
route loads correctly.

 

{color:#cc7832}

{color}

 



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to