You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cordova.apache.org by virix <gi...@git.apache.org> on 2015/04/09 16:36:49 UTC

[GitHub] cordova-plugin-file-transfer pull request: Prevent Fatal Exception...

GitHub user virix opened a pull request:

    https://github.com/apache/cordova-plugin-file-transfer/pull/79

    Prevent Fatal Exception on download abort.

    Tested in a Ionic Application on my Nexus 5 (Android 5.1): without the added try/catch, the application sometimes crash with a fatal error.

You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/virix/cordova-plugin-file-transfer master

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/cordova-plugin-file-transfer/pull/79.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #79
    
----
commit 5bc0120afbe8522714c7df2dc22c0069a73ff4f0
Author: Vito Rifino <vi...@gmail.com>
Date:   2015-04-09T14:28:09Z

    Prevent Fatal Exception on download abort.

----


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@cordova.apache.org
For additional commands, e-mail: dev-help@cordova.apache.org


[GitHub] cordova-plugin-file-transfer pull request: Prevent Fatal Exception...

Posted by winstef <gi...@git.apache.org>.
Github user winstef commented on the pull request:

    https://github.com/apache/cordova-plugin-file-transfer/pull/79#issuecomment-110347248
  
    Thanks for this fix. I also had the same issue every time I would call abort() the app crashed. I'm using a S5 on Android 5.0.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@cordova.apache.org
For additional commands, e-mail: dev-help@cordova.apache.org


[GitHub] cordova-plugin-file-transfer pull request: Prevent Fatal Exception...

Posted by daserge <gi...@git.apache.org>.
Github user daserge commented on the pull request:

    https://github.com/apache/cordova-plugin-file-transfer/pull/79#issuecomment-148653298
  
    Confirm this fix prevents a crash on 5.0.1 device:
    ```
    E/FileTransfer(32760): Catch workaround for fatal exception
    E/FileTransfer(32760): java.lang.NullPointerException: Attempt to read from field 'int com.android.okio.Segment.limit' on a null object reference
    E/FileTransfer(32760): 	at com.android.okio.OkBuffer.write(OkBuffer.java:574)
    E/FileTransfer(32760): 	at com.android.okio.OkBuffer.read(OkBuffer.java:610)
    E/FileTransfer(32760): 	at com.android.okio.RealBufferedSource.read(RealBufferedSource.java:56)
    E/FileTransfer(32760): 	at com.android.okhttp.internal.http.HttpConnection$FixedLengthSource.read(HttpConnection.java:465)
    E/FileTransfer(32760): 	at com.android.okhttp.internal.Util.skipAll(Util.java:227)
    E/FileTransfer(32760): 	at com.android.okhttp.internal.http.HttpConnection.discard(HttpConnection.java:235)
    E/FileTransfer(32760): 	at com.android.okhttp.internal.http.HttpConnection$FixedLengthSource.close(HttpConnection.java:487)
    E/FileTransfer(32760): 	at com.android.okhttp.internal.Util.closeQuietly(Util.java:97)
    E/FileTransfer(32760): 	at com.android.okhttp.internal.http.HttpEngine.close(HttpEngine.java:580)
    E/FileTransfer(32760): 	at com.android.okhttp.internal.http.HttpURLConnectionImpl.disconnect(HttpURLConnectionImpl.java:113)
    E/FileTransfer(32760): 	at org.apache.cordova.filetransfer.FileTransfer$5.run(FileTransfer.java:1015)
    E/FileTransfer(32760): 	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)
    E/FileTransfer(32760): 	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)
    E/FileTransfer(32760): 	at java.lang.Thread.run(Thread.java:818)
    
    E/FileTransfer(32760): {"code":3,"source":"http:\/\/cordova.apache.org\/downloads\/BlueZedEx.mp3","target":"file:\/\/\/data\/data\/io.cordova.hellocordova\/files\/files\/testFile.txt","http_status":200,"exception":"Attempt to read from field 'int com.android.okio.Segment.limit' on a null object reference"}
    ```


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@cordova.apache.org
For additional commands, e-mail: dev-help@cordova.apache.org


[GitHub] cordova-plugin-file-transfer pull request: CB-8431 File Transfer t...

Posted by daserge <gi...@git.apache.org>.
Github user daserge commented on the pull request:

    https://github.com/apache/cordova-plugin-file-transfer/pull/79#issuecomment-148896324
  
    @virix, thanks, merged!


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@cordova.apache.org
For additional commands, e-mail: dev-help@cordova.apache.org


[GitHub] cordova-plugin-file-transfer pull request: Prevent Fatal Exception...

Posted by daserge <gi...@git.apache.org>.
Github user daserge commented on a diff in the pull request:

    https://github.com/apache/cordova-plugin-file-transfer/pull/79#discussion_r42222724
  
    --- Diff: src/android/FileTransfer.java ---
    @@ -977,7 +977,11 @@ public void run() {
                             context.sendPluginResult(new PluginResult(PluginResult.Status.ERROR, error));
                             context.aborted = true;
                             if (context.connection != null) {
    -                            context.connection.disconnect();
    +                            try{
    +                                   context.connection.disconnect();
    +                            } catch (Exception e) {                              
    +                                   Log.e(LOG_TAG, "Catch workaround for fatal exception", e);
    --- End diff --
    
    @virix, could you please also prefix the error message with `"CB-8431"` to simplify a potential debugging?


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@cordova.apache.org
For additional commands, e-mail: dev-help@cordova.apache.org


[GitHub] cordova-plugin-file-transfer pull request: Prevent Fatal Exception...

Posted by nikhilkh <gi...@git.apache.org>.
Github user nikhilkh commented on the pull request:

    https://github.com/apache/cordova-plugin-file-transfer/pull/79#issuecomment-110799248
  
    Is the fatal exception same as the one you are seeing here? https://issues.apache.org/jira/browse/CB-8431


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@cordova.apache.org
For additional commands, e-mail: dev-help@cordova.apache.org


[GitHub] cordova-plugin-file-transfer pull request: CB-8431 File Transfer t...

Posted by asfgit <gi...@git.apache.org>.
Github user asfgit closed the pull request at:

    https://github.com/apache/cordova-plugin-file-transfer/pull/79


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@cordova.apache.org
For additional commands, e-mail: dev-help@cordova.apache.org


[GitHub] cordova-plugin-file-transfer pull request: CB-8431 File Transfer t...

Posted by virix <gi...@git.apache.org>.
Github user virix commented on the pull request:

    https://github.com/apache/cordova-plugin-file-transfer/pull/79#issuecomment-148895387
  
    @daserge My ICLA has just been filed.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@cordova.apache.org
For additional commands, e-mail: dev-help@cordova.apache.org


[GitHub] cordova-plugin-file-transfer pull request: Prevent Fatal Exception...

Posted by daserge <gi...@git.apache.org>.
Github user daserge commented on the pull request:

    https://github.com/apache/cordova-plugin-file-transfer/pull/79#issuecomment-148654338
  
    @virix, Thank you for the contribution!
    Could you please rename the PR and commit title to `"CB-8431 File Transfer tests crash on Android Lolipop"` and sign the ICLA?
    http://www.apache.org/dev/new-committers-guide.html#cla


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@cordova.apache.org
For additional commands, e-mail: dev-help@cordova.apache.org