diff options
author | Leith Bade <leith@mapbox.com> | 2015-08-14 13:54:32 +1000 |
---|---|---|
committer | Leith Bade <leith@mapbox.com> | 2015-08-14 13:55:42 +1000 |
commit | 2f316878448d0056b5c4ced6ce0819349eaf466e (patch) | |
tree | a9113554bdfdf5679b74fe67f2f76c2523ebe425 /android | |
parent | b312820be89b147a91a7b596d6704ae69c0ddad2 (diff) | |
download | qtlocation-mapboxgl-2f316878448d0056b5c4ced6ce0819349eaf466e.tar.gz |
Use uv::async in HTTPAndroidRequest to ensure the correct thread deletes request object
Fixes #2058
Diffstat (limited to 'android')
-rw-r--r-- | android/java/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxgl/http/HTTPContext.java | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/android/java/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxgl/http/HTTPContext.java b/android/java/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxgl/http/HTTPContext.java index 509c79a4a5..4558bbfe34 100644 --- a/android/java/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxgl/http/HTTPContext.java +++ b/android/java/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxgl/http/HTTPContext.java @@ -84,8 +84,15 @@ class HTTPContext { @Override public void onResponse(Response response) throws IOException { - byte[] body = response.body().bytes(); - response.body().close(); + byte[] body; + try { + body = response.body().bytes(); + } catch (IOException e) { + onFailure(mRequest, e); + return; + } finally { + response.body().close(); + } nativeOnResponse(mNativePtr, response.code(), response.message(), response.header("ETag"), response.header("Last-Modified"), response.header("Cache-Control"), response.header("Expires"), body); } |