From 11b6a9f6d40f2c843faa4d70a61b17fcb9e4a1fa Mon Sep 17 00:00:00 2001 From: Simon Brandhof Date: Sat, 6 Apr 2013 01:10:46 +0200 Subject: [PATCH] Minor refactoring --- sonar-runner-dist/src/main/java/org/sonar/runner/Cli.java | 2 +- .../src/main/java/org/sonar/runner/Conf.java | 8 ++++---- .../src/main/java/org/sonar/runner/SystemInfo.java | 4 ++++ 3 files changed, 9 insertions(+), 5 deletions(-) diff --git a/sonar-runner-dist/src/main/java/org/sonar/runner/Cli.java b/sonar-runner-dist/src/main/java/org/sonar/runner/Cli.java index 0acb6ee..2c29dbc 100644 --- a/sonar-runner-dist/src/main/java/org/sonar/runner/Cli.java +++ b/sonar-runner-dist/src/main/java/org/sonar/runner/Cli.java @@ -124,6 +124,6 @@ class Cli { Logs.info(" -h,--help Display help information"); Logs.info(" -v,--version Display version information"); Logs.info(" -X,--debug Produce execution debug output"); - System.exit(0); + System.exit(Exit.SUCCESS); } } diff --git a/sonar-runner-dist/src/main/java/org/sonar/runner/Conf.java b/sonar-runner-dist/src/main/java/org/sonar/runner/Conf.java index 13b5239..e92cdcd 100644 --- a/sonar-runner-dist/src/main/java/org/sonar/runner/Conf.java +++ b/sonar-runner-dist/src/main/java/org/sonar/runner/Conf.java @@ -77,14 +77,14 @@ class Conf { private File locatePropertiesFile(Properties props, String homeKey, String relativePathFromHome, String settingsKey) { File settingsFile = null; - String runnerHome = props.getProperty(homeKey); - if (runnerHome != null && !"".equals(runnerHome)) { + String runnerHome = props.getProperty(homeKey, ""); + if (!"".equals(runnerHome)) { settingsFile = new File(runnerHome, relativePathFromHome); } if (settingsFile == null || !settingsFile.exists()) { - String settingsPath = props.getProperty(settingsKey); - if (settingsPath != null && !"".equals(settingsPath)) { + String settingsPath = props.getProperty(settingsKey, ""); + if (!"".equals(settingsPath)) { settingsFile = new File(settingsPath); } } diff --git a/sonar-runner-dist/src/main/java/org/sonar/runner/SystemInfo.java b/sonar-runner-dist/src/main/java/org/sonar/runner/SystemInfo.java index c199d5b..a153d02 100644 --- a/sonar-runner-dist/src/main/java/org/sonar/runner/SystemInfo.java +++ b/sonar-runner-dist/src/main/java/org/sonar/runner/SystemInfo.java @@ -23,6 +23,10 @@ import org.sonar.runner.api.RunnerVersion; class SystemInfo { + private SystemInfo() { + // only static methods + } + static void print() { System.out.println("Sonar Runner " + RunnerVersion.version()); System.out.println(java()); -- 2.39.5