[ 
https://issues.apache.org/jira/browse/CAMEL-27851?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Claus Ibsen updated CAMEL-27851:
--------------------------------
    Description: 
Found while improving the option descriptions of camel-dynamic-router for 
CAMEL-23832 (commit 
https://github.com/apache/camel/commit/f9e89282ea330ac399422c39806c46d8db9c4777,
 pull request https://github.com/apache/camel/pull/31144).
These are separate problems of the component; the descriptions change only 
documents the current behavior.

h4. 1. No subscription ID is generated
The old text said an ID is assigned when none is given, but nothing generates 
one. {{DynamicRouterFilterService.addFilterForChannel}} then throws 
NullPointerException at filter.id().equals once the channel has a subscription 
(the first one is stored with a null ID), and removeFilterById(null) throws too.
Proposed change: generate a UUID in DynamicRouterControlService when the ID is 
empty, or fail with a clear error.

h4. 2. The predicateBean option is never read
{{DynamicRouterControlProducer}} only reads the CamelDynamicRouterPredicateBean 
header. With to(...?predicateBean=#p) the producer falls through to "message 
body must be the Predicate"; it only works with toD, where the 
send-dynamic-aware turns it into the header.
Proposed change: use configuration.getPredicateBean() when there is no header.

h4. 3. The onPrepareProcessor option is never applied
{{DynamicRouterRecipientListHelper.setPropertiesForRecipientList}} only uses 
onPrepare (the bean name).
Proposed change: use getOnPrepareProcessor() first.

h4. 4. toD turns route-author predicates into message headers
With toD the predicate and expressionLanguage URI parameters become headers and 
are rejected unless allowPredicateFromMessage=true, although the route author 
wrote them (may be intended by CAMEL-24576; needs a decision).
Proposed change: decide whether URI parameters count as trusted.

h4. 5. Errors are returned as the body
When subscribe hits an existing ID, or update a missing one, 
addFilterForChannel returns "Error: Filter could not be ..." as the message 
body instead of throwing.
Proposed change: throw an exception.

h4. 6. A missing priority gives NumberFormatException
Integer.parseInt("null") is called without a clear message.
Proposed change: validate the priority.


_Claude Code on behalf of davsclaus_

  was:
Found while improving the option descriptions of camel-dynamic-router for 
CAMEL-23832 (pull request https://github.com/apache/camel/pull/31144).
These are separate problems of the component; the descriptions change only 
documents the current behavior.

h4. 1. No subscription ID is generated
The old text said an ID is assigned when none is given, but nothing generates 
one. {{DynamicRouterFilterService.addFilterForChannel}} then throws 
NullPointerException at filter.id().equals once the channel has a subscription 
(the first one is stored with a null ID), and removeFilterById(null) throws too.
Proposed change: generate a UUID in DynamicRouterControlService when the ID is 
empty, or fail with a clear error.

h4. 2. The predicateBean option is never read
{{DynamicRouterControlProducer}} only reads the CamelDynamicRouterPredicateBean 
header. With to(...?predicateBean=#p) the producer falls through to "message 
body must be the Predicate"; it only works with toD, where the 
send-dynamic-aware turns it into the header.
Proposed change: use configuration.getPredicateBean() when there is no header.

h4. 3. The onPrepareProcessor option is never applied
{{DynamicRouterRecipientListHelper.setPropertiesForRecipientList}} only uses 
onPrepare (the bean name).
Proposed change: use getOnPrepareProcessor() first.

h4. 4. toD turns route-author predicates into message headers
With toD the predicate and expressionLanguage URI parameters become headers and 
are rejected unless allowPredicateFromMessage=true, although the route author 
wrote them (may be intended by CAMEL-24576; needs a decision).
Proposed change: decide whether URI parameters count as trusted.

h4. 5. Errors are returned as the body
When subscribe hits an existing ID, or update a missing one, 
addFilterForChannel returns "Error: Filter could not be ..." as the message 
body instead of throwing.
Proposed change: throw an exception.

h4. 6. A missing priority gives NumberFormatException
Integer.parseInt("null") is called without a clear message.
Proposed change: validate the priority.


_Claude Code on behalf of davsclaus_


> camel-dynamic-router: no subscription ID is generated, the predicateBean and 
> onPrepareProcessor options are never read
> ----------------------------------------------------------------------------------------------------------------------
>
>                 Key: CAMEL-27851
>                 URL: https://issues.apache.org/jira/browse/CAMEL-27851
>             Project: Camel
>          Issue Type: Bug
>            Reporter: Claus Ibsen
>            Priority: Minor
>             Fix For: 4.25.0
>
>
> Found while improving the option descriptions of camel-dynamic-router for 
> CAMEL-23832 (commit 
> https://github.com/apache/camel/commit/f9e89282ea330ac399422c39806c46d8db9c4777,
>  pull request https://github.com/apache/camel/pull/31144).
> These are separate problems of the component; the descriptions change only 
> documents the current behavior.
> h4. 1. No subscription ID is generated
> The old text said an ID is assigned when none is given, but nothing generates 
> one. {{DynamicRouterFilterService.addFilterForChannel}} then throws 
> NullPointerException at filter.id().equals once the channel has a 
> subscription (the first one is stored with a null ID), and 
> removeFilterById(null) throws too.
> Proposed change: generate a UUID in DynamicRouterControlService when the ID 
> is empty, or fail with a clear error.
> h4. 2. The predicateBean option is never read
> {{DynamicRouterControlProducer}} only reads the 
> CamelDynamicRouterPredicateBean header. With to(...?predicateBean=#p) the 
> producer falls through to "message body must be the Predicate"; it only works 
> with toD, where the send-dynamic-aware turns it into the header.
> Proposed change: use configuration.getPredicateBean() when there is no header.
> h4. 3. The onPrepareProcessor option is never applied
> {{DynamicRouterRecipientListHelper.setPropertiesForRecipientList}} only uses 
> onPrepare (the bean name).
> Proposed change: use getOnPrepareProcessor() first.
> h4. 4. toD turns route-author predicates into message headers
> With toD the predicate and expressionLanguage URI parameters become headers 
> and are rejected unless allowPredicateFromMessage=true, although the route 
> author wrote them (may be intended by CAMEL-24576; needs a decision).
> Proposed change: decide whether URI parameters count as trusted.
> h4. 5. Errors are returned as the body
> When subscribe hits an existing ID, or update a missing one, 
> addFilterForChannel returns "Error: Filter could not be ..." as the message 
> body instead of throwing.
> Proposed change: throw an exception.
> h4. 6. A missing priority gives NumberFormatException
> Integer.parseInt("null") is called without a clear message.
> Proposed change: validate the priority.
> _Claude Code on behalf of davsclaus_



--
This message was sent by Atlassian Jira
(v10.3.26#10030026)

Reply via email to