Claus Ibsen created CAMEL-25110:
-----------------------------------
Summary: camel-core - Property placeholder parser: fix bugs found
in a deep review
Key: CAMEL-25110
URL: https://issues.apache.org/jira/browse/CAMEL-25110
Project: Camel
Issue Type: Bug
Components: camel-core
Reporter: Claus Ibsen
A review of the property placeholder parser (DefaultPropertiesParser) found
these bugs:
# The documented optional form of a properties function {{ {{env:?KEY}} }}
always returns null for functions that do not look up the property first (env,
sys, service, bean and the vault and kubernetes functions), even when the value
exists, as the function is called with the key including the {{?}}.
# The optional marker on the key of a function {{ {{?env:KEY}} }} is ignored,
so a missing value fails.
# With {{ignoreMissingProperty=true}} the internal marker {{@@[key]@@}} is
returned instead of the unresolved placeholder {{ {{key}} }}, such as from
{{CamelContext.resolvePropertyPlaceholders}} (used by the model and property
binding).
# A resolved value that ends with a backslash (such as a Windows path
{{C:\temp\}}) escapes the next placeholder, as the resolved value is parsed
again: {{ {{dir}}{{file}} }} fails with {{Missing {{ from the text:
C:\temp\{{file}} }}.
# With {{nestedPlaceholder=false}} the text before an unresolved optional
placeholder is dropped ({{ abc{{?x}}def }} gives {{def}}).
# With {{nestedPlaceholder=false}} an escaped backslash before a placeholder
({{ \\{{key}} }}) is not restored to a single backslash as documented.
# The {{?nested=true|false}} option is removed from anywhere in the text (such
as a query parameter of an endpoint uri), not only from the key of a
placeholder.
Not changed:
* The resolved value reported for a key (dev console, summary) may be recorded
for the wrong key when using nested placeholders or functions.
* Default values are resolved before the key (so a default with a missing
placeholder fails even when the key exists).
_Claude Code on behalf of Claus Ibsen_
--
This message was sent by Atlassian Jira
(v8.20.10#820010)