I have run some tests and in cases where getBytes() returned null, the addressType has been 0. Since addressType is set in read() it is likely that socksException has also been set (I didn't verify this).
So an alternative solution might be to check for the exception between these two lines:
@Override
public int read(ReadableMessage message) throws SocksException, IOException {
message.read(inputStream);
return message.getLength();
}
On the other hand, it doesn't look like any caller of read(..) is using the return value? So we might as well return void instead and no longer do the return message.getLength(); call.
I have run some tests and in cases where
getBytes()
returnednull
, theaddressType
has been0
. SinceaddressType
is set inread()
it is likely thatsocksException
has also been set (I didn't verify this).So an alternative solution might be to check for the exception between these two lines:
On the other hand, it doesn't look like any caller of
read(..)
is using the return value? So we might as well returnvoid
instead and no longer do thereturn message.getLength();
call.