Author: mes
Date: 2010-02-18 16:47:39 -0800 (Thu, 18 Feb 2010)
New Revision: 19381

Modified:
   cytoscape/trunk/src/cytoscape/dialogs/plugins/PluginManageDialog.java
Log:
added error handling for the plugin manager such that exceptions will be noted

Modified: cytoscape/trunk/src/cytoscape/dialogs/plugins/PluginManageDialog.java
===================================================================
--- cytoscape/trunk/src/cytoscape/dialogs/plugins/PluginManageDialog.java       
2010-02-19 00:46:35 UTC (rev 19380)
+++ cytoscape/trunk/src/cytoscape/dialogs/plugins/PluginManageDialog.java       
2010-02-19 00:47:39 UTC (rev 19381)
@@ -42,6 +42,8 @@
 import cytoscape.plugin.ThemeInfo;
 import cytoscape.plugin.PluginInfo;
 import cytoscape.plugin.PluginManager;
+import cytoscape.plugin.PluginException;
+import cytoscape.plugin.ManagerException;
 
 import cytoscape.task.TaskMonitor;
 import cytoscape.task.ui.JTaskConfig;
@@ -761,38 +763,49 @@
                        try {
                                infoObj = Mgr.download(infoObj, taskMonitor);
                                taskMonitor.setStatus(infoObj.getName() + " v"
-                                               + infoObj.getObjectVersion() + 
" complete.");
+                                               + infoObj.getObjectVersion() + 
" download complete.");
 
                                
PluginManageDialog.this.setMessage(infoObj.toString()
-                                               + " install complete.");
+                                               + " download complete.");
 
-                               taskMonitor.setStatus(infoObj.toString() + " 
loading...");
+                               taskMonitor.setStatus(infoObj.toString() + " 
installing...");
 
                                Mgr.install(infoObj);
                                Mgr.loadPlugin(infoObj);
+
+                               if ( Mgr.getLoadingErrors().size() > 0 ) { 
+                                       // since we're only loading one plugin, 
presumably there will only
+                                       // be one throwable...
+                                       Throwable t = 
Mgr.getLoadingErrors().get(0);
+                                       Mgr.clearErrorList();
+                                       throw new PluginException("Failed to 
load plugin: " + infoObj.toString(),t); 
+                               }
+
+                               taskMonitor.setStatus(infoObj.toString() + " 
install complete.");
+                                       
                        } catch (java.io.IOException ioe) {
                                taskMonitor.setException(ioe, "Failed to 
download "
                                                                + 
infoObj.getName() + " from "
                                                                + 
infoObj.getObjectUrl());
-                               infoObj = null;
                                logger.warn("Failed to download "
                                                                + 
infoObj.getName() + " from "
                                                                + 
infoObj.getObjectUrl(), ioe);
-                       } catch (cytoscape.plugin.ManagerException me) {
+                               infoObj = null;
+                       } catch (ManagerException me) {
                                PluginManageDialog.this.setError("Failed to 
install " + infoObj.toString());
+                               logger.warn("Failed to install " + 
infoObj.toString(), me);
                                taskMonitor.setException(me, me.getMessage());
                                infoObj = null;
-                               logger.warn("Failed to install " + 
infoObj.toString(), me);
-                       } catch (cytoscape.plugin.PluginException pe) {
+                       } catch (PluginException pe) {
                                PluginManageDialog.this.setError("Failed to 
install " + infoObj.toString());
+                               logger.warn("Failed to install " + 
infoObj.toString(), pe);
+                               taskMonitor.setException(pe, pe.getMessage());
                                infoObj = null;
-                               taskMonitor.setException(pe, pe.getMessage());
-                               logger.warn("Failed to install " + 
infoObj.toString(), pe);
                        } catch (ClassNotFoundException cne) {
+                               PluginManageDialog.this.setError("Failed to 
install " + infoObj.toString());
+                               logger.warn("Failed to install " + 
infoObj.toString(), cne);
                                taskMonitor.setException(cne, cne.getMessage());
-                               PluginManageDialog.this.setError("Failed to 
install " + infoObj.toString());
                                infoObj = null;
-                               logger.warn("Failed to install " + 
infoObj.toString(), cne);
                        } finally {
                                taskMonitor.setPercentCompleted(100);
                        }
@@ -800,7 +813,7 @@
                        try {
                        if (infoObj == null)
                                ins.uninstall();
-                       } catch (cytoscape.plugin.ManagerException me) {
+                       } catch (ManagerException me) {
                                logger.warn("Failed to cleanup after 
installation failure", me);
                        }
                        

-- 
You received this message because you are subscribed to the Google Groups 
"cytoscape-cvs" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/cytoscape-cvs?hl=en.

Reply via email to