Check stream closed in read

This matches TestUtils.randomByteSource.
pull/252/head
Andrew Gaul 2018-01-04 14:54:54 -08:00
rodzic b5617857d6
commit aee169e403
1 zmienionych plików z 11 dodań i 0 usunięć

Wyświetl plik

@ -194,9 +194,20 @@ final class NullBlobStore extends ForwardingBlobStore {
}
private static final class NullInputStream extends InputStream {
private boolean closed;
@Override
public int read() throws IOException {
if (closed) {
throw new IOException("Stream already closed");
}
return 0;
}
@Override
public void close() throws IOException {
super.close();
closed = true;
}
}
}