Merge branch 'stable-2.14' into stable-2.15

* stable-2.14:
  InitSshd: Use correct flag to set empty passphrase
  SshSession: Specify charset in constructor of Scanner
  Specify charset in constructors of InputStreamReader
  Update JGit dependencies to fix building from source

Change-Id: I994d9d26bb7a1b1333a6380fb81126c1e8dc026d
This commit is contained in:
David Pursehouse 2018-08-31 12:37:23 +09:00
commit 727b108d2a
6 changed files with 17 additions and 12 deletions

View File

@ -675,13 +675,6 @@ maven_jar(
sha1 = "42a25dc3219429f0e5d060061f71acb49bf010a0",
)
# Only needed when jgit is built from the development tree
maven_jar(
name = "hamcrest-library",
artifact = "org.hamcrest:hamcrest-library:1.3",
sha1 = "4785a3c21320980282f9f33d0d1264a69040538f",
)
TRUTH_VERS = "0.35"
maven_jar(

View File

@ -14,6 +14,8 @@
package com.google.gerrit.acceptance;
import static java.nio.charset.StandardCharsets.UTF_8;
import com.google.common.base.Preconditions;
import java.io.IOException;
import java.io.InputStreamReader;
@ -34,7 +36,7 @@ public class HttpResponse {
public Reader getReader() throws IllegalStateException, IOException {
if (reader == null && response.getEntity() != null) {
reader = new InputStreamReader(response.getEntity().getContent());
reader = new InputStreamReader(response.getEntity().getContent(), UTF_8);
}
return reader;
}

View File

@ -17,6 +17,7 @@ package com.google.gerrit.acceptance;
import static com.google.common.base.Preconditions.checkState;
import static com.google.common.truth.Truth.assertThat;
import static com.google.common.truth.Truth.assertWithMessage;
import static java.nio.charset.StandardCharsets.UTF_8;
import com.jcraft.jsch.ChannelExec;
import com.jcraft.jsch.JSch;
@ -52,10 +53,10 @@ public class SshSession {
InputStream err = channel.getErrStream();
channel.connect();
Scanner s = new Scanner(err).useDelimiter("\\A");
Scanner s = new Scanner(err, UTF_8.name()).useDelimiter("\\A");
error = s.hasNext() ? s.next() : null;
s = new Scanner(in).useDelimiter("\\A");
s = new Scanner(in, UTF_8.name()).useDelimiter("\\A");
return s.hasNext() ? s.next() : "";
} finally {
channel.disconnect();

View File

@ -184,7 +184,7 @@ public class PushCertificateCheckerTest {
}
String cert = payload + new String(bout.toByteArray(), UTF_8);
Reader reader = new InputStreamReader(new ByteArrayInputStream(cert.getBytes(UTF_8)));
Reader reader = new InputStreamReader(new ByteArrayInputStream(cert.getBytes(UTF_8)), UTF_8);
PushCertificateParser parser = new PushCertificateParser(repo, signedPushConfig);
return parser.parse(reader);
}

View File

@ -104,7 +104,7 @@ class InitSshd implements InitStep {
"-q" /* quiet */,
"-t",
"rsa",
"-P",
"-N",
emptyPassphraseArg,
"-C",
comment,

View File

@ -18,9 +18,18 @@ def jgit_repos():
name = "jgit",
path = LOCAL_JGIT_REPO,
)
jgit_maven_repos_dev()
else:
jgit_maven_repos()
def jgit_maven_repos_dev():
# Transitive dependencies from JGit's WORKSPACE.
maven_jar(
name = "hamcrest-library",
artifact = "org.hamcrest:hamcrest-library:1.3",
sha1 = "4785a3c21320980282f9f33d0d1264a69040538f",
)
def jgit_maven_repos():
maven_jar(
name = "jgit-lib",