diff options
author | Julien HENRY <julien.henry@sonarsource.com> | 2016-03-24 15:53:36 +0100 |
---|---|---|
committer | Julien HENRY <julien.henry@sonarsource.com> | 2016-03-30 11:42:16 +0200 |
commit | 10955ec396a053d596a40ac3fdf7ca73dd911327 (patch) | |
tree | c390cd08b8b44656206306c94213204baeec737c /sonar-core/src/main | |
parent | 946a448c08ccc10ad1c0af778ae5d9f179655ef8 (diff) | |
download | sonarqube-10955ec396a053d596a40ac3fdf7ca73dd911327.tar.gz sonarqube-10955ec396a053d596a40ac3fdf7ca73dd911327.zip |
SONAR-7458 Expose SQ Version in SensorContext
Diffstat (limited to 'sonar-core/src/main')
-rw-r--r-- | sonar-core/src/main/java/org/sonar/core/platform/SonarQubeVersionProvider.java | 49 |
1 files changed, 0 insertions, 49 deletions
diff --git a/sonar-core/src/main/java/org/sonar/core/platform/SonarQubeVersionProvider.java b/sonar-core/src/main/java/org/sonar/core/platform/SonarQubeVersionProvider.java deleted file mode 100644 index a0f54de7490..00000000000 --- a/sonar-core/src/main/java/org/sonar/core/platform/SonarQubeVersionProvider.java +++ /dev/null @@ -1,49 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2016 SonarSource SA - * mailto:contact AT sonarsource DOT com - * - * This program 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. - * - * This program 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.core.platform; - -import com.google.common.io.Resources; -import java.io.IOException; -import java.net.URL; -import java.nio.charset.StandardCharsets; -import org.picocontainer.injectors.ProviderAdapter; -import org.sonar.api.SonarQubeVersion; -import org.sonar.api.utils.System2; -import org.sonar.api.utils.Version; - -public class SonarQubeVersionProvider extends ProviderAdapter { - - private static final String FILE_PATH = "/sq-version.txt"; - - private SonarQubeVersion version = null; - - public SonarQubeVersion provide(System2 system) { - if (version == null) { - try { - URL url = system.getResource(FILE_PATH); - String versionInFile = Resources.toString(url, StandardCharsets.UTF_8); - version = new SonarQubeVersion(Version.parse(versionInFile)); - } catch (IOException e) { - throw new IllegalStateException("Can not load " + FILE_PATH + " from classpath", e); - } - } - return version; - } -} |