ShryukGrandhi opened a new pull request, #4459:
URL: https://github.com/apache/logging-log4j2/pull/4459
`JavaLookup.lookup` threw `IllegalArgumentException(key)` for any key it
doesn't know, while every other lookup returns `null`. `StrSubstitutor`
swallows the exception, so `${java:foo}` stays literal, but the `Interpolator`
never gets to fall back to the default lookup, and each evaluation logs
"Resolver failed to lookup java:foo" to the status logger.
This changes the `default` branch to return `null`, the same as the other
lookups.
Fixes #4457
Testing:
- Added `JavaLookupTest`. It failed with `IllegalArgumentException: BadKey`
before the fix and passes after it.
- Ran `mvn test -pl log4j-core-test -am
-Dtest=org.apache.logging.log4j.core.lookup.*Test` on JDK 17. 88 of 90 tests
pass. The two errors (`MarkerLookupConfigTest`, `ContextMapLookupTest`: "No
class provided, and an appropriate one cannot be found" from
`LogManager.callerClass`) happen without this change too and come from my local
environment.
- `mvn spotless:check -pl log4j-core,log4j-core-test` passes.
## Checklist
* Base your changes on `2.x` branch if you are targeting Log4j 2; use `main`
otherwise
* `./mvnw verify` succeeds ([the build
instructions](https://logging.apache.org/log4j/2.x/development.html#building))
* Non-trivial changes contain an entry file in the `src/changelog/.2.x.x`
directory
* Tests are provided
--
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]