diff options
12 files changed, 53 insertions, 25 deletions
diff --git a/plugins/sonar-xoo-plugin/src/main/java/org/sonar/xoo/test/package-info.java b/plugins/sonar-xoo-plugin/src/main/java/org/sonar/xoo/test/package-info.java new file mode 100644 index 00000000000..18e3816c970 --- /dev/null +++ b/plugins/sonar-xoo-plugin/src/main/java/org/sonar/xoo/test/package-info.java @@ -0,0 +1,23 @@ +/* + * 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. + */ +@ParametersAreNonnullByDefault +package org.sonar.xoo.test; + +import javax.annotation.ParametersAreNonnullByDefault; diff --git a/server/sonar-server/src/main/java/org/sonar/server/notifications/NotificationService.java b/server/sonar-server/src/main/java/org/sonar/server/notifications/NotificationService.java index 7d4e786c9a6..e33af89334d 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/notifications/NotificationService.java +++ b/server/sonar-server/src/main/java/org/sonar/server/notifications/NotificationService.java @@ -83,7 +83,8 @@ public class NotificationService implements Startable { /** * Constructor for {@link NotificationService} */ - public NotificationService(Settings settings, DefaultNotificationManager manager, DbClient dbClient, DatabaseSessionFactory databaseSessionFactory, NotificationDispatcher[] dispatchers) { + public NotificationService(Settings settings, DefaultNotificationManager manager, DbClient dbClient, + DatabaseSessionFactory databaseSessionFactory, NotificationDispatcher[] dispatchers) { this.databaseSessionFactory = databaseSessionFactory; this.delayInSeconds = settings.getLong(PROPERTY_DELAY); this.delayBeforeReportingStatusInSeconds = settings.getLong(PROPERTY_DELAY_BEFORE_REPORTING_STATUS); @@ -95,7 +96,8 @@ public class NotificationService implements Startable { /** * Default constructor when no dispatchers. */ - public NotificationService(Settings settings, DefaultNotificationManager manager, DbClient dbClient, DatabaseSessionFactory databaseSessionFactory) { + public NotificationService(Settings settings, DefaultNotificationManager manager, DbClient dbClient, + DatabaseSessionFactory databaseSessionFactory) { this(settings, manager, dbClient, databaseSessionFactory, new NotificationDispatcher[0]); } @@ -157,7 +159,8 @@ public class NotificationService implements Startable { @VisibleForTesting void log(long notifSentCount, long remainingNotifCount, long spentTimeInMinutes) { - LOG.info("{} notifications sent during the past {} minutes and {} still waiting to be sent", new Object[] {notifSentCount, spentTimeInMinutes, remainingNotifCount}); + LOG.info("{} notifications sent during the past {} minutes and {} still waiting to be sent", + new Object[] {notifSentCount, spentTimeInMinutes, remainingNotifCount}); } @VisibleForTesting diff --git a/server/sonar-server/src/main/java/org/sonar/server/project/ws/ProjectsWs.java b/server/sonar-server/src/main/java/org/sonar/server/project/ws/ProjectsWs.java index 320a08f7083..9a8e7556f26 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/project/ws/ProjectsWs.java +++ b/server/sonar-server/src/main/java/org/sonar/server/project/ws/ProjectsWs.java @@ -67,22 +67,22 @@ public class ProjectsWs implements WebService { action.createParam("desc") .setDescription("Load project description") .setDefaultValue("true") - .setPossibleValues("true", "false"); + .setBooleanPossibleValues(); action.createParam("subprojects") .setDescription("Load sub-projects. Ignored if the parameter key is set") .setDefaultValue("false") - .setPossibleValues("true", "false"); + .setBooleanPossibleValues(); action.createParam("views") .setDescription("Load views and sub-views. Ignored if the parameter key is set") .setDefaultValue("false") - .setPossibleValues("true", "false"); + .setBooleanPossibleValues(); action.createParam("libs") .setDescription("Load libraries. Ignored if the parameter key is set") .setDefaultValue("false") - .setPossibleValues("true", "false"); + .setBooleanPossibleValues(); action.createParam("versions") .setDescription("Load version") diff --git a/server/sonar-server/src/main/java/org/sonar/server/user/db/UserDao.java b/server/sonar-server/src/main/java/org/sonar/server/user/db/UserDao.java index 27ceda98e93..34ff843b15c 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/user/db/UserDao.java +++ b/server/sonar-server/src/main/java/org/sonar/server/user/db/UserDao.java @@ -50,7 +50,9 @@ public class UserDao extends org.sonar.core.user.UserDao implements DaoComponent } public List<UserDto> selectNullableByScmAccountOrLoginOrEmail(DbSession session, String scmAccountOrLoginOrEmail) { - String like = new StringBuilder().append("%").append(UserDto.SCM_ACCOUNTS_SEPARATOR).append(scmAccountOrLoginOrEmail).append(UserDto.SCM_ACCOUNTS_SEPARATOR).append("%").toString(); + String like = new StringBuilder().append("%") + .append(UserDto.SCM_ACCOUNTS_SEPARATOR).append(scmAccountOrLoginOrEmail) + .append(UserDto.SCM_ACCOUNTS_SEPARATOR).append("%").toString(); return mapper(session).selectNullableByScmAccountOrLoginOrEmail(scmAccountOrLoginOrEmail, like); } diff --git a/sonar-application/src/main/java/org/sonar/application/AppLogging.java b/sonar-application/src/main/java/org/sonar/application/AppLogging.java index 6c8e56553da..bec5548a4bd 100644 --- a/sonar-application/src/main/java/org/sonar/application/AppLogging.java +++ b/sonar-application/src/main/java/org/sonar/application/AppLogging.java @@ -60,7 +60,7 @@ class AppLogging { /** * Enable the copy in console of the logs written in logs/sonar.log */ - private void copyGobblerToConsole() { + private static void copyGobblerToConsole() { Logger consoleLogger = (Logger) LoggerFactory.getLogger(CONSOLE_LOGGER); Appender consoleAppender = consoleLogger.getAppender(CONSOLE_APPENDER); diff --git a/sonar-application/src/main/java/org/sonar/application/JdbcSettings.java b/sonar-application/src/main/java/org/sonar/application/JdbcSettings.java index d85612b74fa..cbfbf4d6265 100644 --- a/sonar-application/src/main/java/org/sonar/application/JdbcSettings.java +++ b/sonar-application/src/main/java/org/sonar/application/JdbcSettings.java @@ -92,7 +92,7 @@ public class JdbcSettings { } } - private void checkRequiredParameter(String url, String val) { + private static void checkRequiredParameter(String url, String val) { if (!url.contains(val)) { throw new MessageException(String.format("JDBC URL must have the property '%s'", val)); } diff --git a/sonar-application/src/main/java/org/sonar/application/PropsBuilder.java b/sonar-application/src/main/java/org/sonar/application/PropsBuilder.java index c6c3404d0b3..081a41a7804 100644 --- a/sonar-application/src/main/java/org/sonar/application/PropsBuilder.java +++ b/sonar-application/src/main/java/org/sonar/application/PropsBuilder.java @@ -83,7 +83,7 @@ class PropsBuilder { return appJar.getParentFile().getParentFile(); } - private Properties loadPropertiesFile(File homeDir) throws IOException { + private static Properties loadPropertiesFile(File homeDir) throws IOException { Properties p = new Properties(); File propsFile = new File(homeDir, "conf/sonar.properties"); if (propsFile.exists()) { diff --git a/sonar-core/src/main/java/org/sonar/core/config/CorePropertyDefinitions.java b/sonar-core/src/main/java/org/sonar/core/config/CorePropertyDefinitions.java index e3de5d0bc97..c89e0027c36 100644 --- a/sonar-core/src/main/java/org/sonar/core/config/CorePropertyDefinitions.java +++ b/sonar-core/src/main/java/org/sonar/core/config/CorePropertyDefinitions.java @@ -112,14 +112,14 @@ public class CorePropertyDefinitions { .name("Downcase login") .description("Downcase login during user authentication, typically for Active Directory") .type(PropertyType.BOOLEAN) - .defaultValue("false") + .defaultValue(String.valueOf(false)) .hidden() .build(), PropertyDefinition.builder(CoreProperties.CORE_AUTHENTICATOR_CREATE_USERS) .name("Create user accounts") .description("Create accounts when authenticating users via an external system") .type(PropertyType.BOOLEAN) - .defaultValue("true") + .defaultValue(String.valueOf(true)) .hidden() .build(), PropertyDefinition.builder(CoreProperties.CORE_AUTHENTICATOR_UPDATE_USER_ATTRIBUTES) @@ -127,19 +127,19 @@ public class CorePropertyDefinitions { .description("When using the LDAP or OpenID plugin, at each login, the user attributes (name, email, ...) are re-synchronized") .hidden() .type(PropertyType.BOOLEAN) - .defaultValue("true") + .defaultValue(String.valueOf(true)) .build(), PropertyDefinition.builder(CoreProperties.CORE_AUTHENTICATOR_IGNORE_STARTUP_FAILURE) .name("Ignore failures during authenticator startup") .type(PropertyType.BOOLEAN) - .defaultValue("false") + .defaultValue(String.valueOf(false)) .hidden() .build(), PropertyDefinition.builder("sonar.enableFileVariation") .name("Enable file variation") .hidden() .type(PropertyType.BOOLEAN) - .defaultValue("false") + .defaultValue(String.valueOf(false)) .build(), PropertyDefinition.builder(CoreProperties.CORE_AUTHENTICATOR_LOCAL_USERS) .name("Local/technical users") @@ -155,7 +155,7 @@ public class CorePropertyDefinitions { .category(CoreProperties.CATEGORY_SCM) .type(PropertyType.BOOLEAN) .onQualifiers(Qualifiers.PROJECT) - .defaultValue("false") + .defaultValue(String.valueOf(false)) .build(), PropertyDefinition.builder(CoreProperties.SCM_PROVIDER_KEY) .name("Key of the SCM provider for this project") @@ -183,7 +183,7 @@ public class CorePropertyDefinitions { .name("Enable support of gravatars") .description("Gravatars are profile pictures of users based on their email.") .type(PropertyType.BOOLEAN) - .defaultValue("true") + .defaultValue(String.valueOf(true)) .category(CoreProperties.CATEGORY_GENERAL) .subCategory(CoreProperties.SUBCATEGORY_LOOKNFEEL) .build(), @@ -280,7 +280,7 @@ public class CorePropertyDefinitions { .type(PropertyType.BOOLEAN) .build(), PropertyDefinition.builder(CoreProperties.CPD_SKIP_PROPERTY) - .defaultValue("false") + .defaultValue(String.valueOf(false)) .name("Skip") .description("Disable detection of duplications") .hidden() diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/utils/StaxParser.java b/sonar-plugin-api/src/main/java/org/sonar/api/utils/StaxParser.java index 8c214218206..8cd7322115e 100644 --- a/sonar-plugin-api/src/main/java/org/sonar/api/utils/StaxParser.java +++ b/sonar-plugin-api/src/main/java/org/sonar/api/utils/StaxParser.java @@ -191,7 +191,7 @@ public class StaxParser { return inputToCheck.skip(n); } - private void checkBufferForISOControlChars(byte[] buffer, int off, int len) { + private static void checkBufferForISOControlChars(byte[] buffer, int off, int len) { for (int i = off; i < len; i++) { char streamChar = (char) buffer[i]; if (Character.isISOControl(streamChar) && streamChar != '\n') { diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/utils/command/CommandExecutor.java b/sonar-plugin-api/src/main/java/org/sonar/api/utils/command/CommandExecutor.java index dfe44fabf42..e1eb3255844 100644 --- a/sonar-plugin-api/src/main/java/org/sonar/api/utils/command/CommandExecutor.java +++ b/sonar-plugin-api/src/main/java/org/sonar/api/utils/command/CommandExecutor.java @@ -121,7 +121,7 @@ public class CommandExecutor { } } - private void verifyGobbler(Command command, StreamGobbler gobbler, String type) { + private static void verifyGobbler(Command command, StreamGobbler gobbler, String type) { if (gobbler.getException() != null) { throw new CommandException(command, "Error inside " + type + " stream", gobbler.getException()); } @@ -140,7 +140,7 @@ public class CommandExecutor { return execute(command, new DefaultConsumer(), new DefaultConsumer(), timeoutMilliseconds); } - private void closeStreams(@Nullable Process process) { + private static void closeStreams(@Nullable Process process) { if (process != null) { IOUtils.closeQuietly(process.getInputStream()); IOUtils.closeQuietly(process.getOutputStream()); @@ -148,7 +148,7 @@ public class CommandExecutor { } } - private void waitUntilFinish(@Nullable StreamGobbler thread) { + private static void waitUntilFinish(@Nullable StreamGobbler thread) { if (thread != null) { try { thread.join(); diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/utils/text/JsonWriter.java b/sonar-plugin-api/src/main/java/org/sonar/api/utils/text/JsonWriter.java index ccec2fabb6c..47b90b75852 100644 --- a/sonar-plugin-api/src/main/java/org/sonar/api/utils/text/JsonWriter.java +++ b/sonar-plugin-api/src/main/java/org/sonar/api/utils/text/JsonWriter.java @@ -382,7 +382,7 @@ public class JsonWriter { } } - private IllegalStateException rethrow(Exception e) { + private static IllegalStateException rethrow(Exception e) { // stacktrace is not helpful throw new WriterException("Fail to write JSON: " + e.getMessage()); } diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/utils/text/XmlWriter.java b/sonar-plugin-api/src/main/java/org/sonar/api/utils/text/XmlWriter.java index 2744d4e01a3..7b8cf46034f 100644 --- a/sonar-plugin-api/src/main/java/org/sonar/api/utils/text/XmlWriter.java +++ b/sonar-plugin-api/src/main/java/org/sonar/api/utils/text/XmlWriter.java @@ -176,7 +176,7 @@ public class XmlWriter { } } - private IllegalStateException rethrow(XMLStreamException e) { + private static IllegalStateException rethrow(XMLStreamException e) { // stacktrace is not helpful throw new IllegalStateException("Fail to write XML: " + e.getMessage()); } |