Source:
<code>private FredPlugin loadPlugin(PluginDownLoader<?> pdl, String name, PluginProgress progress, boolean alwaysDownload) throws PluginNotFoundException, PluginAlreadyLoaded { pdl.setSource(name); File pluginDirectory = getPluginDirectory(); String filename = pdl.getPluginName(name); File pluginFile = getTargetFileForPluginDownload(pluginDirectory, filename, !pdl.isCachingProhibited() && !alwaysDownload); boolean downloaded = false; if(logMINOR) Logger.minor(this, "plugin file " + pluginFile.getAbsolutePath() + " exists: " + pluginFile.exists()+" downloader "+pdl+" name "+name); int RETRIES = 5; for (int i = 0; i < RETRIES; i++) { if (!pluginFile.exists() || pluginFile.length() == 0) { try { <START> downloaded = true; <END> System.err.println("Downloading plugin " + name); WrapperManager.signalStarting((int) MINUTES.toMillis(5)); try { downloadPluginFile(pdl, pluginDirectory, pluginFile, progress); verifyDigest(pdl, pluginFile); } catch (IOException ioe1) { Logger.error(this, "could not load plugin", ioe1); throw new PluginNotFoundException("could not load plugin: " + ioe1.getMessage(), ioe1); } } catch (PluginNotFoundException e) { if (i < RETRIES - 1) { Logger.normal(this, "Failed to load plugin: " + e, e); continue; } else { throw e; } } } cancelRunningLoads(name, progress); synchronized (pluginLoadSyncObject) { String pluginMainClassName; try { pluginMainClassName = verifyJarFileAndGetPluginMainClass(pluginFile); FredPlugin object = loadPluginFromJarFile(name, pluginFile, pluginMainClassName, pdl.isOfficialPluginLoader()); if (object != null) { return object; } } catch (PluginNotFoundException e) { Logger.error(this, e.getMessage()); pluginFile.delete(); if (!downloaded) { continue; } throw e; } } } return null; }</code><technical_language>is this flag set here? downloaded this point flag reset false</technical_language>

Target:
private FredPlugin loadPlugin(PluginDownLoader<?> pdl, String name, PluginProgress progress, boolean alwaysDownload) throws PluginNotFoundException, PluginAlreadyLoaded { pdl.setSource(name); File pluginDirectory = getPluginDirectory(); String filename = pdl.getPluginName(name); File pluginFile = getTargetFileForPluginDownload(pluginDirectory, filename, !pdl.isCachingProhibited() && !alwaysDownload); boolean downloadWasAttempted = false; if(logMINOR) Logger.minor(this, "plugin file " + pluginFile.getAbsolutePath() + " exists: " + pluginFile.exists()+" downloader "+pdl+" name "+name); int RETRIES = 5; for (int i = 0; i < RETRIES; i++) { if (!pluginFile.exists() || pluginFile.length() == 0) { try { downloadWasAttempted = true; System.err.println("Downloading plugin " + name); WrapperManager.signalStarting((int) MINUTES.toMillis(5)); try { downloadPluginFile(pdl, pluginDirectory, pluginFile, progress); verifyDigest(pdl, pluginFile); } catch (IOException ioe1) { Logger.error(this, "could not load plugin", ioe1); throw new PluginNotFoundException("could not load plugin: " + ioe1.getMessage(), ioe1); } } catch (PluginNotFoundException e) { if (i < RETRIES - 1) { Logger.normal(this, "Failed to load plugin: " + e, e); continue; } else { throw e; } } } cancelRunningLoads(name, progress); synchronized (pluginLoadSyncObject) { String pluginMainClassName; try { pluginMainClassName = verifyJarFileAndGetPluginMainClass(pluginFile); FredPlugin object = loadPluginFromJarFile(name, pluginFile, pluginMainClassName, pdl.isOfficialPluginLoader()); if (object != null) { return object; } } catch (PluginNotFoundException e) { Logger.error(this, e.getMessage()); pluginFile.delete(); if (!downloadWasAttempted) { continue; } throw e; } } } return null; }