summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorParménides GV <parmegv@sdf.org>2013-08-03 11:42:15 +0200
committerParménides GV <parmegv@sdf.org>2013-08-03 11:42:15 +0200
commit17903a5221f66d18e90119590c1a29b1f418cafd (patch)
tree2b75b14e522479850ccc6e9ad009cc7f0b55fd8c
parenta1a03615cb9c4f978142b234f028e718eb91a103 (diff)
FileNotFoundException catched in all downloads.
Added a new catch block in all downloads methods.
-rw-r--r--src/se/leap/leapclient/ProviderAPI.java13
1 files changed, 13 insertions, 0 deletions
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();