Copilot commented on code in PR #3772:
URL: https://github.com/apache/logging-log4j2/pull/3772#discussion_r2167713119
##########
log4j-core/src/main/java/org/apache/logging/log4j/core/config/plugins/processor/GraalVmProcessor.java:
##########
@@ -184,11 +188,21 @@ private void processFactory(Element element) {
}
private void writeReachabilityMetadata() {
- //
- // Many users will have `log4j-core` on the annotation processor path,
but do not have Log4j Plugins.
- // Therefore, we check for the annotation processor required options
only if some elements were processed.
- //
- String reachabilityMetadataPath = getReachabilityMetadataPath();
+ // Compute the reachability metadata
+ ByteArrayOutputStream arrayOutputStream = new ByteArrayOutputStream();
+ try {
+ ReachabilityMetadata.writeReflectConfig(reachableTypes.values(),
arrayOutputStream);
+ } catch (IOException e) {
+ String message = String.format(
+ "%s: an error occurred while generating reachability
metadata" + e.getMessage(), PROCESSOR_NAME);
Review Comment:
The `String.format` call concatenates `e.getMessage()` into the format
string but only provides one placeholder (`%s`), so the exception message isn't
formatted correctly. Consider using two placeholders (e.g., `"%s: an error
occurred while generating reachability metadata: %s"`) and passing both
`PROCESSOR_NAME` and `e.getMessage()` as arguments.
```suggestion
"%s: an error occurred while generating reachability
metadata: %s", PROCESSOR_NAME, e.getMessage());
```
--
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]