From 17903a5221f66d18e90119590c1a29b1f418cafd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Parm=C3=A9nides=20GV?= Date: Sat, 3 Aug 2013 11:42:15 +0200 Subject: FileNotFoundException catched in all downloads. Added a new catch block in all downloads methods. --- src/se/leap/leapclient/ProviderAPI.java | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'src') diff --git a/src/se/leap/leapclient/ProviderAPI.java b/src/se/leap/leapclient/ProviderAPI.java index 944a0e7f..b7df172a 100644 --- a/src/se/leap/leapclient/ProviderAPI.java +++ b/src/se/leap/leapclient/ProviderAPI.java @@ -17,6 +17,7 @@ package se.leap.leapclient; import java.io.ByteArrayInputStream; +import java.io.FileNotFoundException; import java.io.IOException; import java.io.InputStream; import java.math.BigInteger; @@ -407,6 +408,9 @@ public class ProviderAPI extends IntentService { displayToast(R.string.malformed_url); } catch(SocketTimeoutException e) { displayToast(R.string.server_is_down_message); + } catch (FileNotFoundException e) { + e.printStackTrace(); + displayToast(R.string.server_is_down_message); } catch (IOException e) { if(provider_url != null) { json_file_content = getStringFromProviderWithCACertAdded(provider_url, danger_on); @@ -447,6 +451,9 @@ public class ProviderAPI extends IntentService { json_string = new Scanner(urlConnection.getInputStream()).useDelimiter("\\A").next(); } catch (MalformedURLException e) { displayToast(R.string.malformed_url); + } catch (FileNotFoundException e) { + e.printStackTrace(); + displayToast(R.string.server_is_down_message); } catch (IOException e) { json_string = getStringFromProviderIgnoringCertificate(string_url); } @@ -499,6 +506,9 @@ public class ProviderAPI extends IntentService { e.printStackTrace(); } catch (UnknownHostException e) { displayToast(R.string.server_is_down_message); + } catch (FileNotFoundException e) { + e.printStackTrace(); + displayToast(R.string.server_is_down_message); } catch (IOException e) { // The downloaded certificate doesn't validate our https connection. if(danger_on) { @@ -552,6 +562,9 @@ public class ProviderAPI extends IntentService { }); string = new Scanner(urlConnection.getInputStream()).useDelimiter("\\A").next(); System.out.println("String ignoring certificate = " + string); + } catch (FileNotFoundException e) { + e.printStackTrace(); + displayToast(R.string.server_is_down_message); } catch (IOException e) { // The downloaded certificate doesn't validate our https connection. e.printStackTrace(); -- cgit v1.2.3