Fixed some minor Eclipse warnings
diff --git a/sshd-common/src/main/java/org/apache/sshd/common/config/keys/OpenSshCertificate.java b/sshd-common/src/main/java/org/apache/sshd/common/config/keys/OpenSshCertificate.java
index 8fcc8aa..525c4f6 100644
--- a/sshd-common/src/main/java/org/apache/sshd/common/config/keys/OpenSshCertificate.java
+++ b/sshd-common/src/main/java/org/apache/sshd/common/config/keys/OpenSshCertificate.java
@@ -56,7 +56,7 @@
}
/**
- * The minimal {@link #getValidAfter()} or {@link #getValidBefore()} value, corresponding to {@link Instant#EPOCH}.
+ * The minimal {@link #getValidAfter()} or {@link #getValidBefore()} value, corresponding to {@code Instant#EPOCH}.
*/
long MIN_EPOCH = 0L;
diff --git a/sshd-common/src/main/java/org/apache/sshd/common/util/buffer/Buffer.java b/sshd-common/src/main/java/org/apache/sshd/common/util/buffer/Buffer.java
index 396a64b..55e419f 100644
--- a/sshd-common/src/main/java/org/apache/sshd/common/util/buffer/Buffer.java
+++ b/sshd-common/src/main/java/org/apache/sshd/common/util/buffer/Buffer.java
@@ -812,6 +812,7 @@
* Then the entire name + data strings are added as bytes (which will get a length prefix)
*
* @param options to write into the buffer, may be {@code null} or empty but must not contain {@code null} elements
+ * @param charset The {@link Charset} to use for string options
*/
public void putCertificateOptions(List<OpenSshCertificate.CertificateOption> options, Charset charset) {
int numObjects = GenericUtils.size(options);
diff --git a/sshd-core/src/main/java/org/apache/sshd/certificate/OpenSshCertificateBuilder.java b/sshd-core/src/main/java/org/apache/sshd/certificate/OpenSshCertificateBuilder.java
index 6a25a71..5070e73 100644
--- a/sshd-core/src/main/java/org/apache/sshd/certificate/OpenSshCertificateBuilder.java
+++ b/sshd-core/src/main/java/org/apache/sshd/certificate/OpenSshCertificateBuilder.java
@@ -126,7 +126,8 @@
/**
* If null, uses {@link OpenSshCertificate#MIN_EPOCH}
*
- * @param validAfter {@link Instant} to use for validBefore
+ * @param validAfter {@link Instant} to use for validBefore
+ * @return Self reference
*/
public OpenSshCertificateBuilder validAfter(Instant validAfter) {
if (validAfter == null) {
@@ -145,7 +146,8 @@
/**
* If null, uses {@link OpenSshCertificate#INFINITY}
*
- * @param validBefore {@link Instant} to use for validBefore
+ * @param validBefore {@link Instant} to use for validBefore
+ * @return Self reference
*/
public OpenSshCertificateBuilder validBefore(Instant validBefore) {
if (validBefore == null) {
diff --git a/sshd-core/src/test/java/org/apache/sshd/certificates/OpenSSHCertificateParserTest.java b/sshd-core/src/test/java/org/apache/sshd/certificates/OpenSSHCertificateParserTest.java
index ebf16d3..adcb0be 100644
--- a/sshd-core/src/test/java/org/apache/sshd/certificates/OpenSSHCertificateParserTest.java
+++ b/sshd-core/src/test/java/org/apache/sshd/certificates/OpenSSHCertificateParserTest.java
@@ -62,25 +62,27 @@
new TestParams("rsa-sha2-512", "user01_ecdsa_521"));
}
+ @SuppressWarnings("synthetic-access")
private String getCertificateResource() {
return USER_KEY_PATH + params.privateKey + "-cert.pub";
}
@Test
- public void parseCertificate() throws Exception {
+ @SuppressWarnings("synthetic-access")
+ public void testParseCertificate() throws Exception {
try (InputStream certInputStream
= Thread.currentThread().getContextClassLoader().getResourceAsStream(getCertificateResource())) {
- final byte[] certBytes = IoUtils.toByteArray(certInputStream);
- final String certLine = GenericUtils.replaceWhitespaceAndTrim(new String(certBytes, StandardCharsets.UTF_8));
+ byte[] certBytes = IoUtils.toByteArray(certInputStream);
+ String certLine = GenericUtils.replaceWhitespaceAndTrim(new String(certBytes, StandardCharsets.UTF_8));
- final PublicKeyEntry certPublicKeyEntry = PublicKeyEntry.parsePublicKeyEntry(certLine);
- final PublicKey cert = certPublicKeyEntry.resolvePublicKey(null, null, null);
+ PublicKeyEntry certPublicKeyEntry = PublicKeyEntry.parsePublicKeyEntry(certLine);
+ PublicKey cert = certPublicKeyEntry.resolvePublicKey(null, null, null);
assertObjectInstanceOf("Must be OpenSshCertificate instance", OpenSshCertificate.class, cert);
- final OpenSshCertificate typedCert = (OpenSshCertificate) cert;
+ OpenSshCertificate typedCert = (OpenSshCertificate) cert;
assertEquals(Collections.singletonList("user01"), typedCert.getPrincipals());
assertEquals(OpenSshCertificate.Type.USER, typedCert.getType());
@@ -116,7 +118,6 @@
}
private static class TestParams {
-
private final String sigAlgorithm;
private final String privateKey;
@@ -124,7 +125,5 @@
this.sigAlgorithm = sigAlgorithm;
this.privateKey = privateKey;
}
-
}
-
}
diff --git a/sshd-core/src/test/java/org/apache/sshd/common/forward/PortForwardingLoadTest.java b/sshd-core/src/test/java/org/apache/sshd/common/forward/PortForwardingLoadTest.java
index 1bbe342..57f7e7f 100644
--- a/sshd-core/src/test/java/org/apache/sshd/common/forward/PortForwardingLoadTest.java
+++ b/sshd-core/src/test/java/org/apache/sshd/common/forward/PortForwardingLoadTest.java
@@ -497,7 +497,8 @@
resp.append("0123456789\n");
}
resp.append("</body></html>\n");
- final StringBuilder sb = new StringBuilder();
+
+ StringBuilder sb = new StringBuilder();
sb.append("HTTP/1.1 200 OK").append('\n');
sb.append("Content-Type: text/HTML").append('\n');
sb.append("Content-Length: ").append(resp.length()).append('\n');
@@ -512,25 +513,26 @@
});
acceptor.setReuseAddress(true);
acceptor.bind(new InetSocketAddress(0));
- final int port = acceptor.getLocalAddress().getPort();
+ int port = acceptor.getLocalAddress().getPort();
Session session = createSession();
try {
- final int forwardedPort1 = session.setPortForwardingL(0, host, port);
- final int forwardedPort2 = CoreTestSupportUtils.getFreePort();
+ int forwardedPort1 = session.setPortForwardingL(0, host, port);
+ int forwardedPort2 = CoreTestSupportUtils.getFreePort();
session.setPortForwardingR(forwardedPort2, TEST_LOCALHOST, forwardedPort1);
outputDebugMessage("URL: http://localhost %s", forwardedPort2);
- final CountDownLatch latch = new CountDownLatch(nbThread * nbDownloads * nbLoops);
- final Thread[] threads = new Thread[nbThread];
- final List<Throwable> errors = new CopyOnWriteArrayList<>();
+ CountDownLatch latch = new CountDownLatch(nbThread * nbDownloads * nbLoops);
+ Thread[] threads = new Thread[nbThread];
+ List<Throwable> errors = new CopyOnWriteArrayList<>();
for (int i = 0; i < threads.length; i++) {
threads[i] = new Thread(getCurrentTestName() + "[" + i + "]") {
@Override
+ @SuppressWarnings("synthetic-access")
public void run() {
for (int j = 0; j < nbLoops; j++) {
- final MultiThreadedHttpConnectionManager mgr = new MultiThreadedHttpConnectionManager();
- final HttpClient client = new HttpClient(mgr);
+ MultiThreadedHttpConnectionManager mgr = new MultiThreadedHttpConnectionManager();
+ HttpClient client = new HttpClient(mgr);
client.getHttpConnectionManager().getParams().setDefaultMaxConnectionsPerHost(100);
client.getHttpConnectionManager().getParams().setMaxTotalConnections(1000);
for (int i = 0; i < nbDownloads; i++) {