Correct RandomByteSource.read return value

Previously read returned a value between -128 and 127.  -1 indicates
end of stream, causing issues for callers.  Instead return values
between 0 and 255 as intended.
This commit is contained in:
Andrew Gaul 2018-01-04 15:12:29 -08:00
parent 89e102810e
commit 11640b6c2e
1 changed files with 2 additions and 1 deletions

View File

@ -70,7 +70,8 @@ public class TestUtils {
if (closed) {
throw new IOException("Stream already closed");
}
return (byte) random.nextInt();
// return value between 0 and 255
return random.nextInt() & 0xff;
}
@Override