You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@camel.apache.org by "Adriano Machado (Jira)" <ji...@apache.org> on 2026/07/08 16:55:00 UTC

[jira] [Updated] (CAMEL-23971) BaseOrderedProperties missing containsKey/contains/containsValue overrides

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

Adriano Machado updated CAMEL-23971:
------------------------------------
    Description: 
BaseOrderedProperties (in core/camel-util) extends Properties which extends Hashtable, but stores all data in a private LinkedHashMap. It overrides put(), get(), getProperty(), keySet(), remove(), etc. to delegate to the map, but does NOT override containsKey(), contains(), or containsValue().

Because put() never stores into the parent Hashtable, the inherited Hashtable.containsKey() always returns false. This silently breaks ~10 call sites across the codebase:

- VersionSetTest: assertions are vacuously true (always pass regardless of actual state)
- DependencyList, ExportBaseCommand, ExportSpringBoot, ExportCamelMain, ExportQuarkus: conditional guards that never fire, so properties are always overwritten instead of preserved
- BaseMainSupport, MainHelper: property-consumed checks that never detect consumed properties

Discovered while working on CAMEL-23867 (TUI settings per-key config routing). The immediate workaround there was to use getProperty(key) != null instead of containsKey(key), but the root cause belongs in BaseOrderedProperties.

Fix: add three overrides delegating to the internal map (containsKey, containsValue, and the legacy contains). This affects OrderedProperties, CamelCaseOrderedProperties, and OrderedLocationProperties (all subclasses). A full build is needed to verify that fixing the bug does not break tests that accidentally depended on the broken behavior.

_Reported by Claude Code on behalf of Adriano Machado._

  was:
BaseOrderedProperties (in core/camel-util) extends Properties which extends Hashtable, but stores all data in a private LinkedHashMap. It overrides put(), get(), getProperty(), keySet(), remove(), etc. to delegate to the map, but does NOT override containsKey(), contains(), or containsValue().

Because put() never stores into the parent Hashtable, the inherited Hashtable.containsKey() always returns false. This silently breaks ~10 call sites across the codebase:

- VersionSetTest: assertions are vacuously true (always pass regardless of actual state)
- DependencyList, ExportBaseCommand, ExportSpringBoot, ExportCamelMain, ExportQuarkus: conditional guards that never fire, so properties are always overwritten instead of preserved
- BaseMainSupport, MainHelper: property-consumed checks that never detect consumed properties

Discovered while working on CAMEL-23867 (TUI settings per-key config routing). The immediate workaround there was to use getProperty(key) != null instead of containsKey(key), but the root cause belongs in BaseOrderedProperties.

Fix: add three overrides delegating to the internal map (containsKey, containsValue, and the legacy contains). This affects OrderedProperties, CamelCaseOrderedProperties, and OrderedLocationProperties (all subclasses). A full build is needed to verify that fixing the bug does not break tests that accidentally depended on the broken behavior.


> BaseOrderedProperties missing containsKey/contains/containsValue overrides
> --------------------------------------------------------------------------
>
>                 Key: CAMEL-23971
>                 URL: https://issues.apache.org/jira/browse/CAMEL-23971
>             Project: Camel
>          Issue Type: Bug
>          Components: camel-core
>            Reporter: Adriano Machado
>            Priority: Major
>
> BaseOrderedProperties (in core/camel-util) extends Properties which extends Hashtable, but stores all data in a private LinkedHashMap. It overrides put(), get(), getProperty(), keySet(), remove(), etc. to delegate to the map, but does NOT override containsKey(), contains(), or containsValue().
> Because put() never stores into the parent Hashtable, the inherited Hashtable.containsKey() always returns false. This silently breaks ~10 call sites across the codebase:
> - VersionSetTest: assertions are vacuously true (always pass regardless of actual state)
> - DependencyList, ExportBaseCommand, ExportSpringBoot, ExportCamelMain, ExportQuarkus: conditional guards that never fire, so properties are always overwritten instead of preserved
> - BaseMainSupport, MainHelper: property-consumed checks that never detect consumed properties
> Discovered while working on CAMEL-23867 (TUI settings per-key config routing). The immediate workaround there was to use getProperty(key) != null instead of containsKey(key), but the root cause belongs in BaseOrderedProperties.
> Fix: add three overrides delegating to the internal map (containsKey, containsValue, and the legacy contains). This affects OrderedProperties, CamelCaseOrderedProperties, and OrderedLocationProperties (all subclasses). A full build is needed to verify that fixing the bug does not break tests that accidentally depended on the broken behavior.
> _Reported by Claude Code on behalf of Adriano Machado._



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