Claus Ibsen created CAMEL-27697:
-----------------------------------
Summary: camel-ibm-watson-language: stale result headers, wrong
error text, no-op health options
Key: CAMEL-27697
URL: https://issues.apache.org/jira/browse/CAMEL-27697
Project: Camel
Issue Type: Bug
Reporter: Claus Ibsen
Fix For: 4.24.0
Found while improving the option descriptions of camel-ibm-watson-language for
CAMEL-23832 (commit
https://github.com/apache/camel/commit/ac418e0b516d2fc2ee2e5907447983e8eba91752).
These are separate problems of the component; the descriptions commit only
documents the current behavior.
h4. 1. Result headers of an earlier call stay on the message
{{WatsonLanguageProducer.analyzeText()}} and {{analyzeUrl()}} set
{{CamelIBMWatsonLanguageSentimentScore}},
{{CamelIBMWatsonLanguageSentimentLabel}} and {{CamelIBMWatsonLanguageLanguage}}
only when the result has them, and never remove them. When a route calls the
endpoint twice, the second time without sentiment (for example with
{{CamelIBMWatsonLanguageAnalyzeSentiment=false}}), the message still carries
the score and label of the first text.
Remove these headers before setting the results of the current call.
h4. 2. Misleading error message
Both methods throw {{IllegalStateException("NLU client not initialized. Use
service=nlu")}} when the client is null, but the component has no {{service}}
option. The client is null only when the endpoint is not started.
Change the message to say that the endpoint is not started.
h4. 3. Health check options that do nothing
{{WatsonLanguageComponent}} extends {{HealthCheckComponent}}, so the catalog
lists {{healthCheckConsumerEnabled}} and {{healthCheckProducerEnabled}}, but
the module registers no health check. {{healthCheckConsumerEnabled}} is also
listed on a producer-only component.
Either add a producer health check or extend {{DefaultComponent}}.
h4. 4. Metadata of the options and headers
* {{serviceUrl}} has the label {{common}} on a producer-only component;
{{producer}} fits.
* The {{CamelIBMWatsonLanguageOperation}} header has {{javaType = "String"}}
and no {{enums}}, while the producer converts it to
{{WatsonLanguageOperations}} ({{analyzeText}}, {{analyzeUrl}}).
* The headers in {{WatsonLanguageConstants}} have no {{label}}, so the docs do
not tell the input headers from the result headers.
_Claude Code on behalf of davsclaus_
--
This message was sent by Atlassian Jira
(v10.3.26#10030026)