diff options
author | Simon Brandhof <simon.brandhof@gmail.com> | 2012-03-23 07:40:31 +0100 |
---|---|---|
committer | Simon Brandhof <simon.brandhof@gmail.com> | 2012-03-23 07:40:31 +0100 |
commit | 837d97efea2cafffcbe626150f10e800cd55019e (patch) | |
tree | d8dcccbb6e368af6890512a43507f183596d2127 /sonar-core | |
parent | a88334d64b20fe8401548f4cdcffa9104aecc19a (diff) | |
download | sonarqube-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.java | 14 |
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); } } } |