summaryrefslogtreecommitdiffstats
path: root/org.eclipse.jgit.ssh.apache
diff options
context:
space:
mode:
authorThomas Wolf <thomas.wolf@paranor.ch>2021-11-02 19:20:59 +0100
committerMatthias Sohn <matthias.sohn@sap.com>2021-11-03 23:45:32 +0100
commitc04884fc9166fe491745fa51bd7540ff36ce6e7c (patch)
tree73a3006470bff99428ba63333357fb900c86a0a6 /org.eclipse.jgit.ssh.apache
parent4184ff0953b2569799221d423e77fd2f6880f77d (diff)
downloadjgit-c04884fc9166fe491745fa51bd7540ff36ce6e7c.tar.gz
jgit-c04884fc9166fe491745fa51bd7540ff36ce6e7c.zip
[releng] bazel: Enable errorprone on o.e.j.ssh.apache
Fix the few issues reported. (None serious.) Change-Id: I8d72ef7d425ab61f4c27b657c92fc021850730d6 Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
Diffstat (limited to 'org.eclipse.jgit.ssh.apache')
-rw-r--r--org.eclipse.jgit.ssh.apache/src/org/eclipse/jgit/internal/transport/sshd/JGitSshClient.java2
-rw-r--r--org.eclipse.jgit.ssh.apache/src/org/eclipse/jgit/internal/transport/sshd/auth/BasicAuthentication.java4
-rw-r--r--org.eclipse.jgit.ssh.apache/src/org/eclipse/jgit/internal/transport/sshd/proxy/AbstractClientProxyConnector.java2
-rw-r--r--org.eclipse.jgit.ssh.apache/src/org/eclipse/jgit/internal/transport/sshd/proxy/HttpClientConnector.java7
-rw-r--r--org.eclipse.jgit.ssh.apache/src/org/eclipse/jgit/internal/transport/sshd/proxy/HttpParser.java19
-rw-r--r--org.eclipse.jgit.ssh.apache/src/org/eclipse/jgit/internal/transport/sshd/proxy/Socks5ClientConnector.java2
6 files changed, 27 insertions, 9 deletions
diff --git a/org.eclipse.jgit.ssh.apache/src/org/eclipse/jgit/internal/transport/sshd/JGitSshClient.java b/org.eclipse.jgit.ssh.apache/src/org/eclipse/jgit/internal/transport/sshd/JGitSshClient.java
index 32819aea21..fdb8cde670 100644
--- a/org.eclipse.jgit.ssh.apache/src/org/eclipse/jgit/internal/transport/sshd/JGitSshClient.java
+++ b/org.eclipse.jgit.ssh.apache/src/org/eclipse/jgit/internal/transport/sshd/JGitSshClient.java
@@ -439,7 +439,7 @@ public class JGitSshClient extends SshClient {
@Override
public KeyPair next() {
- if (hasElement == null && !hasNext()
+ if ((hasElement == null && !hasNext())
|| !hasElement.booleanValue()) {
throw new NoSuchElementException();
}
diff --git a/org.eclipse.jgit.ssh.apache/src/org/eclipse/jgit/internal/transport/sshd/auth/BasicAuthentication.java b/org.eclipse.jgit.ssh.apache/src/org/eclipse/jgit/internal/transport/sshd/auth/BasicAuthentication.java
index eae0d75355..e5f884e299 100644
--- a/org.eclipse.jgit.ssh.apache/src/org/eclipse/jgit/internal/transport/sshd/auth/BasicAuthentication.java
+++ b/org.eclipse.jgit.ssh.apache/src/org/eclipse/jgit/internal/transport/sshd/auth/BasicAuthentication.java
@@ -95,8 +95,8 @@ public abstract class BasicAuthentication<ParameterType, TokenType>
@Override
public final void start() throws Exception {
- if (user != null && !user.isEmpty()
- || password != null && password.length > 0) {
+ if ((user != null && !user.isEmpty())
+ || (password != null && password.length > 0)) {
return;
}
askCredentials();
diff --git a/org.eclipse.jgit.ssh.apache/src/org/eclipse/jgit/internal/transport/sshd/proxy/AbstractClientProxyConnector.java b/org.eclipse.jgit.ssh.apache/src/org/eclipse/jgit/internal/transport/sshd/proxy/AbstractClientProxyConnector.java
index 54e2cbcebf..ae2b2b6acc 100644
--- a/org.eclipse.jgit.ssh.apache/src/org/eclipse/jgit/internal/transport/sshd/proxy/AbstractClientProxyConnector.java
+++ b/org.eclipse.jgit.ssh.apache/src/org/eclipse/jgit/internal/transport/sshd/proxy/AbstractClientProxyConnector.java
@@ -31,7 +31,7 @@ public abstract class AbstractClientProxyConnector
.toMillis(30L);
/** Guards {@link #done} and {@link #bufferedCommands}. */
- private Object lock = new Object();
+ private final Object lock = new Object();
private boolean done;
diff --git a/org.eclipse.jgit.ssh.apache/src/org/eclipse/jgit/internal/transport/sshd/proxy/HttpClientConnector.java b/org.eclipse.jgit.ssh.apache/src/org/eclipse/jgit/internal/transport/sshd/proxy/HttpClientConnector.java
index e5d1e80f74..b7deb29dc4 100644
--- a/org.eclipse.jgit.ssh.apache/src/org/eclipse/jgit/internal/transport/sshd/proxy/HttpClientConnector.java
+++ b/org.eclipse.jgit.ssh.apache/src/org/eclipse/jgit/internal/transport/sshd/proxy/HttpClientConnector.java
@@ -113,8 +113,8 @@ public class HttpClientConnector extends AbstractClientProxyConnector {
IoSession session = sshSession.getIoSession();
session.addCloseFutureListener(f -> close());
StringBuilder msg = connect();
- if (proxyUser != null && !proxyUser.isEmpty()
- || proxyPassword != null && proxyPassword.length > 0) {
+ if ((proxyUser != null && !proxyUser.isEmpty())
+ || (proxyPassword != null && proxyPassword.length > 0)) {
authenticator = basic;
basic.setParams(null);
basic.start();
@@ -232,7 +232,8 @@ public class HttpClientConnector extends AbstractClientProxyConnector {
} catch (HttpParser.ParseException e) {
throw new IOException(
format(SshdText.get().proxyHttpUnexpectedReply,
- proxyAddress, reply.get(0)));
+ proxyAddress, reply.get(0)),
+ e);
}
}
diff --git a/org.eclipse.jgit.ssh.apache/src/org/eclipse/jgit/internal/transport/sshd/proxy/HttpParser.java b/org.eclipse.jgit.ssh.apache/src/org/eclipse/jgit/internal/transport/sshd/proxy/HttpParser.java
index 0500a63428..ece22af1ce 100644
--- a/org.eclipse.jgit.ssh.apache/src/org/eclipse/jgit/internal/transport/sshd/proxy/HttpParser.java
+++ b/org.eclipse.jgit.ssh.apache/src/org/eclipse/jgit/internal/transport/sshd/proxy/HttpParser.java
@@ -31,6 +31,23 @@ public final class HttpParser {
private static final long serialVersionUID = -1634090143702048640L;
+ /**
+ * Creates a new {@link ParseException} without cause.
+ */
+ public ParseException() {
+ super();
+ }
+
+ /**
+ * Creates a new {@link ParseException} with the given {@code cause}.
+ *
+ * @param cause
+ * {@link Throwable} that caused this exception, or
+ * {@code null} if none
+ */
+ public ParseException(Throwable cause) {
+ super(cause);
+ }
}
private HttpParser() {
@@ -64,7 +81,7 @@ public final class HttpParser {
resultCode = Integer.parseUnsignedInt(
line.substring(firstBlank + 1, secondBlank));
} catch (NumberFormatException e) {
- throw new ParseException();
+ throw new ParseException(e);
}
// Again, accept even if the reason is missing
String reason = ""; //$NON-NLS-1$
diff --git a/org.eclipse.jgit.ssh.apache/src/org/eclipse/jgit/internal/transport/sshd/proxy/Socks5ClientConnector.java b/org.eclipse.jgit.ssh.apache/src/org/eclipse/jgit/internal/transport/sshd/proxy/Socks5ClientConnector.java
index 8844efa6b7..bb227bbac8 100644
--- a/org.eclipse.jgit.ssh.apache/src/org/eclipse/jgit/internal/transport/sshd/proxy/Socks5ClientConnector.java
+++ b/org.eclipse.jgit.ssh.apache/src/org/eclipse/jgit/internal/transport/sshd/proxy/Socks5ClientConnector.java
@@ -94,7 +94,7 @@ public class Socks5ClientConnector extends AbstractClientProxyConnector {
// JSON(9),
NONE_ACCEPTABLE(0xFF);
- private byte value;
+ private final byte value;
SocksAuthenticationMethod(int value) {
this.value = (byte) value;