[
https://issues.apache.org/jira/browse/CAMEL-25320?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Claus Ibsen updated CAMEL-25320:
--------------------------------
Fix Version/s: 4.23.0
> camel-core - the separator of @PropertyInject is used as a regular
> expression: with | the value is split into single characters, with . there
> are no values
> -----------------------------------------------------------------------------------------------------------------------------------------------------------
>
> Key: CAMEL-25320
> URL: https://issues.apache.org/jira/browse/CAMEL-25320
> Project: Camel
> Issue Type: Bug
> Components: camel-core
> Reporter: shashank
> Priority: Minor
> Fix For: 4.23.0
>
>
> {{CamelPostProcessorHelper}} splits an injected property value into an array,
> a collection or a map with {{value.split(separator)}}
> ({{convertArrayUsingSeparator}}, {{convertCollectionUsingSeparator}},
> {{convertMapUsingSeparator}}). {{String.split}} takes a regular expression;
> the annotation documents a separator ("Used for splitting the property value
> into an array/list of values. For example to use comma to separate the
> values.").
> {code:java}
> @PropertyInject(value = "hosts", separator = "|")
> public List<String> hosts; // hosts=serverA|serverB -> [s, e, r, v,
> e, r, A, |, s, ...]
> {code}
> With {{separator = "|"}} a list or array gets one element per character, a
> map fails ({{NumberFormatException: For input string: ""}} for {{Map<String,
> Integer>}}) or gets wrong entries, and with {{separator = "."}} the result is
> empty.
> h3. Reproduction
> New {{PropertyInjectSeparatorTest}} (camel-core,
> {{CamelPostProcessorHelper.getInjectionPropertyValue}} as
> {{CamelPostProcessorHelperTest}} does): {{|}} for a list and a map and {{.}}
> for an array fail on main (2 failures, 1 error); {{;}} is the control. Two
> runs.
> h3. Proposed fix
> {{Pattern.quote}} the separator in the three methods. The separators of the
> documentation and tests ({{,}}, {{;}}) split exactly as before; an
> application that escaped a separator (for example {{separator = "\\\\|"}})
> must use the separator itself, and a separator that relied on a regular
> expression (such as {{"\\\\s+"}}) is no longer supported (the values are
> trimmed anyway); upgrade guide entry next to the existing @PropertyInject
> section of CAMEL-25009. With the fix the related tests pass (camel-core
> {{CamelPostProcessorHelper*}}, {{DefaultCamelBeanPostProcessor*}},
> {{CamelBeanPostProcessor*}}, {{PropertyInject*}}: 47; camel-main
> {{MainIoC*}}: 9).
> Found with a Lean 4 model of the split (shared with the camel-aws2-sqs
> {{batchSeparator}} issue): "the values are the trimmed pieces between the
> separators" fails on main for {{|}} and {{.}} for every value, and the fix is
> proved equal to main for every separator character the model treats as plain
> (only {{|}} and {{.}} are modelled as special; {{$}}, {{^}}, {{?}}, {{*}},
> {{+}}, {{(}}, {{[}}, a backslash also fail on main, differently, and are not
> covered by the proof).
> Affected: 4.14.x, 4.18.x and main.
> Duplicate check (2026-10-04): JIRA "PropertyInject" with "separator": none on
> this; CAMEL-25009 (Claus, 2026-09-26) changed the same file without touching
> the split. GitHub pull requests: none.
> _Filed with Claude Code on behalf of allthingssecurity._
--
This message was sent by Atlassian Jira
(v8.20.10#820010)