gnodet-bot commented on code in PR #28213:
URL: https://github.com/apache/camel/pull/28213#discussion_r4341639344


##########
core/camel-xml-io/src/main/java/org/apache/camel/xml/LwModelToXMLDumper.java:
##########
@@ -320,33 +359,74 @@ private static void 
extractSourceLocations(RouteDefinition route, Map<String, Ke
         }
     }
 
+    /**
+     * The URI of an endpoint DSL builder, for the checksum without the hash 
of its options that are objects: an
+     * identity hash, another one in every run. The objects are beans, which 
the checksum leaves out.
+     */
+    static String rawUri(String uri, boolean checksum) {
+        return checksum && uri != null ? withoutParameter(uri, "hash", 
"[0-9a-f]+") : uri;
+    }
+
+    /** The URI without the query parameter of that name whose value matches 
the regular expression. */
+    static String withoutParameter(String uri, String name, String valueRegex) 
{
+        Matcher matcher = Pattern.compile("([?&])" + Pattern.quote(name) + "=" 
+ valueRegex + "(&|$)").matcher(uri);

Review Comment:
   💡 **Minor:** `withoutParameter()` compiles a new `Pattern` on every call. 
It's called once per `uri` attribute plus once per `counterRouteId` for Kamelet 
URI stripping. Since this is a route preparation path (not hot), it's 
acceptable as-is — but caching the compiled patterns as static constants would 
be a minor efficiency improvement if this ever becomes performance-sensitive.



-- 
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