Return-Path: X-Original-To: apmail-incubator-callback-dev-archive@minotaur.apache.org Delivered-To: apmail-incubator-callback-dev-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 83A3FDF18 for ; Fri, 14 Sep 2012 09:54:10 +0000 (UTC) Received: (qmail 40559 invoked by uid 500); 14 Sep 2012 09:54:10 -0000 Delivered-To: apmail-incubator-callback-dev-archive@incubator.apache.org Received: (qmail 40524 invoked by uid 500); 14 Sep 2012 09:54:09 -0000 Mailing-List: contact callback-dev-help@incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: callback-dev@incubator.apache.org Delivered-To: mailing list callback-dev@incubator.apache.org Received: (qmail 40488 invoked by uid 99); 14 Sep 2012 09:54:09 -0000 Received: from arcas.apache.org (HELO arcas.apache.org) (140.211.11.28) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 14 Sep 2012 09:54:08 +0000 Date: Fri, 14 Sep 2012 20:54:08 +1100 (NCT) From: "Tom Drummond (JIRA)" To: callback-dev@incubator.apache.org Message-ID: <789339181.79676.1347616448993.JavaMail.jiratomcat@arcas> In-Reply-To: <1829422275.69954.1347468487613.JavaMail.jiratomcat@arcas> Subject: [jira] [Commented] (CB-1413) FileTransfer causes an exception when trying to handle the response MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 [ https://issues.apache.org/jira/browse/CB-1413?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13455694#comment-13455694 ] Tom Drummond commented on CB-1413: ---------------------------------- I overrode the other two read() methods like so: https://gist.github.com/3721081 Turns out it was calling the method with zero arguments (i.e. I saw "Reading input 3" in the logs). And that method seems to have sorted out the problem for me :) > 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