RemoteUserUtil: Don't use default platform charset when constructing String

Reported by Error Prone 2.0.15.

Change-Id: Ia16ed7a630ed854722c819a5f2cd244cb0aff290
This commit is contained in:
David Pursehouse
2016-12-12 09:36:50 +09:00
parent cfb0c5b192
commit 3bb12802a7

View File

@@ -16,6 +16,7 @@ package com.google.gerrit.httpd;
import static com.google.common.base.Strings.emptyToNull;
import static com.google.common.net.HttpHeaders.AUTHORIZATION;
import static java.nio.charset.StandardCharsets.UTF_8;
import org.eclipse.jgit.util.Base64;
@@ -72,7 +73,7 @@ public class RemoteUserUtil {
} else if (auth.startsWith("Basic ")) {
auth = auth.substring("Basic ".length());
auth = new String(Base64.decode(auth));
auth = new String(Base64.decode(auth), UTF_8);
final int c = auth.indexOf(':');
return c > 0 ? auth.substring(0, c) : null;