This is an automated email from the ASF dual-hosted git repository.
davsclaus pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel.git
The following commit(s) were added to refs/heads/main by this push:
new 36f06e1370b7 CAMEL-25108: camel-core - Always remove the hash
parameter when creating an endpoint
36f06e1370b7 is described below
commit 36f06e1370b7a981b15ec2a9bc436c82899058f7
Author: Claus Ibsen <[email protected]>
AuthorDate: Tue Sep 29 09:31:43 2026 +0200
CAMEL-25108: camel-core - Always remove the hash parameter when creating an
endpoint
The hash parameter is only to identify endpoints in a unique manner. It was
removed only when endpoint-dsl
properties were present, which broke uris that use hash to create unique
endpoints (such as the camel-grpc tests)
and uris from the endpoint-dsl resolved from the uri alone.
Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Signed-off-by: Claus Ibsen <[email protected]>
---
.../java/org/apache/camel/support/BaseClassesEdgeCasesTest.java | 6 ++++--
.../src/main/java/org/apache/camel/support/DefaultComponent.java | 6 +++---
2 files changed, 7 insertions(+), 5 deletions(-)
diff --git
a/core/camel-core/src/test/java/org/apache/camel/support/BaseClassesEdgeCasesTest.java
b/core/camel-core/src/test/java/org/apache/camel/support/BaseClassesEdgeCasesTest.java
index aa64c353541c..96cf0f640e4e 100644
---
a/core/camel-core/src/test/java/org/apache/camel/support/BaseClassesEdgeCasesTest.java
+++
b/core/camel-core/src/test/java/org/apache/camel/support/BaseClassesEdgeCasesTest.java
@@ -36,6 +36,7 @@ import org.junit.jupiter.api.Test;
import static org.awaitility.Awaitility.await;
import static org.junit.jupiter.api.Assertions.assertDoesNotThrow;
import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertFalse;
import static org.junit.jupiter.api.Assertions.assertInstanceOf;
import static org.junit.jupiter.api.Assertions.assertTrue;
@@ -132,13 +133,14 @@ public class BaseClassesEdgeCasesTest extends
ContextTestSupport {
}
@Test
- public void testHashParameterIsKept() throws Exception {
+ public void testHashParameterIsRemoved() throws Exception {
MyComponent component = new MyComponent();
context.addComponent("my", component);
context.start();
+ // hash is only to identify endpoints in a unique manner, and is not
an endpoint parameter
context.getEndpoint("my:foo?hash=abc&x=1");
- assertEquals("abc", component.parameters.get("hash"));
+ assertFalse(component.parameters.containsKey("hash"));
assertEquals("1", component.parameters.get("x"));
}
diff --git
a/core/camel-support/src/main/java/org/apache/camel/support/DefaultComponent.java
b/core/camel-support/src/main/java/org/apache/camel/support/DefaultComponent.java
index ae851b05e785..5cb0bf073561 100644
---
a/core/camel-support/src/main/java/org/apache/camel/support/DefaultComponent.java
+++
b/core/camel-support/src/main/java/org/apache/camel/support/DefaultComponent.java
@@ -118,10 +118,10 @@ public abstract class DefaultComponent extends
ServiceSupport implements Compone
}
if (properties != null && !properties.isEmpty()) {
parameters.putAll(properties);
- // This special property (added by endpoint-dsl together with the
properties) is only to identify
- // endpoints in a unique manner (a hash parameter in the uri
itself is a regular parameter)
- parameters.remove("hash");
}
+ // This special property is only to identify endpoints in a unique
manner. The endpoint-dsl adds it to the
+ // uri, which can later be resolved from the uri alone, and it is also
used in uris to create unique endpoints
+ parameters.remove("hash");
if (resolveRawParameterValues()) {
// parameters using raw syntax: RAW(value)