Avoid implicit use of the platform default charset
Change-Id: Ib4e8e1681ce5c075514b5348b6a865aa6711263a
This commit is contained in:

committed by
David Pursehouse

parent
02bed30b38
commit
abe599cb7e
@@ -76,7 +76,7 @@ public abstract class BuildSystem {
|
||||
throw new InterruptedIOException("interrupted waiting for " + proc.toString());
|
||||
}
|
||||
if (status != 0) {
|
||||
log.warn("build failed: " + new String(out));
|
||||
log.warn("build failed: " + new String(out, UTF_8));
|
||||
throw new BuildFailureException(out);
|
||||
}
|
||||
|
||||
|
@@ -96,7 +96,7 @@ public class ChangeResource implements RestResource, HasETag {
|
||||
|
||||
if (user.isIdentifiedUser()) {
|
||||
for (AccountGroup.UUID uuid : user.getEffectiveGroups().getKnownGroups()) {
|
||||
h.putBytes(uuid.get().getBytes());
|
||||
h.putBytes(uuid.get().getBytes(UTF_8));
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -14,6 +14,8 @@
|
||||
|
||||
package com.google.gerrit.server.patch;
|
||||
|
||||
import static java.nio.charset.StandardCharsets.UTF_8;
|
||||
|
||||
import com.google.gerrit.common.data.CommentDetail;
|
||||
import com.google.gerrit.common.data.PatchScript;
|
||||
import com.google.gerrit.common.data.PatchScript.DisplayMethod;
|
||||
@@ -501,7 +503,7 @@ class PatchScriptBuilder {
|
||||
|
||||
} else if (mode.getObjectType() == Constants.OBJ_COMMIT) {
|
||||
String strContent = "Subproject commit " + ObjectId.toString(id);
|
||||
srcContent = strContent.getBytes();
|
||||
srcContent = strContent.getBytes(UTF_8);
|
||||
|
||||
} else {
|
||||
srcContent = Text.NO_BYTES;
|
||||
|
@@ -15,6 +15,7 @@
|
||||
package com.google.gerrit.server.plugins;
|
||||
|
||||
import static com.google.common.base.Preconditions.checkState;
|
||||
import static java.nio.charset.StandardCharsets.UTF_8;
|
||||
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
import com.google.gerrit.extensions.annotations.Export;
|
||||
@@ -80,7 +81,7 @@ public abstract class AbstractPreloadedPluginScanner implements PluginContentSca
|
||||
appendIfNotNull(manifestString, "Gerrit-SshModule: ", sshModuleClass);
|
||||
appendIfNotNull(manifestString, "Gerrit-HttpModule: ", httpModuleClass);
|
||||
appendIfNotNull(manifestString, "Gerrit-Module: ", sysModuleClass);
|
||||
return new Manifest(new ByteArrayInputStream(manifestString.toString().getBytes()));
|
||||
return new Manifest(new ByteArrayInputStream(manifestString.toString().getBytes(UTF_8)));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@@ -137,7 +137,7 @@ final class ScpCommand extends BaseCommand {
|
||||
|
||||
try {
|
||||
out.write(2);
|
||||
out.write(e.getMessage().getBytes());
|
||||
out.write(e.getMessage().getBytes(UTF_8));
|
||||
out.write('\n');
|
||||
out.flush();
|
||||
} catch (IOException e2) {
|
||||
|
@@ -230,7 +230,7 @@ final class SetAccountCommand extends SshCommand {
|
||||
throws RestApiException, OrmException, IOException, ConfigInvalidException {
|
||||
for (final String sshKey : sshKeys) {
|
||||
AddSshKey.Input in = new AddSshKey.Input();
|
||||
in.raw = RawInputUtil.create(sshKey.getBytes(), "plain/text");
|
||||
in.raw = RawInputUtil.create(sshKey.getBytes(UTF_8), "plain/text");
|
||||
addSshKey.apply(rsrc, in);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user