Skip to content

Commit

Permalink
catch EOFException for InputStream.read and abort further reading
Browse files Browse the repository at this point in the history
  • Loading branch information
benibela committed Feb 23, 2024
1 parent 3cbffec commit 2b75852
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion system/bbjniutils.pas
Original file line number Diff line number Diff line change
Expand Up @@ -1270,7 +1270,7 @@ procedure TJavaEnv.inputStreamReadAllAndDelete(stream: jobject; readCallback: TS
wrappedBuffer.l := env^^.NewByteArray(env, BUFFERLEN);
len := env^^.CallIntMethodA(env, stream, jmInputStreamRead, @wrappedBuffer);;
if ExceptionCheck and RethrowNonEOFException then
len := 0; //ignore java.io.EOFException. InputStream.read cannot throw java.io.EOFException, but it does with okhttp
len := -1; //ignore java.io.EOFException. InputStream.read cannot throw java.io.EOFException, but it does with okhttp
while len >= 0 do begin
if len > 0 then begin
buffer := env^^.GetPrimitiveArrayCritical(env, wrappedBuffer.l, temp);
Expand Down

0 comments on commit 2b75852

Please sign in to comment.