You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@cordova.apache.org by "ASF subversion and git services (JIRA)" <ji...@apache.org> on 2013/07/10 18:01:50 UTC

[jira] [Commented] (CB-1413) FileTransfer causes an exception when trying to handle the response

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

ASF subversion and git services commented on CB-1413:
-----------------------------------------------------

Commit e4559a21d724b497ab685f869043ff1d3577dc64 in branch refs/heads/master from [~iclelland]
[ https://git-wip-us.apache.org/repos/asf?p=cordova-plugin-file-transfer.git;h=e4559a2 ]

[CB-3430] [CB-1413] Remove Old (2.3.3) HTTP Workaround

Cherry-picked from 2.x branch of cordova-android [01946dd4]

                
> 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
>             Fix For: 2.2.0
>
>
> 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