aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--server/sonar-server/src/main/java/org/sonar/server/issue/IssueBulkChangeQuery.java2
-rw-r--r--server/sonar-server/src/main/java/org/sonar/server/issue/actionplan/ActionPlanService.java2
-rw-r--r--sonar-colorizer/src/main/java/org/sonar/colorizer/JavaConstantTokenizer.java4
-rw-r--r--sonar-db/src/main/java/org/sonar/db/dashboard/DashboardDao.java16
-rw-r--r--sonar-db/src/main/java/org/sonar/db/user/GroupDao.java1
-rw-r--r--sonar-db/src/main/java/org/sonar/db/version/v52/MoveProjectProfileAssociation.java9
-rw-r--r--sonar-plugin-api/src/main/java/org/sonar/api/batch/rule/Checks.java4
-rw-r--r--sonar-plugin-api/src/main/java/org/sonar/api/checks/AnnotationCheckFactory.java4
8 files changed, 19 insertions, 23 deletions
diff --git a/server/sonar-server/src/main/java/org/sonar/server/issue/IssueBulkChangeQuery.java b/server/sonar-server/src/main/java/org/sonar/server/issue/IssueBulkChangeQuery.java
index 56c9f601689..3df31d3a8ac 100644
--- a/server/sonar-server/src/main/java/org/sonar/server/issue/IssueBulkChangeQuery.java
+++ b/server/sonar-server/src/main/java/org/sonar/server/issue/IssueBulkChangeQuery.java
@@ -80,7 +80,7 @@ public class IssueBulkChangeQuery {
}
}
- private List<String> sanitizeList(@Nullable List<String> list) {
+ private static List<String> sanitizeList(@Nullable List<String> list) {
if (list == null || list.isEmpty()) {
return Collections.emptyList();
}
diff --git a/server/sonar-server/src/main/java/org/sonar/server/issue/actionplan/ActionPlanService.java b/server/sonar-server/src/main/java/org/sonar/server/issue/actionplan/ActionPlanService.java
index da1203291a6..4ee93f6ded3 100644
--- a/server/sonar-server/src/main/java/org/sonar/server/issue/actionplan/ActionPlanService.java
+++ b/server/sonar-server/src/main/java/org/sonar/server/issue/actionplan/ActionPlanService.java
@@ -167,7 +167,7 @@ public class ActionPlanService {
return !actionPlanDao.selectByNameAndProjectId(name, findProject(projectKey).getId()).isEmpty();
}
- private List<ActionPlan> toActionPlans(List<ActionPlanDto> actionPlanDtos) {
+ private static List<ActionPlan> toActionPlans(List<ActionPlanDto> actionPlanDtos) {
return newArrayList(Iterables.transform(actionPlanDtos, ToActionPlan.INSTANCE));
}
diff --git a/sonar-colorizer/src/main/java/org/sonar/colorizer/JavaConstantTokenizer.java b/sonar-colorizer/src/main/java/org/sonar/colorizer/JavaConstantTokenizer.java
index cb10364604b..03222f0c67c 100644
--- a/sonar-colorizer/src/main/java/org/sonar/colorizer/JavaConstantTokenizer.java
+++ b/sonar-colorizer/src/main/java/org/sonar/colorizer/JavaConstantTokenizer.java
@@ -70,11 +70,11 @@ public class JavaConstantTokenizer extends Tokenizer {
}
}
- private boolean isJavaConstantStart(int character) {
+ private static boolean isJavaConstantStart(int character) {
return Character.isUpperCase(character);
}
- private boolean isJavaConstantPart(int character) {
+ private static boolean isJavaConstantPart(int character) {
return Character.isUpperCase(character) || character == '_' || character == '-' || Character.isDigit(character);
}
diff --git a/sonar-db/src/main/java/org/sonar/db/dashboard/DashboardDao.java b/sonar-db/src/main/java/org/sonar/db/dashboard/DashboardDao.java
index fd283b3d181..7dc94a8ecdf 100644
--- a/sonar-db/src/main/java/org/sonar/db/dashboard/DashboardDao.java
+++ b/sonar-db/src/main/java/org/sonar/db/dashboard/DashboardDao.java
@@ -48,15 +48,15 @@ public class DashboardDao implements Dao {
DashboardMapper dashboardMapper = session.getMapper(DashboardMapper.class);
WidgetMapper widgetMapper = session.getMapper(WidgetMapper.class);
WidgetPropertyMapper widgetPropertyMapper = session.getMapper(WidgetPropertyMapper.class);
- dashboardMapper.insert(dashboardDto);
- for (WidgetDto widgetDto : dashboardDto.getWidgets()) {
- widgetDto.setDashboardId(dashboardDto.getId());
- widgetMapper.insert(widgetDto);
- for (WidgetPropertyDto widgetPropertyDto : widgetDto.getWidgetProperties()) {
- widgetPropertyDto.setWidgetId(widgetDto.getId());
- widgetPropertyMapper.insert(widgetPropertyDto);
- }
+ dashboardMapper.insert(dashboardDto);
+ for (WidgetDto widgetDto : dashboardDto.getWidgets()) {
+ widgetDto.setDashboardId(dashboardDto.getId());
+ widgetMapper.insert(widgetDto);
+ for (WidgetPropertyDto widgetPropertyDto : widgetDto.getWidgetProperties()) {
+ widgetPropertyDto.setWidgetId(widgetDto.getId());
+ widgetPropertyMapper.insert(widgetPropertyDto);
}
+ }
}
public void insert(DashboardDto dashboardDto) {
diff --git a/sonar-db/src/main/java/org/sonar/db/user/GroupDao.java b/sonar-db/src/main/java/org/sonar/db/user/GroupDao.java
index a10ffd71f27..db5e428cc14 100644
--- a/sonar-db/src/main/java/org/sonar/db/user/GroupDao.java
+++ b/sonar-db/src/main/java/org/sonar/db/user/GroupDao.java
@@ -35,7 +35,6 @@ import org.sonar.db.WildcardPosition;
public class GroupDao implements Dao {
- private static final String SQL_WILDCARD = "%";
private System2 system;
public GroupDao(System2 system) {
diff --git a/sonar-db/src/main/java/org/sonar/db/version/v52/MoveProjectProfileAssociation.java b/sonar-db/src/main/java/org/sonar/db/version/v52/MoveProjectProfileAssociation.java
index 21451eb8fb8..bbfdd267962 100644
--- a/sonar-db/src/main/java/org/sonar/db/version/v52/MoveProjectProfileAssociation.java
+++ b/sonar-db/src/main/java/org/sonar/db/version/v52/MoveProjectProfileAssociation.java
@@ -79,6 +79,11 @@ public class MoveProjectProfileAssociation extends BaseDataChange {
update.setLong(1, id);
return true;
}
+
+ private static String extractLanguage(String propertyKey) {
+ return propertyKey.substring("sonar.profile.".length());
+ }
+
}
private static final Logger LOGGER = Loggers.get(MoveProjectProfileAssociation.class);
@@ -111,10 +116,6 @@ public class MoveProjectProfileAssociation extends BaseDataChange {
}
}
- private static String extractLanguage(String propertyKey) {
- return propertyKey.substring("sonar.profile.".length());
- }
-
private Table<String, String, String> getProfileKeysByLanguageThenName(final Context context) throws SQLException {
final Table<String, String, String> profilesByLanguageAndName = HashBasedTable.create();
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/batch/rule/Checks.java b/sonar-plugin-api/src/main/java/org/sonar/api/batch/rule/Checks.java
index 3566f57db81..09bb71d7f66 100644
--- a/sonar-plugin-api/src/main/java/org/sonar/api/batch/rule/Checks.java
+++ b/sonar-plugin-api/src/main/java/org/sonar/api/batch/rule/Checks.java
@@ -162,9 +162,7 @@ public class Checks<C> {
}
configureFields(activeRule, check);
return check;
- } catch (InstantiationException e) {
- throw failToInstantiateCheck(activeRule, checkClassOrInstance, e);
- } catch (IllegalAccessException e) {
+ } catch (InstantiationException | IllegalAccessException e) {
throw failToInstantiateCheck(activeRule, checkClassOrInstance, e);
}
}
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/checks/AnnotationCheckFactory.java b/sonar-plugin-api/src/main/java/org/sonar/api/checks/AnnotationCheckFactory.java
index a677bf45b9c..c5303b05c86 100644
--- a/sonar-plugin-api/src/main/java/org/sonar/api/checks/AnnotationCheckFactory.java
+++ b/sonar-plugin-api/src/main/java/org/sonar/api/checks/AnnotationCheckFactory.java
@@ -83,11 +83,9 @@ public final class AnnotationCheckFactory extends CheckFactory {
configureFields(activeRule, check);
return check;
- } catch (InstantiationException e) {
+ } catch (InstantiationException | IllegalAccessException e) {
throw new SonarException(CAN_NOT_INSTANTIATE_THE_CHECK_RELATED_TO_THE_RULE + activeRule, e);
- } catch (IllegalAccessException e) {
- throw new SonarException(CAN_NOT_INSTANTIATE_THE_CHECK_RELATED_TO_THE_RULE + activeRule, e);
}
}