summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Ostrovsky <david@ostrovsky.org>2022-07-02 09:36:56 +0200
committerMatthias Sohn <matthias.sohn@sap.com>2023-09-25 18:38:12 -0400
commitb6b1e0a0adda605f7a62c915d1aef606b961e36f (patch)
tree1237d19f13e5c8d548c217498ac3299a958787b3
parent6672bacca45fe8e06ffd01c81e85ae7272d80426 (diff)
downloadjgit-b6b1e0a0adda605f7a62c915d1aef606b961e36f.tar.gz
jgit-b6b1e0a0adda605f7a62c915d1aef606b961e36f.zip
Fix DefaultCharset bug pattern flagged by error prone
See more details in: [1]. [1] https://errorprone.info/bugpattern/DefaultCharset Change-Id: Ib6aa279f9dcf63dff0672df5b5be3ea72597b1d8
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/transport/AwsRequestSignerV4.java4
1 files changed, 3 insertions, 1 deletions
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/transport/AwsRequestSignerV4.java b/org.eclipse.jgit/src/org/eclipse/jgit/transport/AwsRequestSignerV4.java
index ab3013762b..cf4420fe58 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/transport/AwsRequestSignerV4.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/transport/AwsRequestSignerV4.java
@@ -10,6 +10,8 @@
package org.eclipse.jgit.transport;
+import static java.nio.charset.StandardCharsets.UTF_8;
+
import java.net.HttpURLConnection;
import java.net.URL;
import java.nio.charset.StandardCharsets;
@@ -145,7 +147,7 @@ public final class AwsRequestSignerV4 {
canonicalRequest.getBytes(StandardCharsets.UTF_8)));
// compute the signing key
- byte[] secretKey = (SCHEME + new String(awsSecretKey)).getBytes();
+ byte[] secretKey = (SCHEME + new String(awsSecretKey)).getBytes(UTF_8);
byte[] dateKey = signStringWithKey(scopeDate, secretKey);
byte[] regionKey = signStringWithKey(regionName, dateKey);
byte[] serviceKey = signStringWithKey(serviceName, regionKey);