Author: bombe
Date: 2007-11-03 14:19:14 +0000 (Sat, 03 Nov 2007)
New Revision: 15671

Modified:
   trunk/freenet/src/freenet/pluginmanager/PluginManager.java
Log:
fix plugin loading when manifest is wrong

Modified: trunk/freenet/src/freenet/pluginmanager/PluginManager.java
===================================================================
--- trunk/freenet/src/freenet/pluginmanager/PluginManager.java  2007-11-03 
12:46:03 UTC (rev 15670)
+++ trunk/freenet/src/freenet/pluginmanager/PluginManager.java  2007-11-03 
14:19:14 UTC (rev 15671)
@@ -483,12 +483,16 @@
                                Logger.error(this, "could not load manifest 
from plugin file");
                                throw new PluginNotFoundException("could not 
load manifest from plugin file");
                        }
-                       Attributes pluginMainClassAttributes = 
manifest.getMainAttributes();
-                       if (pluginMainClassAttributes == null) {
-                               Logger.error(this, "manifest does not contain 
Plugin-Main-Class attribute");
-                               throw new PluginNotFoundException("manifest 
does not contain Plugin-Main-Class attribute");
+                       Attributes mainAttributes = 
manifest.getMainAttributes();
+                       if (mainAttributes == null) {
+                               Logger.error(this, "manifest does not contain 
attributes");
+                               throw new PluginNotFoundException("manifest 
does not contain attributes");
                        }
-                       pluginMainClassName = 
pluginMainClassAttributes.getValue("Plugin-Main-Class");
+                       pluginMainClassName = 
mainAttributes.getValue("Plugin-Main-Class");
+                       if (pluginMainClassName == null) {
+                               Logger.error(this, "manifest does not contain a 
Plugin-Main-Class attribute");
+                               throw new PluginNotFoundException("manifest 
does not contain a Plugin-Main-Class attribute");
+                       }
                } catch (JarException je1) {
                        Logger.error(this, "could not process jar file", je1);
                        throw new PluginNotFoundException("could not process 
jar file", je1);


Reply via email to