Fix DefaultCharset bug pattern flagged by error prone

See more details in: [1].

[1] https://errorprone.info/bugpattern/DefaultCharset

Change-Id: Ib6aa279f9dcf63dff0672df5b5be3ea72597b1d8
This commit is contained in:
David Ostrovsky 2022-07-02 09:36:56 +02:00 committed by Matthias Sohn
parent 6672bacca4
commit b6b1e0a0ad
1 changed files with 3 additions and 1 deletions

View File

@ -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 static void sign(HttpURLConnection httpURLConnection,
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);