From f05cf39fd6b18019dfeaf6c19d08ae68bf418fd6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Parm=C3=A9nides=20GV?= Date: Thu, 14 Aug 2014 01:37:11 +0200 Subject: Handle NoSuchElementException in ProviderAPI. --- app/src/debug/java/se/leap/bitmaskclient/ProviderAPI.java | 2 ++ app/src/release/java/se/leap/bitmaskclient/ProviderAPI.java | 3 +++ 2 files changed, 5 insertions(+) (limited to 'app/src') diff --git a/app/src/debug/java/se/leap/bitmaskclient/ProviderAPI.java b/app/src/debug/java/se/leap/bitmaskclient/ProviderAPI.java index 5549252e..63c022bf 100644 --- a/app/src/debug/java/se/leap/bitmaskclient/ProviderAPI.java +++ b/app/src/debug/java/se/leap/bitmaskclient/ProviderAPI.java @@ -763,6 +763,8 @@ public class ProviderAPI extends IntentService { } catch (KeyManagementException e) { // TODO Auto-generated catch block e.printStackTrace(); + } catch (NoSuchElementException e) { + json_file_content = formatErrorMessage(R.string.server_unreachable_message); } return json_file_content; } diff --git a/app/src/release/java/se/leap/bitmaskclient/ProviderAPI.java b/app/src/release/java/se/leap/bitmaskclient/ProviderAPI.java index 625125d8..d1627974 100644 --- a/app/src/release/java/se/leap/bitmaskclient/ProviderAPI.java +++ b/app/src/release/java/se/leap/bitmaskclient/ProviderAPI.java @@ -48,6 +48,7 @@ import java.util.HashMap; import java.util.Iterator; import java.util.Map; import java.util.Scanner; +import java.util.NoSuchElementException; import javax.net.ssl.HostnameVerifier; import javax.net.ssl.HttpsURLConnection; @@ -765,6 +766,8 @@ public class ProviderAPI extends IntentService { } catch (KeyManagementException e) { // TODO Auto-generated catch block e.printStackTrace(); + } catch (NoSuchElementException e) { + json_file_content = formatErrorMessage(R.string.server_unreachable_message); } return json_file_content; } -- cgit v1.2.3