Problem
Describe the issue you are experiencing.
.toString() is called on a final exception argument, which I think would change semantics: showing stacktrace as opposed to toString value.
Expected behavior
Describe what you expected to see.
I'd have thought this would be picked up here @pdelagrave :
|
!(firstFormatArgIndex == lastArgIndex && TypeUtils.isAssignableTo("java.lang.Throwable", toStringInvocation.getSelect().getType()))) { |
Example diff
From: src/main/java/org/apache/maven/buildcache/RemoteCacheRepositoryImpl.java
transporter.get(task);
return true;
} catch (Exception e) {
- LOGGER.info("Cannot download {}: {}", getFullUrl(url), e.toString());
+ LOGGER.info("Cannot download {}: {}", getFullUrl(url), e);
return false;
}
}
Recipes in example diff:
org.openrewrite.java.logging.slf4j.StripToStringFromArguments
References:
- View original result
- Recipe ID:
org.openrewrite.java.logging.slf4j.StripToStringFromArguments
- Recipe Name:
Strip toString() from arguments
- Repository:
apache/maven-build-cache-extension/master
- Created at Wed Jun 25 2025 23:20:53 GMT+0200 (Central European Summer Time)