aboutsummaryrefslogtreecommitdiffstats
path: root/wpadebug
diff options
context:
space:
mode:
authorJouni Malinen <j@w1.fi>2013-05-05 15:28:25 (GMT)
committerJouni Malinen <j@w1.fi>2013-05-05 15:28:25 (GMT)
commitd7232a8da636073189a41b42c6ff389b562a86f3 (patch)
tree71b3054c2ebfb4fba87926bd946e5e9322da204a /wpadebug
parent55a2df4389cf5b712ac4c96ee0fb0a153b97da7f (diff)
downloadhostap-d7232a8da636073189a41b42c6ff389b562a86f3.zip
hostap-d7232a8da636073189a41b42c6ff389b562a86f3.tar.gz
hostap-d7232a8da636073189a41b42c6ff389b562a86f3.tar.bz2
wpadebug: Add exception handling for missing resources
These errors should not really happen, but apparently they can if the build dependencies get messed up somehow. Signed-hostap: Jouni Malinen <j@w1.fi>
Diffstat (limited to 'wpadebug')
-rw-r--r--wpadebug/src/w1/fi/wpadebug/CommandListActivity.java10
-rw-r--r--wpadebug/src/w1/fi/wpadebug/WpaCommandListActivity.java10
2 files changed, 16 insertions, 4 deletions
diff --git a/wpadebug/src/w1/fi/wpadebug/CommandListActivity.java b/wpadebug/src/w1/fi/wpadebug/CommandListActivity.java
index fb4268e..6d7ad4d 100644
--- a/wpadebug/src/w1/fi/wpadebug/CommandListActivity.java
+++ b/wpadebug/src/w1/fi/wpadebug/CommandListActivity.java
@@ -77,8 +77,14 @@ public class CommandListActivity extends ListActivity
Toast.LENGTH_SHORT).show();
}
- InputStream inres = getResources().openRawResource(R.raw.shell_commands);
- read_commands(list, new Scanner(inres));
+ InputStream inres;
+ try {
+ inres = getResources().openRawResource(R.raw.shell_commands);
+ read_commands(list, new Scanner(inres));
+ } catch (android.content.res.Resources.NotFoundException e) {
+ Toast.makeText(this, "Could not read internal resource",
+ Toast.LENGTH_SHORT).show();
+ }
ArrayAdapter<CmdList> listAdapter;
listAdapter = new ArrayAdapter<CmdList>(this, android.R.layout.simple_list_item_1, list);
diff --git a/wpadebug/src/w1/fi/wpadebug/WpaCommandListActivity.java b/wpadebug/src/w1/fi/wpadebug/WpaCommandListActivity.java
index 4ad9b2d..e089179 100644
--- a/wpadebug/src/w1/fi/wpadebug/WpaCommandListActivity.java
+++ b/wpadebug/src/w1/fi/wpadebug/WpaCommandListActivity.java
@@ -59,8 +59,14 @@ public class WpaCommandListActivity extends ListActivity
Toast.LENGTH_SHORT).show();
}
- InputStream inres = getResources().openRawResource(R.raw.wpa_commands);
- read_commands(list, new Scanner(inres));
+ InputStream inres;
+ try {
+ inres = getResources().openRawResource(R.raw.wpa_commands);
+ read_commands(list, new Scanner(inres));
+ } catch (android.content.res.Resources.NotFoundException e) {
+ Toast.makeText(this, "Could not read internal resource",
+ Toast.LENGTH_SHORT).show();
+ }
ArrayAdapter<CmdList> listAdapter;
listAdapter = new ArrayAdapter<CmdList>(this, android.R.layout.simple_list_item_1, list);