rewrite
rewrite copied to clipboard
Issue discovered with `src/main/java/software/aws/mcs/auth/SigV4AuthProvider.java`
Problem
Transforms recipe on the SaaS works fine when running the rewrite-maven-plugin
Expected behavior
Removes
UnsupportedEncodingException
while the method declaration has a statement which invokes a private method that throws anUnsupportedEncodingException
https://github.com/aws/aws-sigv4-auth-cassandra-java-driver-plugin/blob/6f32f547dbb82795baf08b2055bb346ac4c917ef/src/main/java/software/aws/mcs/auth/SigV4AuthProvider.java#L263
https://github.com/aws/aws-sigv4-auth-cassandra-java-driver-plugin/blob/6f32f547dbb82795baf08b2055bb346ac4c917ef/src/main/java/software/aws/mcs/auth/SigV4AuthProvider.java#L291-L303
Example diff
return Arrays.copyOfRange(challenge, nonceStart, nonceEnd);
}
- private String generateSignature(byte[] nonce, Instant requestTimestamp, AwsCredentials credentials) throws UnsupportedEncodingException {
+ private String generateSignature(byte[] nonce, Instant requestTimestamp, AwsCredentials credentials) {
String credentialScopeDate = Aws4SignerUtils.formatDateStamp(requestTimestamp.toEpochMilli());
String signingScope = String.format("%s/%s/%s/aws4_request", credentialScopeDate, signingRegion, CANONICAL_SERVICE);
Recipes in example diff:
- org.openrewrite.java.cleanup.UnnecessaryThrows
References:
- Recipe ID:
undefined
- Recipe Name: "Unnecessary throws"
- Repository: aws/aws-sigv4-auth-cassandra-java-driver-plugin/master
- Created at Mon Aug 08 2022 09:52:39 GMT-0700 (Pacific Daylight Time)