From: David Gageot Date: Thu, 14 Jun 2012 12:20:53 +0000 (+0200) Subject: Remove violations X-Git-Tag: 3.2~330 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=1490d6c6f32bb606f197999362f47d13a6c6c6de;p=sonarqube.git Remove violations --- diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/security/GroupRole.java b/sonar-plugin-api/src/main/java/org/sonar/api/security/GroupRole.java index 16f750b02db..56e2cf9ae18 100644 --- a/sonar-plugin-api/src/main/java/org/sonar/api/security/GroupRole.java +++ b/sonar-plugin-api/src/main/java/org/sonar/api/security/GroupRole.java @@ -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 diff --git a/sonar-server/src/main/java/org/sonar/server/platform/SonarHome.java b/sonar-server/src/main/java/org/sonar/server/platform/SonarHome.java index 42d5f3f56c2..1a530a15d11 100644 --- a/sonar-server/src/main/java/org/sonar/server/platform/SonarHome.java +++ b/sonar-server/src/main/java/org/sonar/server/platform/SonarHome.java @@ -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 homeSupplier = Suppliers.memoize(new Supplier() { + public File get() { + File home = locate(); System.setProperty(PROPERTY, home.getAbsolutePath()); + return home; } - return home; + }); + + static File getHome() { + return homeSupplier.get(); } static File locate() {