aboutsummaryrefslogtreecommitdiffstats
path: root/sonar-server/src/main/java/org/sonar/server/platform
diff options
context:
space:
mode:
authorJulien Lancelot <julien.lancelot@sonarsource.com>2014-04-30 15:59:38 +0200
committerJulien Lancelot <julien.lancelot@sonarsource.com>2014-04-30 15:59:38 +0200
commit4e6ce48288c10f14af1969cef727bb32d31c5942 (patch)
treeec23bdbc08d25a3184f5337fd635a62c6db9b8e6 /sonar-server/src/main/java/org/sonar/server/platform
parent3c37551b26940cce769b1de4139bfd131d9d5f97 (diff)
downloadsonarqube-4e6ce48288c10f14af1969cef727bb32d31c5942.tar.gz
sonarqube-4e6ce48288c10f14af1969cef727bb32d31c5942.zip
Fix quality flaws
Diffstat (limited to 'sonar-server/src/main/java/org/sonar/server/platform')
-rw-r--r--sonar-server/src/main/java/org/sonar/server/platform/SonarHome.java75
1 files changed, 0 insertions, 75 deletions
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
deleted file mode 100644
index 2f1b7bcfafd..00000000000
--- a/sonar-server/src/main/java/org/sonar/server/platform/SonarHome.java
+++ /dev/null
@@ -1,75 +0,0 @@
-/*
- * SonarQube, open source software quality management tool.
- * Copyright (C) 2008-2014 SonarSource
- * mailto:contact AT sonarsource DOT com
- *
- * SonarQube is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * SonarQube is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-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.api.CoreProperties;
-
-import java.io.File;
-
-/**
- * Search fo the Sonar installation directory in the following ordered steps :
- * <ol>
- * <li>system property SONAR_HOME</li>
- * <li>environment variable SONAR_HOME</li>
- * </ol>
- *
- * @since 2.12
- *
- * TODO Delete it as it's now useless (SONAR_HOME is set by Tomcat)
- */
-final class SonarHome {
-
- private SonarHome() {
- // only static methods
- }
-
- static Supplier<File> homeSupplier = Suppliers.memoize(new Supplier<File>() {
- public File get() {
- File home = locate();
- System.setProperty(CoreProperties.SONAR_HOME, home.getAbsolutePath());
- return home;
- }
- });
-
- static File getHome() {
- return homeSupplier.get();
- }
-
- static File locate() {
- String value = System.getProperty(CoreProperties.SONAR_HOME);
- if (StringUtils.isBlank(value)) {
- value = System.getenv(CoreProperties.SONAR_HOME);
- }
-
- if (StringUtils.isBlank(value)) {
- throw new IllegalStateException("The system property or env variable " + CoreProperties.SONAR_HOME + " is not set");
- }
-
- File dir = new File(value);
- if (!dir.isDirectory() || !dir.exists()) {
- throw new IllegalStateException(CoreProperties.SONAR_HOME + " is not valid: " + value + ". Please fix the env variable/system " +
- "property " + CoreProperties.SONAR_HOME);
- }
- return dir;
- }
-}