Skip to content
This repository was archived by the owner on Mar 16, 2019. It is now read-only.

Commit e97068c

Browse files
committed
Add android error handling
1 parent c39c6de commit e97068c

File tree

3 files changed

+10
-4
lines changed

3 files changed

+10
-4
lines changed

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

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -179,9 +179,14 @@ private void writeOctetData(BufferedSink sink) throws IOException {
179179
}
180180
}
181181
} else {
182-
byte[] bytes = Base64.decode(rawBody, 0);
183-
contentLength = bytes.length;
184-
requestStream = new ByteArrayInputStream(bytes);
182+
try {
183+
byte[] bytes = Base64.decode(rawBody, 0);
184+
contentLength = bytes.length;
185+
requestStream = new ByteArrayInputStream(bytes);
186+
} catch(Exception ex) {
187+
188+
Log.e("error", ex.getLocalizedMessage());
189+
}
185190
}
186191
if(requestStream != null)
187192
pipeStreamToSink(requestStream, sink);

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ public class RNFetchBlobConfig {
1818
public String key;
1919
public String mime;
2020
public Boolean auto;
21-
public long timeout = -1;
21+
public long timeout = 60000;
2222
public ReadableArray binaryContentTypes = null;
2323

2424
RNFetchBlobConfig(ReadableMap options) {

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -451,6 +451,7 @@ private void done(Response resp) {
451451
break;
452452
}
453453
removeTaskInfo();
454+
resp.close();
454455
}
455456

456457
/**

0 commit comments

Comments
 (0)