Quellcode durchsuchen

fix io exception in RNFetchBlobReq

Tyler Pexton vor 4 Jahren
Ursprung
Commit
d06e2e92d9
1 geänderte Dateien mit 8 neuen und 2 gelöschten Zeilen
  1. 8
    2
      android/src/main/java/com/RNFetchBlob/RNFetchBlobReq.java

+ 8
- 2
android/src/main/java/com/RNFetchBlob/RNFetchBlobReq.java Datei anzeigen

@@ -592,13 +592,19 @@ public class RNFetchBlobReq extends BroadcastReceiver implements Runnable {
592 592
                 }
593 593
 
594 594
                 RNFetchBlobFileResp rnFetchBlobFileResp;
595
-                
595
+
596 596
                 try {
597 597
                     rnFetchBlobFileResp = (RNFetchBlobFileResp) responseBody;
598 598
                 } catch (ClassCastException ex) {
599 599
                     // unexpected response type
600 600
                     if (responseBody != null) {
601
-                        callback.invoke("Unexpected FileStorage response file: " + responseBody.body().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);
602 608
                     } else {
603 609
                         callback.invoke("Unexpected FileStorage response with no file.", null);
604 610
                     }