]> source.dussan.org Git - sonar-scanner-cli.git/commitdiff
Improve quality (#34)
authorJanos Gyerik <janos.gyerik@sonarsource.com>
Thu, 20 Jul 2017 14:17:39 +0000 (16:17 +0200)
committerGitHub <noreply@github.com>
Thu, 20 Jul 2017 14:17:39 +0000 (16:17 +0200)
src/main/java/org/sonarsource/scanner/cli/Conf.java
src/main/java/org/sonarsource/scanner/cli/Main.java
src/main/java/org/sonarsource/scanner/cli/ScannerVersion.java

index 8bfe39cc44e7435ed060543209b9e8c69c7b2353..26f44f07b0d927aedd69bcc8103001f960263b78 100644 (file)
@@ -55,7 +55,7 @@ class Conf {
     this.env = env;
   }
 
-  Properties properties() throws IOException {
+  Properties properties() {
     Properties result = new Properties();
     result.putAll(loadGlobalProperties());
     result.putAll(loadProjectProperties());
@@ -79,7 +79,7 @@ class Conf {
     return Utils.loadEnvironmentProperties(env);
   }
 
-  private Properties loadGlobalProperties() throws IOException {
+  private Properties loadGlobalProperties() {
     Path settingsFile = locatePropertiesFile(cli.properties(), SCANNER_HOME, "conf/sonar-scanner.properties",
       SCANNER_SETTINGS);
     if (settingsFile != null && Files.isRegularFile(settingsFile)) {
@@ -90,7 +90,7 @@ class Conf {
     return new Properties();
   }
 
-  private Properties loadProjectProperties() throws IOException {
+  private Properties loadProjectProperties() {
     Properties rootProps = new Properties();
     Properties knownProps = new Properties();
 
index fe7ad94d2f9348da0bbf56e6350c3e9412a214cc..d93116bc3b5021a9511376cd477df8c1a8f47876 100644 (file)
@@ -19,7 +19,6 @@
  */
 package org.sonarsource.scanner.cli;
 
-import java.io.IOException;
 import java.util.Properties;
 import org.sonarsource.scanner.api.EmbeddedScanner;
 import org.sonarsource.scanner.api.ScanProperties;
@@ -102,7 +101,7 @@ public class Main {
     }
   }
 
-  private void init(Properties p) throws IOException {
+  private void init(Properties p) {
     SystemInfo.print(logger);
     if (cli.isDisplayVersionOnly()) {
       exit.exit(Exit.SUCCESS);
@@ -111,7 +110,7 @@ public class Main {
     runner = runnerFactory.create(p);
   }
 
-  private void configureLogging(Properties props) throws IOException {
+  private void configureLogging(Properties props) {
     if ("true".equals(props.getProperty("sonar.verbose"))
       || "DEBUG".equalsIgnoreCase(props.getProperty("sonar.log.level"))
       || "TRACE".equalsIgnoreCase(props.getProperty("sonar.log.level"))) {
index 318443994aaa0a97365c9f073e2a0a97a2dc3457..8e05244b89296ff80fa14377af2cb07b5aded7dc 100644 (file)
@@ -27,12 +27,9 @@ public enum ScannerVersion {
 
   private String version;
 
-  private ScannerVersion() {
-    Scanner scanner = new Scanner(getClass().getResourceAsStream("/version.txt"), "UTF-8");
-    try {
+  ScannerVersion() {
+    try (Scanner scanner = new Scanner(getClass().getResourceAsStream("/version.txt"), "UTF-8")) {
       this.version = scanner.next();
-    } finally {
-      scanner.close();
     }
   }