this.env = env;
}
- Properties properties() throws IOException {
+ Properties properties() {
Properties result = new Properties();
result.putAll(loadGlobalProperties());
result.putAll(loadProjectProperties());
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)) {
return new Properties();
}
- private Properties loadProjectProperties() throws IOException {
+ private Properties loadProjectProperties() {
Properties rootProps = new Properties();
Properties knownProps = new Properties();
*/
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;
}
}
- private void init(Properties p) throws IOException {
+ private void init(Properties p) {
SystemInfo.print(logger);
if (cli.isDisplayVersionOnly()) {
exit.exit(Exit.SUCCESS);
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"))) {
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();
}
}