incubator-callback-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Andrew Grieve (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (CB-1413) FileTransfer causes an exception when trying to handle the response
Date Wed, 12 Sep 2012 16:56:08 GMT

    [ https://issues.apache.org/jira/browse/CB-1413?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13454123#comment-13454123
] 

Andrew Grieve commented on CB-1413:
-----------------------------------

Thanks for the report Tom. The code.google.com issue that you linked explains the issue nicely
and includes a work-around. I'll get this in for the next release.
                
> FileTransfer causes an exception when trying to handle the response
> -------------------------------------------------------------------
>
>                 Key: CB-1413
>                 URL: https://issues.apache.org/jira/browse/CB-1413
>             Project: Apache Cordova
>          Issue Type: Bug
>          Components: Android
>    Affects Versions: 2.0.0
>         Environment: Android SDK: 2.3.3
>            Reporter: Tom Drummond
>            Assignee: Andrew Grieve
>
> I'm getting a BufferedInputStream error when trying to upload an image with Android.
> *Sample Code*
> {code:javascript}
> var options = new FileUploadOptions();
> options.fileKey = "image";
> options.chunkedMode = false;
> var ft = new FileTransfer();
> ft.upload(imageURI, "https://192.168.1.128:5000/", function(resp) {
>     console.log(JSON.stringify(resp));
> , function(e) {
>     console.log(JSON.stringify(e));
> }, options);
> {code}
> *JS Result*
> {code:javascript}
> {"target":"http://192.168.1.128:5000/","source":"file:///mnt/sdcard/Android/data/app/cache/1346773635225.jpg","http_status":200,"code":3}
> {code}
> *Exception*
> {code:java}
> java.io.IOException: BufferedInputStream is closed
>  	at java.io.BufferedInputStream.streamClosed(BufferedInputStream.java:116)
>  	at java.io.BufferedInputStream.read(BufferedInputStream.java:274)
>  	at org.apache.harmony.luni.internal.net.www.protocol.http.UnknownLengthHttpInputStream.read(UnknownLengthHttpInputStream.java:40)
>  	at org.apache.harmony.luni.internal.net.www.protocol.http.AbstractHttpInputStream.read(AbstractHttpInputStream.java:56)
>  	at java.io.DataInputStream.readLine(DataInputStream.java:310)
>  	at org.apache.cordova.FileTransfer.upload(FileTransfer.java:286)
>  	at org.apache.cordova.FileTransfer.execute(FileTransfer.java:85)
>  	at org.apache.cordova.api.PluginManager$1.run(PluginManager.java:192)
>  	at java.lang.Thread.run(Thread.java:1019)
> {code}
> After some Googling it appears to be an issue in Android 2.3.x (I was testing on 2.3.3).
I can confirm that it's not a problem in Android 4.1 (at least in the simulator).
> Related links:
> - http://stackoverflow.com/questions/4841925/java-io-ioexception-bufferedinputstream-is-closed-in-android-2-3
> - http://code.google.com/p/android/issues/detail?id=14562

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

Mime
View raw message