Fixed more warnings

This commit is contained in:
Jeroen van Erp
2017-01-23 14:40:33 +01:00
parent 8134113510
commit ef3f7a2eaf
8 changed files with 31 additions and 19 deletions

View File

@@ -62,8 +62,11 @@ public class IdentificationStringParser {
}
}
private void logHeaderLine(Buffer.PlainBuffer lineBuffer) {
private void logHeaderLine(Buffer.PlainBuffer lineBuffer) throws Buffer.BufferException {
byte[] bytes = new byte[lineBuffer.available()];
lineBuffer.readRawBytes(bytes);
String header = new String(bytes, 0, bytes.length - 1);
log.debug("Received header: {}", header);
}
private String readIdentification(Buffer.PlainBuffer lineBuffer) throws Buffer.BufferException, TransportException {

View File

@@ -254,7 +254,7 @@ public class SecurityUtils {
throw new SSHRuntimeException("Failed to register BouncyCastle as the defaut JCE provider");
}
}
registrationDone = true;
}
registrationDone = true;
}
}

View File

@@ -329,6 +329,8 @@ public abstract class AbstractChannel
protected void gotUnknown(Message msg, SSHPacket buf)
throws ConnectionException, TransportException {
log.warn("Got unknown packet with type {}", msg);
}
protected void handleRequest(String reqType, SSHPacket buf)

View File

@@ -24,10 +24,11 @@ import java.io.InputStream;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
public class PacketReader
extends Thread {
public class PacketReader extends Thread {
/** Logger */
/**
* Logger
*/
private final Logger log;
private final InputStream in;
@@ -63,7 +64,7 @@ public class PacketReader
| lenBuf[3] & 0x000000ffL);
if (len > SFTPPacket.MAX_SIZE) {
throw new SSHException(String.format("Indicated packet length %d too large", len));
throw new SSHException(String.format("Indicated packet length %d too large", len));
}
return (int) len;
@@ -99,7 +100,7 @@ public class PacketReader
log.debug("Received {} packet", resp.getType());
if (promise == null)
throw new SFTPException("Received [" + resp.readType() + "] response for request-id " + resp.getRequestID()
+ ", no such request was made");
+ ", no such request was made");
else
promise.deliver(resp);
}

View File

@@ -81,10 +81,10 @@ public class RemoteFile
protected Promise<Response, SFTPException> asyncWrite(long fileOffset, byte[] data, int off, int len)
throws IOException {
return requester.request(newRequest(PacketType.WRITE)
.putUInt64(fileOffset)
// TODO The SFTP spec claims this field is unneeded...? See #187
.putUInt32(len)
.putRawBytes(data, off, len)
.putUInt64(fileOffset)
// TODO The SFTP spec claims this field is unneeded...? See #187
.putUInt32(len)
.putRawBytes(data, off, len)
);
}
@@ -194,10 +194,10 @@ public class RemoteFile
@Override
public long skip(long n) throws IOException {
final long fileLength = length();
final Long previousFileOffset = fileOffset;
fileOffset = Math.min(fileOffset + n, fileLength);
return fileOffset - previousFileOffset;
final long fileLength = length();
final Long previousFileOffset = fileOffset;
fileOffset = Math.min(fileOffset + n, fileLength);
return fileOffset - previousFileOffset;
}
@Override
@@ -341,7 +341,7 @@ public class RemoteFile
public int available() throws IOException {
boolean lastRead = true;
while (!eof && (pending.available() <= 0) && lastRead) {
lastRead = retrieveUnconfirmedRead(false /*blocking*/);
lastRead = retrieveUnconfirmedRead(false /*blocking*/);
}
return pending.available();
}

View File

@@ -46,10 +46,12 @@ public class NoneCipher
@Override
public void init(Mode mode, byte[] bytes, byte[] bytes1) {
// Nothing to do
}
@Override
public void update(byte[] input, int inputOffset, int inputLen) {
// Nothing to do
}
}

View File

@@ -70,7 +70,9 @@ public class BogusGSSContext
}
@Override
public void dispose() throws GSSException {}
public void dispose() throws GSSException {
// Nothing to do
}
@Override
public int getWrapSizeLimit(int qop, boolean confReq, int maxTokenSize) throws GSSException {

View File

@@ -34,7 +34,9 @@ public class BogusGSSCredential
}
@Override
public void dispose() throws GSSException {}
public void dispose() throws GSSException {
// Nothing to do
}
@Override
public GSSName getName() throws GSSException {