You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@camel.apache.org by "Artem St (Jira)" <ji...@apache.org> on 2024/12/13 13:38:00 UTC
[jira] [Created] (CAMEL-21546) camel-core - simple expressions like ${exchangeProperty.CamelAttachmentObjects} does not working because AbstractExchange.getProperty does not fallback to a safeCopyProperties
Artem St created CAMEL-21546:
--------------------------------
Summary: camel-core - simple expressions like ${exchangeProperty.CamelAttachmentObjects} does not working because AbstractExchange.getProperty does not fallback to a safeCopyProperties
Key: CAMEL-21546
URL: https://issues.apache.org/jira/browse/CAMEL-21546
Project: Camel
Issue Type: Bug
Components: camel-core
Affects Versions: 4.9.0, 3.22.2
Reporter: Artem St
Fix For: 3.22.3, 4.x
I'm not sure if this is a bug or intended behavior, but when we search for properties on an exchange, the search only checks the {{internalProperties}} of the exchange and the {{properties}} map. It does not look into {{{}safeCopyProperties{}}}.
As a result, simple code like this stopped working after the attachments were refactored:
{code:java}
${exchangeProperty.CamelAttachmentObjects}{code}
The current implementation of {{getProperty}} is as follows:
{code:java}
@Override
public Object getProperty(String name) {
Object answer = null;
ExchangePropertyKey key = ExchangePropertyKey.asExchangePropertyKey(name);
if (key != null) {
answer = internalProperties.get(key);
// if the property is not an internal then fallback to lookup in the properties map
}
if (answer == null && properties != null) {
answer = properties.get(name);
}
return answer;
} {code}
Shouldn't it be more like this to include {{safeCopyProperties}} in the lookup?
{code:java}
public Object getProperty(String name) {
Object answer = null;
ExchangePropertyKey key = ExchangePropertyKey.asExchangePropertyKey(name);
if (key != null) {
answer = internalProperties[key.ordinal()];
// if the property is not an internal then fallback to lookup in the properties map
}
if (answer == null && hasSafeCopyProperties()) {
answer = safeCopyProperties.get(name);
}
if (answer == null && properties != null) {
answer = properties.get(name);
}
return answer;
} {code}
--
This message was sent by Atlassian Jira
(v8.20.10#820010)