diff options
author | simonbrandhof <simon.brandhof@gmail.com> | 2010-12-16 14:23:21 +0000 |
---|---|---|
committer | simonbrandhof <simon.brandhof@gmail.com> | 2010-12-16 14:23:21 +0000 |
commit | 754e9f69fde222558a49176759c5adb8f1d4135d (patch) | |
tree | f34e9a4bd9a4dfcb263aafaf09f818ee865b727b | |
parent | 63de6b681097d09f043228bb9e19189ec1f5e651 (diff) | |
download | sonarqube-754e9f69fde222558a49176759c5adb8f1d4135d.tar.gz sonarqube-754e9f69fde222558a49176759c5adb8f1d4135d.zip |
SONAR-1948 Temporary folder is not deleted after installation of plugins
-rw-r--r-- | sonar-server/src/main/java/org/sonar/server/plugins/PluginDeployer.java | 14 |
1 files changed, 7 insertions, 7 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 b78b00cdea2..6da8ea3fd49 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,6 +19,8 @@ */ package org.sonar.server.plugins; +import com.google.common.collect.Lists; +import com.google.common.collect.Maps; import org.apache.commons.io.FileUtils; import org.apache.commons.lang.StringUtils; import org.slf4j.Logger; @@ -36,9 +38,6 @@ import org.sonar.server.platform.DefaultServerFileSystem; import org.sonar.server.platform.ServerStartException; 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; @@ -105,7 +104,7 @@ public final class PluginDeployer implements ServerComponent { public List<String> getUninstalls() { List<String> names = Lists.newArrayList(); if (fileSystem.getRemovedPluginsDir().exists()) { - List<File> files = (List<File>) FileUtils.listFiles(fileSystem.getRemovedPluginsDir(), new String[] { "jar" }, false); + List<File> files = (List<File>) FileUtils.listFiles(fileSystem.getRemovedPluginsDir(), new String[]{"jar"}, false); for (File file : files) { names.add(file.getName()); } @@ -115,7 +114,7 @@ public final class PluginDeployer implements ServerComponent { public void cancelUninstalls() { if (fileSystem.getRemovedPluginsDir().exists()) { - List<File> files = (List<File>) FileUtils.listFiles(fileSystem.getRemovedPluginsDir(), new String[] { "jar" }, false); + List<File> files = (List<File>) FileUtils.listFiles(fileSystem.getRemovedPluginsDir(), new String[]{"jar"}, false); for (File file : files) { try { FileUtils.moveFileToDirectory(file, fileSystem.getUserPluginsDir(), false); @@ -199,6 +198,7 @@ public final class PluginDeployer implements ServerComponent { FileUtils.copyFile(file, target); plugin.addDeployedFile(target); } + FileUtils.deleteQuietly(tempDir); } classloaders.create(plugin); @@ -221,7 +221,7 @@ public final class PluginDeployer implements ServerComponent { private void moveAndLoadDownloadedPlugins() throws IOException { if (fileSystem.getDownloadedPluginsDir().exists()) { - Collection<File> jars = FileUtils.listFiles(fileSystem.getDownloadedPluginsDir(), new String[] { "jar" }, false); + Collection<File> jars = FileUtils.listFiles(fileSystem.getDownloadedPluginsDir(), new String[]{"jar"}, false); for (File jar : jars) { File movedJar = moveDownloadedFile(jar); if (movedJar != null) { @@ -284,7 +284,7 @@ public final class PluginDeployer implements ServerComponent { String mainClass = plugin.getMainClass(); try { - URLClassLoader pluginClassLoader = URLClassLoader.newInstance(new URL[] { tempFile.toURI().toURL() }, getClass().getClassLoader()); + URLClassLoader pluginClassLoader = URLClassLoader.newInstance(new URL[]{tempFile.toURI().toURL()}, getClass().getClassLoader()); Plugin pluginInstance = (Plugin) pluginClassLoader.loadClass(mainClass).newInstance(); plugin.setKey(PluginKeyUtils.sanitize(pluginInstance.getKey())); plugin.setDescription(pluginInstance.getDescription()); |