mirror of
https://github.com/hierynomus/sshj.git
synced 2025-12-07 15:50:57 +03:00
Fixed some codacy issues
This commit is contained in:
@@ -147,7 +147,6 @@ public class Buffer<T extends Buffer<T>> {
|
||||
|
||||
/** Compact this {@link SSHPacket} */
|
||||
public void compact() {
|
||||
System.err.println("COMPACTING");
|
||||
if (available() > 0)
|
||||
System.arraycopy(data, rpos, data, 0, wpos - rpos);
|
||||
wpos -= rpos;
|
||||
@@ -356,8 +355,9 @@ public class Buffer<T extends Buffer<T>> {
|
||||
}
|
||||
|
||||
public T putUInt64(long uint64) {
|
||||
if (uint64 < 0)
|
||||
if (uint64 < 0) {
|
||||
throw new IllegalArgumentException("Invalid value: " + uint64);
|
||||
}
|
||||
return putUInt64Unchecked(uint64);
|
||||
}
|
||||
|
||||
|
||||
@@ -60,10 +60,8 @@ public final class Reader
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
//noinspection StatementWithEmptyBody
|
||||
if (isInterrupted()) {
|
||||
// We are meant to shut up and draw to a close if interrupted
|
||||
} else {
|
||||
// We are meant to shut up and draw to a close if interrupted
|
||||
if (!isInterrupted()) {
|
||||
trans.die(e);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -71,9 +71,7 @@ public class RemoteFileTest {
|
||||
n += rs.read(test, n, 3072 - n);
|
||||
}
|
||||
|
||||
if (test[3072] != 0) {
|
||||
System.err.println("buffer overrun!");
|
||||
}
|
||||
assertThat("buffer overrun", test[3072] == 0);
|
||||
|
||||
n += rs.read(test, n, test.length - n); // --> ArrayIndexOutOfBoundsException
|
||||
|
||||
|
||||
@@ -22,6 +22,8 @@ import org.slf4j.LoggerFactory;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import static org.junit.Assert.fail;
|
||||
|
||||
public class LoadsOfConnects {
|
||||
|
||||
protected final Logger log = LoggerFactory.getLogger(getClass());
|
||||
@@ -29,15 +31,19 @@ public class LoadsOfConnects {
|
||||
private final SshFixture fixture = new SshFixture();
|
||||
|
||||
@Test
|
||||
public void loadsOfConnects()
|
||||
throws IOException, InterruptedException {
|
||||
for (int i = 0; i < 1000; i++) {
|
||||
System.out.println("Try " + i);
|
||||
fixture.start();
|
||||
fixture.setupConnectedDefaultClient();
|
||||
fixture.stopClient();
|
||||
fixture.stopServer();
|
||||
public void loadsOfConnects() {
|
||||
try {
|
||||
for (int i = 0; i < 1000; i++) {
|
||||
log.info("Try " + i);
|
||||
fixture.start();
|
||||
fixture.setupConnectedDefaultClient();
|
||||
fixture.stopClient();
|
||||
fixture.stopServer();
|
||||
}
|
||||
} catch (Exception e) {
|
||||
fail(e.getMessage());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -251,10 +251,10 @@ public class OpenSSHKeyFileTest {
|
||||
}
|
||||
|
||||
@Before
|
||||
public void setup()
|
||||
throws UnsupportedEncodingException, GeneralSecurityException {
|
||||
if (!SecurityUtils.isBouncyCastleRegistered())
|
||||
public void checkBCRegistration() {
|
||||
if (!SecurityUtils.isBouncyCastleRegistered()) {
|
||||
throw new AssertionError("bouncy castle needed");
|
||||
}
|
||||
}
|
||||
|
||||
private String readFile(String pathname)
|
||||
|
||||
Reference in New Issue
Block a user