This is an automated email from the ASF dual-hosted git repository.
oscerd 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 461122f60402 CAMEL-24518: camel-ibm-watson-language - validate that at
least one analysis feature is enabled (#25785)
461122f60402 is described below
commit 461122f60402e886f5cd25e7d07cc730429bb40e
Author: Andrea Cosentino <[email protected]>
AuthorDate: Thu Aug 27 11:19:55 2026 +0200
CAMEL-24518: camel-ibm-watson-language - validate that at least one
analysis feature is enabled (#25785)
buildFeatures() built an empty Features object when all six analysis flags
were
disabled, which the Watson NLU service rejects with an opaque HTTP 400.
Validate
that at least one feature is enabled and throw a clear
IllegalArgumentException
otherwise.
Signed-off-by: Andrea Cosentino <[email protected]>
Co-authored-by: Claude Opus 4.8 <[email protected]>
---
.../camel/component/ibm/watson/language/WatsonLanguageProducer.java | 6 ++++++
1 file changed, 6 insertions(+)
diff --git
a/components/camel-ibm/camel-ibm-watson-language/src/main/java/org/apache/camel/component/ibm/watson/language/WatsonLanguageProducer.java
b/components/camel-ibm/camel-ibm-watson-language/src/main/java/org/apache/camel/component/ibm/watson/language/WatsonLanguageProducer.java
index a9364ff368fe..9e7c94115504 100644
---
a/components/camel-ibm/camel-ibm-watson-language/src/main/java/org/apache/camel/component/ibm/watson/language/WatsonLanguageProducer.java
+++
b/components/camel-ibm/camel-ibm-watson-language/src/main/java/org/apache/camel/component/ibm/watson/language/WatsonLanguageProducer.java
@@ -193,6 +193,12 @@ public class WatsonLanguageProducer extends
DefaultProducer {
builder.categories(new CategoriesOptions.Builder().build());
}
+ if (!(analyzeSentiment || analyzeEmotion || analyzeEntities ||
analyzeKeywords || analyzeConcepts
+ || analyzeCategories)) {
+ throw new IllegalArgumentException(
+ "At least one analysis feature (sentiment, emotion,
entities, keywords, concepts, categories) must be enabled");
+ }
+
return builder.build();
}