Permalink
Browse files

Added better exception handling for starting and stopping plugins.

  • Loading branch information...
jwf committed Apr 20, 2012
1 parent 302fb22 commit a5b55baeb7a0ba8fe3e74c10fe3f812c2f5c97d6
Showing with 24 additions and 4 deletions.
  1. +24 −4 src/ca/mcgill/hs/serv/HSService.java
@@ -190,13 +190,23 @@ public void onDestroy() {
Log.d(TAG, "Sending stop signal to " + inputPluginList.size()
+ " input plugins.");
for (final InputPlugin plugin : inputPluginList) {
- plugin.stopPlugin();
+ try {
+ plugin.stopPlugin();
+ } catch (final Exception e) {
+ Log.e(TAG, "Exception thrown while stopping input plugin.");
+ Log.e(TAG, e);
+ }
}
Log.d(TAG, "Sending stop signal to " + outputPluginList.size()
+ " output plugins.");
for (final OutputPlugin plugin : outputPluginList) {
- plugin.stopPlugin();
+ try {
+ plugin.stopPlugin();
+ } catch (final Exception e) {
+ Log.e(TAG, "Exception thrown while stopping output plugin.");
+ Log.e(TAG, e);
+ }
}
// Close the threadpool.
@@ -222,12 +232,22 @@ public void onStart(final Intent intent, final int startId) {
Log.d(TAG, "Sending start signal to " + outputPluginList.size()
+ " output plugins.");
for (final OutputPlugin plugin : outputPluginList) {
- plugin.startPlugin();
+ try {
+ plugin.startPlugin();
+ } catch (final Exception e) {
+ Log.e(TAG, "Exception thrown while starting output plugin.");
+ Log.e(TAG, e);
+ }
}
Log.d(TAG, "Sending start signal to " + inputPluginList.size()
+ " input plugins.");
for (final InputPlugin plugin : inputPluginList) {
- plugin.startPlugin();
+ try {
+ plugin.startPlugin();
+ } catch (final Exception e) {
+ Log.e(TAG, "Exception thrown while starting input plugin.");
+ Log.e(TAG, e);
+ }
}
// Register the receiver for when the preferences change.

0 comments on commit a5b55ba

Please sign in to comment.