diff --git a/WORKSPACE b/WORKSPACE index 924a93066b..32de77bc50 100644 --- a/WORKSPACE +++ b/WORKSPACE @@ -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( diff --git a/gerrit-acceptance-framework/src/test/java/com/google/gerrit/acceptance/HttpResponse.java b/gerrit-acceptance-framework/src/test/java/com/google/gerrit/acceptance/HttpResponse.java index b62e932ed1..6c0379358e 100644 --- a/gerrit-acceptance-framework/src/test/java/com/google/gerrit/acceptance/HttpResponse.java +++ b/gerrit-acceptance-framework/src/test/java/com/google/gerrit/acceptance/HttpResponse.java @@ -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; } diff --git a/gerrit-acceptance-framework/src/test/java/com/google/gerrit/acceptance/SshSession.java b/gerrit-acceptance-framework/src/test/java/com/google/gerrit/acceptance/SshSession.java index 3eb0c7f422..b7bfff7b82 100644 --- a/gerrit-acceptance-framework/src/test/java/com/google/gerrit/acceptance/SshSession.java +++ b/gerrit-acceptance-framework/src/test/java/com/google/gerrit/acceptance/SshSession.java @@ -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(); diff --git a/gerrit-gpg/src/test/java/com/google/gerrit/gpg/PushCertificateCheckerTest.java b/gerrit-gpg/src/test/java/com/google/gerrit/gpg/PushCertificateCheckerTest.java index 8b7900d948..3f5bc3cb0a 100644 --- a/gerrit-gpg/src/test/java/com/google/gerrit/gpg/PushCertificateCheckerTest.java +++ b/gerrit-gpg/src/test/java/com/google/gerrit/gpg/PushCertificateCheckerTest.java @@ -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); } diff --git a/gerrit-pgm/src/main/java/com/google/gerrit/pgm/init/InitSshd.java b/gerrit-pgm/src/main/java/com/google/gerrit/pgm/init/InitSshd.java index 0cad722382..d963cbb7ed 100644 --- a/gerrit-pgm/src/main/java/com/google/gerrit/pgm/init/InitSshd.java +++ b/gerrit-pgm/src/main/java/com/google/gerrit/pgm/init/InitSshd.java @@ -104,7 +104,7 @@ class InitSshd implements InitStep { "-q" /* quiet */, "-t", "rsa", - "-P", + "-N", emptyPassphraseArg, "-C", comment, diff --git a/lib/jgit/jgit.bzl b/lib/jgit/jgit.bzl index add3f23aa6..55d5e483ab 100644 --- a/lib/jgit/jgit.bzl +++ b/lib/jgit/jgit.bzl @@ -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",