From 55c0003570731e64d7eeba8816bbf17fe04ee134 Mon Sep 17 00:00:00 2001 From: Godin Date: Wed, 3 Nov 2010 14:02:40 +0000 Subject: [PATCH] Fix installation for deprecated plugins --- .../sonar/server/plugins/PluginDeployer.java | 26 ++++++++++--------- 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/sonar-server/src/main/java/org/sonar/server/plugins/PluginDeployer.java b/sonar-server/src/main/java/org/sonar/server/plugins/PluginDeployer.java index e07c1519f56..38030582443 100644 --- a/sonar-server/src/main/java/org/sonar/server/plugins/PluginDeployer.java +++ b/sonar-server/src/main/java/org/sonar/server/plugins/PluginDeployer.java @@ -19,15 +19,6 @@ */ package org.sonar.server.plugins; -import java.io.File; -import java.io.IOException; -import java.net.URL; -import java.net.URLClassLoader; -import java.util.ArrayList; -import java.util.Collection; -import java.util.List; -import java.util.Map; - import org.apache.commons.io.FileUtils; import org.apache.commons.lang.StringUtils; import org.slf4j.Logger; @@ -48,6 +39,15 @@ import org.sonar.updatecenter.common.PluginKeyUtils; import com.google.common.collect.Lists; import com.google.common.collect.Maps; +import java.io.File; +import java.io.IOException; +import java.net.URL; +import java.net.URLClassLoader; +import java.util.ArrayList; +import java.util.Collection; +import java.util.List; +import java.util.Map; + public final class PluginDeployer implements ServerComponent { private static final Logger LOG = LoggerFactory.getLogger(PluginDeployer.class); @@ -224,7 +224,9 @@ public final class PluginDeployer implements ServerComponent { Collection jars = FileUtils.listFiles(fileSystem.getDownloadedPluginsDir(), new String[] { "jar" }, false); for (File jar : jars) { File movedJar = moveDownloadedFile(jar); - registerPluginMetadata(movedJar, false, true); + if (movedJar != null) { + registerPluginMetadata(movedJar, false, true); + } } } } @@ -235,11 +237,11 @@ public final class PluginDeployer implements ServerComponent { if (destFile.exists()) { // plugin with same filename already installed FileUtils.deleteQuietly(jar); - return destFile; + return null; } try { FileUtils.moveFileToDirectory(jar, destDir, true); - return new File(destDir, jar.getName()); + return destFile; } catch (IOException e) { LOG.error("Fail to move the downloaded file: " + jar.getAbsolutePath(), e); -- 2.39.5