Skip to content

Commit 1933faf

Browse files
authored
Merge pull request #560 from pex7/master
Fix IO Exeption Error in RNFetchBlobReq
2 parents 6923bbb + d06e2e9 commit 1933faf

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

android/src/main/java/com/RNFetchBlob/RNFetchBlobReq.java

+8-2
Original file line numberDiff line numberDiff line change
@@ -592,13 +592,19 @@ private void done(Response resp) {
592592
}
593593

594594
RNFetchBlobFileResp rnFetchBlobFileResp;
595-
595+
596596
try {
597597
rnFetchBlobFileResp = (RNFetchBlobFileResp) responseBody;
598598
} catch (ClassCastException ex) {
599599
// unexpected response type
600600
if (responseBody != null) {
601-
callback.invoke("Unexpected FileStorage response file: " + responseBody.string(), null);
601+
String responseBodyString = null;
602+
try {
603+
responseBodyString = responseBody.string();
604+
} catch(IOException exception) {
605+
exception.printStackTrace();
606+
}
607+
callback.invoke("Unexpected FileStorage response file: " + responseBodyString, null);
602608
} else {
603609
callback.invoke("Unexpected FileStorage response with no file.", null);
604610
}

0 commit comments

Comments
 (0)