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.
pull/95/head
Andrew Gaul 2015-10-24 20:49:49 -07:00
rodzic 50a3024362
commit 732ef5d260
2 zmienionych plików z 2 dodań i 4 usunięć

Wyświetl plik

@ -481,9 +481,6 @@ public final class S3ProxyTest {
for (int i = 0; i < numParts; ++i) {
ByteSource partByteSource = byteSource.slice(i, 1);
// TODO: wrap sliced byte source to work around zero length bug
partByteSource = ByteSource.wrap(partByteSource.read());
assertThat(partByteSource.size()).isEqualTo(1); // TODO:
Payload payload = Payloads.newByteSourcePayload(partByteSource);
payload.getContentMetadata().setContentLength(
partByteSource.size());

Wyświetl plik

@ -75,7 +75,8 @@ final 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