Skip to content

Commit c04884f

Browse files
Thomas Wolfmsohn
Thomas Wolf
authored andcommitted
[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>
1 parent 4184ff0 commit c04884f

File tree

7 files changed

+28
-9
lines changed

7 files changed

+28
-9
lines changed

org.eclipse.jgit.ssh.apache/src/org/eclipse/jgit/internal/transport/sshd/JGitSshClient.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -439,7 +439,7 @@ public boolean hasNext() {
439439

440440
@Override
441441
public KeyPair next() {
442-
if (hasElement == null && !hasNext()
442+
if ((hasElement == null && !hasNext())
443443
|| !hasElement.booleanValue()) {
444444
throw new NoSuchElementException();
445445
}

org.eclipse.jgit.ssh.apache/src/org/eclipse/jgit/internal/transport/sshd/auth/BasicAuthentication.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -95,8 +95,8 @@ public final void close() {
9595

9696
@Override
9797
public final void start() throws Exception {
98-
if (user != null && !user.isEmpty()
99-
|| password != null && password.length > 0) {
98+
if ((user != null && !user.isEmpty())
99+
|| (password != null && password.length > 0)) {
100100
return;
101101
}
102102
askCredentials();

org.eclipse.jgit.ssh.apache/src/org/eclipse/jgit/internal/transport/sshd/proxy/AbstractClientProxyConnector.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ public abstract class AbstractClientProxyConnector
3131
.toMillis(30L);
3232

3333
/** Guards {@link #done} and {@link #bufferedCommands}. */
34-
private Object lock = new Object();
34+
private final Object lock = new Object();
3535

3636
private boolean done;
3737

org.eclipse.jgit.ssh.apache/src/org/eclipse/jgit/internal/transport/sshd/proxy/HttpClientConnector.java

+4-3
Original file line numberDiff line numberDiff line change
@@ -113,8 +113,8 @@ public void sendClientProxyMetadata(ClientSession sshSession)
113113
IoSession session = sshSession.getIoSession();
114114
session.addCloseFutureListener(f -> close());
115115
StringBuilder msg = connect();
116-
if (proxyUser != null && !proxyUser.isEmpty()
117-
|| proxyPassword != null && proxyPassword.length > 0) {
116+
if ((proxyUser != null && !proxyUser.isEmpty())
117+
|| (proxyPassword != null && proxyPassword.length > 0)) {
118118
authenticator = basic;
119119
basic.setParams(null);
120120
basic.start();
@@ -232,7 +232,8 @@ private void handleMessage(IoSession session, List<String> reply)
232232
} catch (HttpParser.ParseException e) {
233233
throw new IOException(
234234
format(SshdText.get().proxyHttpUnexpectedReply,
235-
proxyAddress, reply.get(0)));
235+
proxyAddress, reply.get(0)),
236+
e);
236237
}
237238
}
238239

org.eclipse.jgit.ssh.apache/src/org/eclipse/jgit/internal/transport/sshd/proxy/HttpParser.java

+18-1
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,23 @@ public static class ParseException extends Exception {
3131

3232
private static final long serialVersionUID = -1634090143702048640L;
3333

34+
/**
35+
* Creates a new {@link ParseException} without cause.
36+
*/
37+
public ParseException() {
38+
super();
39+
}
40+
41+
/**
42+
* Creates a new {@link ParseException} with the given {@code cause}.
43+
*
44+
* @param cause
45+
* {@link Throwable} that caused this exception, or
46+
* {@code null} if none
47+
*/
48+
public ParseException(Throwable cause) {
49+
super(cause);
50+
}
3451
}
3552

3653
private HttpParser() {
@@ -64,7 +81,7 @@ public static StatusLine parseStatusLine(String line)
6481
resultCode = Integer.parseUnsignedInt(
6582
line.substring(firstBlank + 1, secondBlank));
6683
} catch (NumberFormatException e) {
67-
throw new ParseException();
84+
throw new ParseException(e);
6885
}
6986
// Again, accept even if the reason is missing
7087
String reason = ""; //$NON-NLS-1$

org.eclipse.jgit.ssh.apache/src/org/eclipse/jgit/internal/transport/sshd/proxy/Socks5ClientConnector.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ private enum SocksAuthenticationMethod {
9494
// JSON(9),
9595
NONE_ACCEPTABLE(0xFF);
9696

97-
private byte value;
97+
private final byte value;
9898

9999
SocksAuthenticationMethod(int value) {
100100
this.value = (byte) value;

tools/BUILD

+1
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,7 @@ package_group(
120120
"//org.eclipse.jgit.packaging/...",
121121
"//org.eclipse.jgit.pgm.test/...",
122122
"//org.eclipse.jgit.pgm/...",
123+
"//org.eclipse.jgit.ssh.apache/...",
123124
"//org.eclipse.jgit.test/...",
124125
"//org.eclipse.jgit.ui/...",
125126
"//org.eclipse.jgit/...",

0 commit comments

Comments
 (0)