Claus Ibsen created CAMEL-25111:
-----------------------------------

             Summary: camel-core - Properties component: fix bugs found in a 
deep review
                 Key: CAMEL-25111
                 URL: https://issues.apache.org/jira/browse/CAMEL-25111
             Project: Camel
          Issue Type: Bug
          Components: camel-core
            Reporter: Claus Ibsen


A review of the properties component (camel-base) found these bugs:

# Reloading properties ({{reloadProperties}}, such as from route reload or JMX) 
clears and then fills the properties of a location, so concurrent lookups can 
fail with "Property not found" while reloading.
# Adding a properties source at runtime (such as route reload adding a file 
source) can make concurrent lookups fail with ConcurrentModificationException, 
as the list of sources is not thread-safe.
# Every lookup of a property from a {{LoadablePropertiesSource}} that is not a 
location (such as the MicroProfile Config source) loads all the properties of 
that source, only to find the location of the property.
# Reloading a location marked as optional ({{;optional=true}}) fails when the 
file has been removed, as the optional flag is not kept.
# A location with an unknown (or misspelled) resolver, such as 
{{Classpath:app.properties}} or {{C:\app.properties}}, is silently ignored.
# {{PropertiesComponent.addLocation(PropertiesLocation)}} does not create a 
properties source (the location is not used), and fails with 
UnsupportedOperationException after {{setLocation}}.
# Looking up environment variables uses {{toUpperCase()}} without a locale, so 
keys with an {{i}} are not found in the Turkish locale ({{file.index}} becomes 
{{FİLE_İNDEX}}).
# A properties function that is resolved at runtime from concurrent threads can 
be created and started more than once (only one is kept, the others are not 
stopped).
# {{getResolvedValue}} fails with NullPointerException before the component is 
built.
# The {{service}} function upper-cases the name before looking up the 
environment variables, so a camelCase name ({{service:mySvc}}) is not found, 
while the {{service.host}} and {{service.port}} functions find it.
# The location of override and initial properties 
({{OrderedLocationProperties}}) is not used, so the source of a resolved value 
is reported as OverrideProperties/InitialProperties.
# A {{;}} in the path of a location cuts off the path, also when no option 
follows ({{file:/a;b/app.properties}} becomes {{/a}}).

Not changed:
* The documentation shows {{ {{env:X}} }} in locations, which is only resolved 
when the location itself is set using property binding.
* A missing {{ref:}} location is only detected when looking up a property.

_Claude Code on behalf of Claus Ibsen_



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to