Skip to content

Commit 8b874f9

Browse files
Ron Radtkechaits98
Ron Radtke
authored andcommitted
fixes #64
1 parent 40e3612 commit 8b874f9

File tree

3 files changed

+56
-6
lines changed

3 files changed

+56
-6
lines changed

android/.project

+28
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<projectDescription>
3+
<name>android</name>
4+
<comment>Project android created by Buildship.</comment>
5+
<projects>
6+
</projects>
7+
<buildSpec>
8+
<buildCommand>
9+
<name>org.eclipse.buildship.core.gradleprojectbuilder</name>
10+
<arguments>
11+
</arguments>
12+
</buildCommand>
13+
</buildSpec>
14+
<natures>
15+
<nature>org.eclipse.buildship.core.gradleprojectnature</nature>
16+
</natures>
17+
<filteredResources>
18+
<filter>
19+
<id>1634215444278</id>
20+
<name></name>
21+
<type>30</type>
22+
<matcher>
23+
<id>org.eclipse.core.resources.regexFilterMatcher</id>
24+
<arguments>node_modules|.git|__CREATED_BY_JAVA_LANGUAGE_SERVER__</arguments>
25+
</matcher>
26+
</filter>
27+
</filteredResources>
28+
</projectDescription>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
arguments=
2+
auto.sync=false
3+
build.scans.enabled=false
4+
connection.gradle.distribution=GRADLE_DISTRIBUTION(WRAPPER)
5+
connection.project.dir=
6+
eclipse.preferences.version=1
7+
gradle.user.home=
8+
java.home=/Library/Java/JavaVirtualMachines/adoptopenjdk-11.jdk/Contents/Home
9+
jvm.arguments=
10+
offline.mode=false
11+
override.workspace.settings=true
12+
show.console.view=true
13+
show.executions.view=true

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

+15-6
Original file line numberDiff line numberDiff line change
@@ -392,8 +392,9 @@ public Response intercept(Chain chain) throws IOException {
392392
clientBuilder.addInterceptor(new Interceptor() {
393393
@Override
394394
public Response intercept(@NonNull Chain chain) throws IOException {
395+
Response originalResponse = null;
395396
try {
396-
Response originalResponse = chain.proceed(req);
397+
originalResponse = chain.proceed(req);
397398
ResponseBody extended;
398399
switch (responseType) {
399400
case KeepInMemory:
@@ -423,13 +424,21 @@ public Response intercept(@NonNull Chain chain) throws IOException {
423424
}
424425
catch(SocketException e) {
425426
timeout = true;
426-
}
427-
catch (SocketTimeoutException e ){
427+
if (originalResponse != null) {
428+
originalResponse.close();
429+
}
430+
} catch (SocketTimeoutException e) {
428431
timeout = true;
429-
//RNFetchBlobUtils.emitWarningEvent("RNFetchBlob error when sending request : " + e.getLocalizedMessage());
430-
} catch(Exception ex) {
431-
432+
if (originalResponse != null) {
433+
originalResponse.close();
434+
}
435+
//ReactNativeBlobUtilUtils.emitWarningEvent("ReactNativeBlobUtil error when sending request : " + e.getLocalizedMessage());
436+
} catch (Exception ex) {
437+
if (originalResponse != null) {
438+
originalResponse.close();
439+
}
432440
}
441+
433442
return chain.proceed(chain.request());
434443
}
435444
});

0 commit comments

Comments
 (0)