mvanhorn opened a new pull request, #4474: URL: https://github.com/apache/logging-log4j2/pull/4474
**INSERT HERE** a clear and concise description of what the pull request is for along with a reference to the associated issue IDs, if they exist. A key/value configuration entry can be created with a null or empty key. The entry cannot be referenced, a null key fails when entries are stored in a map, and writing the configuration as XML emits a null key attribute that a later parse cannot read. The pair stored the key exactly as it was passed, and the plugin builder left the key attribute optional, so both construction and configuration accepted a missing key. The configuration builder forwarded that key onto the component, which is what showed up as a null attribute in the generated XML. The constructor now requires a non-empty key and throws IllegalArgumentException when the key is null or empty. The plugin builder marks the key required with the same message, and newKeyValuePair applies the same check before the component is created. A whitespace-only key remains valid, a null value remains valid, and a changelog entry records the fix. A run with the logging-log4j2 ConfigurationBuilder change reverted gave no clear result, so no test is shown to catch this bug. The changed test log4j-core-test/src/test/java/org/apache/logging/log4j/core/config/builder/ConfigurationBuilderTest.java did not run here: no test runner for it was available. The new test log4j-core-test/src/test/java/org/apache/logging/log4j/core/util/KeyValuePairTest.java did not run here: no test runner for it was available. ## Checklist * Base your changes on `2.x` branch if you are targeting Log4j 2; use `main` otherwise * The local test run for the logging-log4j2 ConfigurationBuilder change to `log4j-core/src/main/java/org/apache/logging/log4j/core/config/builder/api/ConfigurationBuilder.java`, `log4j-core/src/main/java/org/apache/logging/log4j/core/config/builder/impl/DefaultConfigurationBuilder.java` and `log4j-core/src/main/java/org/apache/logging/log4j/core/util/KeyValuePair.java` and the other changed files could not complete in this environment. * Non-trivial changes contain an entry file in the `src/changelog/.2.x.x` directory * Tests are provided Fixes #3472 -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
