davsclaus commented on code in PR #27774:
URL: https://github.com/apache/camel/pull/27774#discussion_r4257790425


##########
core/camel-support/src/main/java/org/apache/camel/support/RouteWatcherReloadStrategy.java:
##########
@@ -378,10 +378,15 @@ protected void onRouteReload(Collection<Resource> 
resources, boolean removeEvery
                 // that exist, so its routes are removed like those of a 
changed file, CAMEL-25427)
                 // (a route from a templated route needs the file with the 
route template, and the file with the
                 // templated route, CAMEL-25598; a route from a Kamelet is 
created again by its parent route)
+                // (the file with the templated route is only loaded again 
when its route template comes from a file:
+                // a route template added from Java is removed below and 
nothing adds it again, so loading the
+                // templated route would fail the whole reload, CAMEL-25616)
                 getCamelContext().getRoutes().forEach(r -> {
                     if (!r.isCreatedByKamelet()) {
                         addRouteSource(resources, sources, 
r.getSourceResource());
-                        addRouteSource(resources, sources, 
r.getTemplatedRouteResource());
+                        if (r.getSourceResource() != null) {
+                            addRouteSource(resources, sources, 
r.getTemplatedRouteResource());
+                        }

Review Comment:
   Thanks, but I'd keep it as it is: the comment block right above this loop 
already says why (CAMEL-25616), and the suggested wording is not right for this 
case: a route template defined in Java is removed by 
`removeRouteTemplates("*")` below and is *not* added again, which is why the 
file with its templated route must not be loaded (keeping Java templates across 
a reload is the follow-up CAMEL-25619).
   
   _Claude Code on behalf of @davsclaus._



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to