diff options
author | Fabrice Bellingard <bellingard@gmail.com> | 2012-05-18 07:36:34 +0200 |
---|---|---|
committer | Fabrice Bellingard <bellingard@gmail.com> | 2012-05-18 07:37:01 +0200 |
commit | 50a8a9aff4fa0a241edfdd63fe2ef51a1e18dca1 (patch) | |
tree | 22006782f33683b8a181e6dae133a37dfc4cd002 /plugins/sonar-findbugs-plugin/src | |
parent | 3d2278a6cd3f62ad76de2a53e46d7694a495a6ba (diff) | |
download | sonarqube-50a8a9aff4fa0a241edfdd63fe2ef51a1e18dca1.tar.gz sonarqube-50a8a9aff4fa0a241edfdd63fe2ef51a1e18dca1.zip |
SONAR-3074 Add comments into the code about FB issue with Security Manager
Diffstat (limited to 'plugins/sonar-findbugs-plugin/src')
-rw-r--r-- | plugins/sonar-findbugs-plugin/src/main/java/org/sonar/plugins/findbugs/FindbugsExecutor.java | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/plugins/sonar-findbugs-plugin/src/main/java/org/sonar/plugins/findbugs/FindbugsExecutor.java b/plugins/sonar-findbugs-plugin/src/main/java/org/sonar/plugins/findbugs/FindbugsExecutor.java index 1f4e9c027ce..2d3aeaf389d 100644 --- a/plugins/sonar-findbugs-plugin/src/main/java/org/sonar/plugins/findbugs/FindbugsExecutor.java +++ b/plugins/sonar-findbugs-plugin/src/main/java/org/sonar/plugins/findbugs/FindbugsExecutor.java @@ -68,6 +68,8 @@ public class FindbugsExecutor implements BatchExtension { public File execute() { TimeProfiler profiler = new TimeProfiler().start("Execute Findbugs " + FindbugsVersion.getVersion()); + // We keep a handle on the current security manager because FB plays with it and we need to restore it before shutting down the executor + // service SecurityManager currentSecurityManager = System.getSecurityManager(); ClassLoader initialClassLoader = Thread.currentThread().getContextClassLoader(); Thread.currentThread().setContextClassLoader(FindBugs2.class.getClassLoader()); @@ -128,6 +130,7 @@ public class FindbugsExecutor implements BatchExtension { } catch (Exception e) { throw new SonarException("Can not execute Findbugs", e); } finally { + // we set back the original security manager BEFORE shutting down the executor service, otherwise there's a problem with Java 5 System.setSecurityManager(currentSecurityManager); resetCustomPluginList(customPlugins); executorService.shutdown(); @@ -180,12 +183,16 @@ public class FindbugsExecutor implements BatchExtension { LOG.warn("Failed to load plugin for custom detector: " + path); } catch (DuplicatePluginIdException e) { // simply ignore this + LOG.debug("Plugin already loaded: exception ignored: " + e.getMessage()); } } return customPluginList; } + /** + * Disable the update check for every plugin. See http://findbugs.sourceforge.net/updateChecking.html + */ private void disableUpdateChecksOnEveryPlugin() { for (Plugin plugin : Plugin.getAllPlugins()) { plugin.setMyGlobalOption("noUpdateChecks", "true"); |