Skip to content

Commit

Permalink
fixes #64
Browse files Browse the repository at this point in the history
  • Loading branch information
Ron Radtke authored and chaits98 committed Oct 14, 2021
1 parent 40e3612 commit 8b874f9
Show file tree
Hide file tree
Showing 3 changed files with 56 additions and 6 deletions.
28 changes: 28 additions & 0 deletions android/.project
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>android</name>
<comment>Project android created by Buildship.</comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.buildship.core.gradleprojectbuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.buildship.core.gradleprojectnature</nature>
</natures>
<filteredResources>
<filter>
<id>1634215444278</id>
<name></name>
<type>30</type>
<matcher>
<id>org.eclipse.core.resources.regexFilterMatcher</id>
<arguments>node_modules|.git|__CREATED_BY_JAVA_LANGUAGE_SERVER__</arguments>
</matcher>
</filter>
</filteredResources>
</projectDescription>
13 changes: 13 additions & 0 deletions android/.settings/org.eclipse.buildship.core.prefs
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
arguments=
auto.sync=false
build.scans.enabled=false
connection.gradle.distribution=GRADLE_DISTRIBUTION(WRAPPER)
connection.project.dir=
eclipse.preferences.version=1
gradle.user.home=
java.home=/Library/Java/JavaVirtualMachines/adoptopenjdk-11.jdk/Contents/Home
jvm.arguments=
offline.mode=false
override.workspace.settings=true
show.console.view=true
show.executions.view=true
21 changes: 15 additions & 6 deletions android/src/main/java/com/RNFetchBlob/RNFetchBlobReq.java
Original file line number Diff line number Diff line change
Expand Up @@ -392,8 +392,9 @@ public Response intercept(Chain chain) throws IOException {
clientBuilder.addInterceptor(new Interceptor() {
@Override
public Response intercept(@NonNull Chain chain) throws IOException {
Response originalResponse = null;
try {
Response originalResponse = chain.proceed(req);
originalResponse = chain.proceed(req);
ResponseBody extended;
switch (responseType) {
case KeepInMemory:
Expand Down Expand Up @@ -423,13 +424,21 @@ public Response intercept(@NonNull Chain chain) throws IOException {
}
catch(SocketException e) {
timeout = true;
}
catch (SocketTimeoutException e ){
if (originalResponse != null) {
originalResponse.close();
}
} catch (SocketTimeoutException e) {
timeout = true;
//RNFetchBlobUtils.emitWarningEvent("RNFetchBlob error when sending request : " + e.getLocalizedMessage());
} catch(Exception ex) {

if (originalResponse != null) {
originalResponse.close();
}
//ReactNativeBlobUtilUtils.emitWarningEvent("ReactNativeBlobUtil error when sending request : " + e.getLocalizedMessage());
} catch (Exception ex) {
if (originalResponse != null) {
originalResponse.close();
}
}

return chain.proceed(chain.request());
}
});
Expand Down

0 comments on commit 8b874f9

Please sign in to comment.