aboutsummaryrefslogtreecommitdiffstats
path: root/sonar-core
diff options
context:
space:
mode:
authorSimon Brandhof <simon.brandhof@gmail.com>2012-03-23 07:40:31 +0100
committerSimon Brandhof <simon.brandhof@gmail.com>2012-03-23 07:40:31 +0100
commit837d97efea2cafffcbe626150f10e800cd55019e (patch)
treed8dcccbb6e368af6890512a43507f183596d2127 /sonar-core
parenta88334d64b20fe8401548f4cdcffa9104aecc19a (diff)
downloadsonarqube-837d97efea2cafffcbe626150f10e800cd55019e.tar.gz
sonarqube-837d97efea2cafffcbe626150f10e800cd55019e.zip
Fix some quality flaws
Diffstat (limited to 'sonar-core')
-rw-r--r--sonar-core/src/main/java/org/sonar/core/plugins/PluginInstaller.java14
1 files changed, 8 insertions, 6 deletions
diff --git a/sonar-core/src/main/java/org/sonar/core/plugins/PluginInstaller.java b/sonar-core/src/main/java/org/sonar/core/plugins/PluginInstaller.java
index 3be1816658c..94c2c6f4bad 100644
--- a/sonar-core/src/main/java/org/sonar/core/plugins/PluginInstaller.java
+++ b/sonar-core/src/main/java/org/sonar/core/plugins/PluginInstaller.java
@@ -62,11 +62,7 @@ public class PluginInstaller {
if (metadata.getPathsToInternalDeps().length > 0) {
// needs to unzip the jar
- ZipUtils.unzip(pluginFile, pluginBasedir, new ZipUtils.ZipEntryFilter() {
- public boolean accept(ZipEntry entry) {
- return entry.getName().startsWith("META-INF/lib");
- }
- });
+ ZipUtils.unzip(pluginFile, pluginBasedir, new LibFilter());
for (String depPath : metadata.getPathsToInternalDeps()) {
File dependency = new File(pluginBasedir, depPath);
if (!dependency.isFile() || !dependency.exists()) {
@@ -91,6 +87,12 @@ public class PluginInstaller {
}
}
+ private static class LibFilter implements ZipUtils.ZipEntryFilter {
+ public boolean accept(ZipEntry entry) {
+ return entry.getName().startsWith("META-INF/lib");
+ }
+ }
+
public DefaultPluginMetadata extractMetadata(File file, boolean isCore) {
try {
PluginManifest manifest = new PluginManifest(file);
@@ -133,7 +135,7 @@ public class PluginInstaller {
metadata.setName(pluginInstance.getName());
} catch (Exception e) {
- throw new RuntimeException("The metadata main class can not be created. Plugin file=" + pluginFile.getName() + ", class=" + mainClass, e);
+ throw new IllegalStateException("The metadata main class can not be created. Plugin file=" + pluginFile.getName() + ", class=" + mainClass, e);
}
}
}