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

RouteLoader: Can't load a valid route with the same location after a previous load error

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Minor
    • Resolution: Fixed
    • 4.6.0
    • 4.7.0
    • camel-core
    • 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.

       

       

       

      Attachments

        1. routeloader.zip
          13 kB
          Raymond

        Activity

          People

            davsclaus Claus Ibsen
            skin27 Raymond
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: