Use okhttp 3.8.1

This commit is contained in:
ligi 2017-08-27 19:45:20 +02:00
parent b2727019c5
commit 704503b9f5
No known key found for this signature in database
GPG key ID: 8E81894010ABF23D
4 changed files with 24 additions and 15 deletions

View file

@ -162,7 +162,7 @@ dependencies {
forFDroidCompile 'com.github.ligi.snackengage:snackengage-playrate:0.13'
forAmazonCompile 'com.github.ligi.snackengage:snackengage-amazonrate:0.13'
compile 'com.squareup.okhttp3:okhttp:3.7.0'
compile 'com.squareup.okhttp3:okhttp:3.8.1'
compile 'com.larswerkman:HoloColorPicker:1.5'
compile 'com.google.code.findbugs:jsr305:3.0.2'
compile 'com.squareup.moshi:moshi:1.4.0'

View file

@ -63,7 +63,10 @@ private fun fromOKHttp(uri: Uri): InputStreamWithSource? {
val response = client.newCall(request).execute()
return InputStreamWithSource(uri.toString(), response.body().byteStream())
val body = response.body()
if (body != null) {
return InputStreamWithSource(uri.toString(), body.byteStream())
}
} catch (e: MalformedURLException) {
App.tracker.trackException("MalformedURLException in ImportAsyncTask", e, false)
} catch (e: IOException) {

View file

@ -38,6 +38,8 @@ class ExtractURLAsIphoneActivity : PassAndroidActivity() {
requestBuilder.header("User-Agent", IPHONE_USER_AGENT)
val body = client.newCall(requestBuilder.build()).execute().body()
if (body != null) {
val bodyString = body.string()
body.close()
@ -48,6 +50,7 @@ class ExtractURLAsIphoneActivity : PassAndroidActivity() {
}
return url
}
} catch (e: IOException) {
tracker.trackException("ExtractURLAsIphoneActivity", e, false)
} catch (e: URISyntaxException) {

View file

@ -184,12 +184,15 @@ open class PassViewActivityBase : PassAndroidActivity() {
val response: Response
try {
response = client.newCall(request).execute()
val inputStreamWithSource = InputStreamWithSource(url, response.body().byteStream())
val body = response.body()
if (body != null) {
val inputStreamWithSource = InputStreamWithSource(url, body.byteStream())
val spec = InputStreamUnzipControllerSpec(inputStreamWithSource, this@PassViewActivityBase, passStore,
MyUnzipSuccessCallback(dlg),
MyUnzipFailCallback(dlg))
spec.overwrite = true
UnzipPassController.processInputStream(spec)
}
} catch (e: IOException) {
e.printStackTrace()
}