You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by pc...@apache.org on 2025/12/15 08:30:56 UTC
(camel) branch main updated: chore(core): support class check hardening
This is an automated email from the ASF dual-hosted git repository.
pcongiusti 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 f77027b0d7cc chore(core): support class check hardening
f77027b0d7cc is described below
commit f77027b0d7cc694a862bc011cf327da3f5a0c52c
Author: Pasquale Congiusti <pa...@gmail.com>
AuthorDate: Fri Dec 12 09:31:49 2025 +0100
chore(core): support class check hardening
---
.../main/java/org/apache/camel/support/HeaderSelectorProducer.java | 6 ++++--
.../src/main/java/org/apache/camel/support/MessageHelper.java | 3 ++-
2 files changed, 6 insertions(+), 3 deletions(-)
diff --git a/core/camel-support/src/main/java/org/apache/camel/support/HeaderSelectorProducer.java b/core/camel-support/src/main/java/org/apache/camel/support/HeaderSelectorProducer.java
index 01e77754e2d3..4c108f3e66ff 100644
--- a/core/camel-support/src/main/java/org/apache/camel/support/HeaderSelectorProducer.java
+++ b/core/camel-support/src/main/java/org/apache/camel/support/HeaderSelectorProducer.java
@@ -111,8 +111,10 @@ public abstract class HeaderSelectorProducer extends DefaultAsyncProducer implem
.orElseThrow(() -> new IllegalArgumentException("Cannot find " + fqn + " in classpath."));
Class<?> sclazz = this.getClass().getSuperclass();
- if (sclazz != null && !sclazz.getName().equals("java.lang.Object")
- && !sclazz.getName().equals(HeaderSelectorProducer.class.getName())) {
+ // NOTE: check specific classes only, not possible subclasses
+ if (sclazz != null
+ && sclazz != Object.class
+ && sclazz != HeaderSelectorProducer.class) {
// some components may have a common base class they extend from (such as camel-infinispan)
// so try to discover that (optional so return null if not present)
String key2 = this.getClass().getSuperclass().getName();
diff --git a/core/camel-support/src/main/java/org/apache/camel/support/MessageHelper.java b/core/camel-support/src/main/java/org/apache/camel/support/MessageHelper.java
index bcbe22c5313f..2cc133b2abe4 100644
--- a/core/camel-support/src/main/java/org/apache/camel/support/MessageHelper.java
+++ b/core/camel-support/src/main/java/org/apache/camel/support/MessageHelper.java
@@ -365,7 +365,8 @@ public final class MessageHelper {
return "[Body is instance of java.io.Reader]";
} else if (obj instanceof Writer) {
return "[Body is instance of java.io.Writer]";
- } else if (obj.getClass().getName().equals("javax.xml.transform.stax.StAXSource")) {
+ // NOTE: the class is not available at compilation time
+ } else if (obj.getClass().getName().equals("javax.xml.transform.stax.StAXSource")) { // NOSONAR
// StAX source is streaming based
return "[Body is instance of javax.xml.transform.Source]";
}