]> source.dussan.org Git - sonarqube.git/commitdiff
Fix installation for deprecated plugins
authorGodin <mandrikov@gmail.com>
Wed, 3 Nov 2010 14:02:40 +0000 (14:02 +0000)
committerGodin <mandrikov@gmail.com>
Wed, 3 Nov 2010 14:02:40 +0000 (14:02 +0000)
sonar-server/src/main/java/org/sonar/server/plugins/PluginDeployer.java

index e07c1519f5665704f495309db16dccfaa7ba8593..38030582443d5165d53a346c4379c37a735e8648 100644 (file)
  */
 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<File> 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);