svn commit: r14895 - trunk/src/argouml-app/src/org/argouml/moduleloader/ModuleLoader2.java

[email protected]
Newsgroups gmane.comp.lang.uml.argouml.cvs
Message-ID <[email protected]>
Author: dthompson
Date: 2008-06-10 13:43:56-0700
New Revision: 14895

Modified:
   trunk/src/argouml-app/src/org/argouml/moduleloader/ModuleLoader2.java

Log:
Issue 5089: Added try/catch to module initialisation to prevent module errors from crashing the whole application.

Modified: trunk/src/argouml-app/src/org/argouml/moduleloader/ModuleLoader2.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src/argouml-app/src/org/argouml/moduleloader/ModuleLoader2.java?view=diff&rev=14895&p1=trunk/src/argouml-app/src/org/argouml/moduleloader/ModuleLoader2.java&p2=trunk/src/argouml-app/src/org/argouml/moduleloader/ModuleLoader2.java&r1=14894&r2=14895
==============================================================================
--- trunk/src/argouml-app/src/org/argouml/moduleloader/ModuleLoader2.java	(original)
+++ trunk/src/argouml-app/src/org/argouml/moduleloader/ModuleLoader2.java	2008-06-10 13:43:56-0700
@@ -323,14 +323,28 @@
 		}
 
 		if (!status.isEnabled() && status.isSelected()) {
-		    if (module.enable()) {
-		        someModuleSucceeded = true;
-		        status.setEnabled();
+		    try {
+		        if (module.enable()) {
+		            someModuleSucceeded = true;
+		            status.setEnabled();
+		        }
+		    }
+		    // Catch all exceptions including runtime exceptions.
+		    catch (Exception e) {                       
+		        LOG.info("Exception while trying to enable module " 
+		                + module.getName(), e);
 		    }
 		} else if (status.isEnabled() && !status.isSelected()) {
-		    if (module.disable()) {
-		        someModuleSucceeded = true;
-		        status.setDisabled();
+		    try { 
+		        if (module.disable()) {
+		            someModuleSucceeded = true;
+		            status.setDisabled();
+		        }
+		    }
+                    // Catch all exceptions including runtime exceptions.
+		    catch (Exception e) {
+		        LOG.info("Exception while trying to disable module "
+		                + module.getName(), e);
 		    }
 		}
 	    }
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.