]> source.dussan.org Git - sonarqube.git/commitdiff
Remove violations
authorDavid Gageot <david@gageot.net>
Thu, 14 Jun 2012 12:20:53 +0000 (14:20 +0200)
committerDavid Gageot <david@gageot.net>
Thu, 14 Jun 2012 15:31:56 +0000 (17:31 +0200)
sonar-plugin-api/src/main/java/org/sonar/api/security/GroupRole.java
sonar-server/src/main/java/org/sonar/server/platform/SonarHome.java

index 16f750b02dbb828f6e035cca633343f3b7973574..56e2cf9ae18c040597b3f027790314046b2d9a54 100644 (file)
@@ -19,7 +19,6 @@
  */
 package org.sonar.api.security;
 
-import com.google.common.base.Objects;
 import org.apache.commons.lang.builder.ReflectionToStringBuilder;
 import org.apache.commons.lang.builder.ToStringStyle;
 import org.sonar.api.database.BaseIdentifiable;
@@ -82,7 +81,7 @@ public class GroupRole extends BaseIdentifiable {
   }
 
   public boolean isAnyone() {
-    return Objects.equal(groupId, ANYONE_GROUP_ID);
+    return groupId == ANYONE_GROUP_ID;
   }
 
   @Override
index 42d5f3f56c2d0aaba9f46ae4240f539c20c14fec..1a530a15d11f9bdaf6ef32bdb89fcc2f053c4af8 100644 (file)
@@ -19,6 +19,8 @@
  */
 package org.sonar.server.platform;
 
+import com.google.common.base.Supplier;
+import com.google.common.base.Suppliers;
 import org.apache.commons.lang.StringUtils;
 import org.sonar.core.config.ConfigurationUtils;
 
@@ -44,14 +46,16 @@ final class SonarHome {
   }
 
   static final String PROPERTY = "SONAR_HOME";
-  private static File home;
-
-  static File getHome() {
-    if (home == null) {
-      home = locate();
+  static Supplier<File> homeSupplier = Suppliers.memoize(new Supplier<File>() {
+    public File get() {
+      File home = locate();
       System.setProperty(PROPERTY, home.getAbsolutePath());
+      return home;
     }
-    return home;
+  });
+
+  static File getHome() {
+    return homeSupplier.get();
   }
 
   static File locate() {