You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Merging two application configurations with OVERRIDE_ALL or OVERRIDE_IF_ABSENT calls AbstractConfig.overrideWithConfig. The following isolates the same merge:
Use imports org.apache.dubbo.config.ApplicationConfig and java.util.Collections.
The merge fails with IllegalStateException caused by UnsupportedOperationException: oldMap.forEach(newMap::putIfAbsent) writes into the incoming, read-only map. Passing false fails at newMap.putAll(oldMap) instead.
With a mutable incoming map, the merge completes but adds old-only to that map. In OVERRIDE_IF_ABSENT, values for overlapping keys in the incoming configuration are also overwritten by the target's values.
What you expected to happen
The target should receive the merged parameters, respecting the selected mode's precedence. The incoming configuration and its caller-provided map should retain their original entries. Providing read-only parameters should not prevent the merge.
Anything else
Four parameterized regression cases reproduce both behaviors through ConfigManager.addConfig: two modes, each with mutable or unmodifiable incoming parameters. On the original code, two cases fail source-map assertions and two error with UnsupportedOperationException. Copying the incoming map before merging makes all four pass, while retaining the existing key precedence.
Are you willing to submit a pull request?
Yes. A minimal fix and regression tests are prepared.
Activity