Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -419,6 +419,12 @@ public synchronized int read() throws IOException {
() -> {
int b;
try {
// When exception happens before re-setting wrappedStream in "reopen" called
// by onReadFailure, then wrappedStream will be null. But the **retry** may
// re-execute this block and cause NPE if we don't check wrappedStream
if (wrappedStream == null) {
throw new IOException("Null IO stream for reading " + uri);
}
b = wrappedStream.read();
} catch (EOFException e) {
return -1;
Expand Down Expand Up @@ -507,6 +513,12 @@ public synchronized int read(byte[] buf, int off, int len)
() -> {
int bytes;
try {
// When exception happens before re-setting wrappedStream in "reopen" called
// by onReadFailure, then wrappedStream will be null. But the **retry** may
// re-execute this block and cause NPE if we don't check wrappedStream
if (wrappedStream == null) {
throw new IOException("Null IO stream for reading " + uri);
}
bytes = wrappedStream.read(buf, off, len);
} catch (EOFException e) {
// the base implementation swallows EOFs.
Expand Down