PhoneGap Android Ticket 113:

FileTransfer returns FILE_NOT_FOUND_ERR on http 500 error

For some reason on Android if you do a getInputStream() on a HTTP Connection and the server returns a 500 error it will report a FileNotFoundException.  Catching this exception and throwing an IOException so that we can report a more accurate error in JavaScript.
This commit is contained in:
macdonst 2011-03-24 23:27:35 +08:00
parent b3e9794189
commit 969f0c87d7

View File

@ -315,7 +315,13 @@ public class FileTransfer extends Plugin {
//------------------ read the SERVER RESPONSE
StringBuffer responseString = new StringBuffer("");
DataInputStream inStream = new DataInputStream ( conn.getInputStream() );
DataInputStream inStream;
try {
inStream = new DataInputStream ( conn.getInputStream() );
} catch(FileNotFoundException e) {
throw new IOException("Received error from server");
}
String line;
while (( line = inStream.readLine()) != null) {
responseString.append(line);