]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-3074 Keep SecurityManager in memory because FB plays with it
authorFabrice Bellingard <bellingard@gmail.com>
Wed, 16 May 2012 12:58:55 +0000 (14:58 +0200)
committerFabrice Bellingard <bellingard@gmail.com>
Wed, 16 May 2012 13:00:33 +0000 (15:00 +0200)
=> which causes an "access denied" on shutdown of the executor
   service

plugins/sonar-findbugs-plugin/src/main/java/org/sonar/plugins/findbugs/FindbugsExecutor.java

index e1d6464c3ac8e8af49521b2092ab742782e46861..cf7425403364350b5d4c0f06d6918d5eef7c71d9 100644 (file)
@@ -68,6 +68,7 @@ public class FindbugsExecutor implements BatchExtension {
 
   public File execute() {
     TimeProfiler profiler = new TimeProfiler().start("Execute Findbugs " + FindbugsVersion.getVersion());
+    SecurityManager currentSecurityManager = System.getSecurityManager();
     ClassLoader initialClassLoader = Thread.currentThread().getContextClassLoader();
     Thread.currentThread().setContextClassLoader(FindBugs2.class.getClassLoader());
 
@@ -125,6 +126,7 @@ public class FindbugsExecutor implements BatchExtension {
     } catch (Exception e) {
       throw new SonarException("Can not execute Findbugs", e);
     } finally {
+      System.setSecurityManager(currentSecurityManager);
       resetCustomPluginList(customPlugins);
       executorService.shutdown();
       IOUtils.closeQuietly(xmlOutput);