Author: toad
Date: 2007-09-08 18:02:20 +0000 (Sat, 08 Sep 2007)
New Revision: 15069

Modified:
   trunk/freenet/src/freenet/pluginmanager/PluginManager.java
Log:
Retrying download on <plugin># wasn't working because the 2nd through 5th tries 
were all on the downloaded file because we change filename. :)

Modified: trunk/freenet/src/freenet/pluginmanager/PluginManager.java
===================================================================
--- trunk/freenet/src/freenet/pluginmanager/PluginManager.java  2007-09-08 
17:57:16 UTC (rev 15068)
+++ trunk/freenet/src/freenet/pluginmanager/PluginManager.java  2007-09-08 
18:02:20 UTC (rev 15069)
@@ -309,11 +309,12 @@
         * @return                      An instanciated object of the plugin
         * @throws PluginNotFoundException      If anything goes wrong.
         */
-       private FredPlugin LoadPlugin(String filename)
+       private FredPlugin LoadPlugin(String origFilename)
                        throws PluginNotFoundException {
                logMINOR = Logger.shouldLog(Logger.MINOR, this);
                Class cls = null;
-               for (int tries = 0; (tries <= 5) && (cls == null); tries++)
+               for (int tries = 0; (tries <= 5) && (cls == null); tries++) {
+                       String filename = origFilename;
                        try {
                                if (filename.endsWith("*")) {
                                        filename = 
"*@http://downloads.freenetproject.org/alpha/plugins/";
@@ -529,6 +530,7 @@
                                } catch (Exception ee) {
                                }
                        }
+               }

                // Class loaded... Objectize it!
                Object o = null;
@@ -536,12 +538,12 @@
                        o = cls.newInstance();
                } catch (Exception e) {
                        throw new PluginNotFoundException("Could not re-create 
plugin:"
-                                       + filename, e);
+                                       + origFilename, e);
                }

                // See if we have the right type
                if (!(o instanceof FredPlugin)) {
-                       throw new PluginNotFoundException("Not a plugin: " + 
filename);
+                       throw new PluginNotFoundException("Not a plugin: " + 
origFilename);
                }

                return (FredPlugin) o;


Reply via email to