PIT-Lücken in bootstrap gezielt geschlossen

This commit is contained in:
2026-04-09 11:55:17 +02:00
parent 57ea9cf649
commit ca91749a04
3 changed files with 167 additions and 8 deletions
@@ -83,14 +83,9 @@ public class Log4jProcessingLogger implements ProcessingLogger {
@Override
public void error(String message, Object... args) {
// If the last argument is a Throwable, extract it and pass separately
if (args.length > 0 && args[args.length - 1] instanceof Throwable throwable) {
Object[] messageArgs = new Object[args.length - 1];
System.arraycopy(args, 0, messageArgs, 0, args.length - 1);
log4jLogger.error(message, throwable, messageArgs);
} else {
log4jLogger.error(message, args);
}
// Log4j2 detects a trailing Throwable in the params array automatically:
// it uses it as the log cause and formats only the preceding arguments.
log4jLogger.error(message, args);
}
}