Details
-
Bug
-
Status: Resolved
-
Minor
-
Resolution: Fixed
-
4.6.0
-
None
-
Unknown
Description
I load XML routes from String as follows:
// 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);
In the above code example, I created the resource from String using the ResourceHelper class:
Resource resource = ResourceHelper.fromString("dummy.xml", route);
The fromString method has two parameters "location" and "content". As a String doesn't really have a location I just use "dummy.xml" or something with an 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.