You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@cordova.apache.org by "Andrew Grieve (JIRA)" <ji...@apache.org> on 2014/05/06 16:26:18 UTC

[jira] [Resolved] (CB-6378) OkHttp 1.5 NPE when closing stream

     [ https://issues.apache.org/jira/browse/CB-6378?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Andrew Grieve resolved CB-6378.
-------------------------------

    Resolution: Fixed
      Assignee: Andrew Grieve

Fixed in 0.4.4-dev

> OkHttp 1.5 NPE when closing stream
> ----------------------------------
>
>                 Key: CB-6378
>                 URL: https://issues.apache.org/jira/browse/CB-6378
>             Project: Apache Cordova
>          Issue Type: Bug
>          Components: Android
>    Affects Versions: 2.9.0
>         Environment: Android
>            Reporter: Andrew Shu
>            Assignee: Andrew Grieve
>            Priority: Minor
>
> Cordova 2.9.1. Using FileTransfer plugin.
> When upgrading the project's OkHttp version to 1.5, it frequently crashes due to a broken assumption made by Cordova that HttpURLConnection is thread safe.
> On Android it is explicitly not thread safe: http://developer.android.com/reference/java/net/HttpURLConnection.html
> Short discussion: https://github.com/square/okhttp/issues/655
> Stack trace:
> java.lang.NullPointerException
> at com.squareup.okhttp.internal.okio.OkBuffer.write(OkBuffer.java:519)
> at com.squareup.okhttp.internal.okio.OkBuffer.read(OkBuffer.java:555)
> at com.squareup.okhttp.internal.okio.RealBufferedSource.read(RealBufferedSource.java:53)
> at com.squareup.okhttp.internal.http.HttpConnection$FixedLengthSource.read(HttpConnection.java:413)
> at com.squareup.okhttp.internal.Util.skipAll(Util.java:234)
> at com.squareup.okhttp.internal.http.HttpConnection.discard(HttpConnection.java:183)
> at com.squareup.okhttp.internal.http.HttpConnection$FixedLengthSource.close(HttpConnection.java:435)
> at com.squareup.okhttp.internal.okio.RealBufferedSource.close(RealBufferedSource.java:206)
> at com.squareup.okhttp.internal.okio.RealBufferedSource$1.close(RealBufferedSource.java:181)
> at java.io.FilterInputStream.close(FilterInputStream.java:64)
> at org.apache.cordova.FileTransfer.safeClose(FileTransfer.java:515)
> at org.apache.cordova.FileTransfer.access$300(FileTransfer.java:64)
> at org.apache.cordova.FileTransfer$5.run(FileTransfer.java:864)
> at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1080)
> at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:573)
> at java.lang.Thread.run(Thread.java:841)



--
This message was sent by Atlassian JIRA
(v6.2#6252)