aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--sonar-batch/src/main/java/org/sonar/batch/profiling/PhasesSumUpTimeProfiler.java2
-rw-r--r--sonar-core/src/main/java/org/sonar/core/user/RoleDao.java1
-rw-r--r--sonar-server/src/main/java/org/sonar/server/db/DatabaseMigrator.java3
-rw-r--r--sonar-server/src/main/java/org/sonar/server/db/migrations/ConvertViolationsToIssues.java36
-rw-r--r--sonar-server/src/main/webapp/WEB-INF/app/controllers/api/users_controller.rb7
-rw-r--r--sonar-ws-client/src/main/java/org/sonar/wsclient/user/UserClient.java6
6 files changed, 24 insertions, 31 deletions
diff --git a/sonar-batch/src/main/java/org/sonar/batch/profiling/PhasesSumUpTimeProfiler.java b/sonar-batch/src/main/java/org/sonar/batch/profiling/PhasesSumUpTimeProfiler.java
index ad1a9d7bc6d..29f4192be13 100644
--- a/sonar-batch/src/main/java/org/sonar/batch/profiling/PhasesSumUpTimeProfiler.java
+++ b/sonar-batch/src/main/java/org/sonar/batch/profiling/PhasesSumUpTimeProfiler.java
@@ -53,7 +53,7 @@ import static org.sonar.batch.profiling.AbstractTimeProfiling.truncate;
public class PhasesSumUpTimeProfiler implements ProjectAnalysisHandler, SensorExecutionHandler, DecoratorExecutionHandler, PostJobExecutionHandler, DecoratorsPhaseHandler,
SensorsPhaseHandler, PostJobsPhaseHandler, MavenPhaseHandler, InitializersPhaseHandler, InitializerExecutionHandler, BatchStepHandler {
- final static Logger LOG = LoggerFactory.getLogger(PhasesSumUpTimeProfiler.class);
+ static final Logger LOG = LoggerFactory.getLogger(PhasesSumUpTimeProfiler.class);
private static final int TEXT_RIGHT_PAD = 60;
private static final int TIME_LEFT_PAD = 10;
diff --git a/sonar-core/src/main/java/org/sonar/core/user/RoleDao.java b/sonar-core/src/main/java/org/sonar/core/user/RoleDao.java
index 0b275b9662c..d76d7620615 100644
--- a/sonar-core/src/main/java/org/sonar/core/user/RoleDao.java
+++ b/sonar-core/src/main/java/org/sonar/core/user/RoleDao.java
@@ -25,7 +25,6 @@ import org.sonar.api.ServerExtension;
import org.sonar.api.task.TaskExtension;
import org.sonar.core.persistence.MyBatis;
-import javax.annotation.Nullable;
import java.util.List;
public class RoleDao implements TaskExtension, ServerExtension {
diff --git a/sonar-server/src/main/java/org/sonar/server/db/DatabaseMigrator.java b/sonar-server/src/main/java/org/sonar/server/db/DatabaseMigrator.java
index 8df637b7313..bff94ff0613 100644
--- a/sonar-server/src/main/java/org/sonar/server/db/DatabaseMigrator.java
+++ b/sonar-server/src/main/java/org/sonar/server/db/DatabaseMigrator.java
@@ -77,7 +77,8 @@ public class DatabaseMigrator implements ServerComponent {
migration.execute(database);
} catch (Exception e) {
- e.printStackTrace();
+ // duplication between log and exception because webapp does not correctly log initial stacktrace
+ LoggerFactory.getLogger(getClass()).error("Fail to execute database migration: " + className, e);
throw new IllegalStateException("Fail to execute database migration: " + className, e);
}
}
diff --git a/sonar-server/src/main/java/org/sonar/server/db/migrations/ConvertViolationsToIssues.java b/sonar-server/src/main/java/org/sonar/server/db/migrations/ConvertViolationsToIssues.java
index b134a17adeb..1e1f8220bb4 100644
--- a/sonar-server/src/main/java/org/sonar/server/db/migrations/ConvertViolationsToIssues.java
+++ b/sonar-server/src/main/java/org/sonar/server/db/migrations/ConvertViolationsToIssues.java
@@ -46,7 +46,7 @@ import java.util.*;
*/
public class ConvertViolationsToIssues implements DatabaseMigration {
- private static int GROUP_SIZE = 500;
+ private static final int GROUP_SIZE = 500;
private QueryRunner runner = new QueryRunner();
@Override
@@ -258,7 +258,10 @@ public class ConvertViolationsToIssues implements DatabaseMigration {
}
}
if (!allParams.isEmpty()) {
- runner.batch(writeConnection, "INSERT INTO issue_changes(kee, issue_key, user_login, change_type, change_data, created_at, updated_at) VALUES (?, ?, ?, 'comment', ?, ?, ?)", allParams.toArray(new Object[allParams.size()][]));
+ runner.batch(writeConnection,
+ "INSERT INTO issue_changes(kee, issue_key, user_login, change_type, change_data, created_at, updated_at) VALUES (?, ?, ?, 'comment', ?, ?, ?)",
+ allParams.toArray(new Object[allParams.size()][])
+ );
writeConnection.commit();
}
}
@@ -282,26 +285,27 @@ public class ConvertViolationsToIssues implements DatabaseMigration {
private static class ViolationHandler extends AbstractListHandler<Map<String, Object>> {
- private static String SQL = "select rev.id as reviewId, s.project_id as projectId, rf.rule_id as ruleId, rf.failure_level as failureLevel, rf.message as message, rf.line as line, " +
- " rf.cost as cost, rf.created_at as createdAt, rf.checksum as checksum, rev.user_id as reviewReporterId, rev.assignee_id as reviewAssigneeId, rev.status as reviewStatus, " +
- " rev.severity as reviewSeverity, rev.resolution as reviewResolution, rev.manual_severity as reviewManualSeverity, rev.data as reviewData, rev.updated_at as reviewUpdatedAt, " +
- " s.root_project_id as rootProjectId, rev.manual_violation as reviewManualViolation, planreviews.action_plan_id as planId " +
- " from rule_failures rf " +
- " inner join snapshots s on s.id=rf.snapshot_id " +
- " left join reviews rev on rev.rule_failure_permanent_id=rf.permanent_id " +
- " left join action_plans_reviews planreviews on planreviews.review_id=rev.id " +
- " where ";
-
+ private static final String SQL;
static {
+ StringBuilder sb = new StringBuilder("select rev.id as reviewId, s.project_id as projectId, rf.rule_id as ruleId, rf.failure_level as failureLevel, rf.message as message, rf.line as line, " +
+ " rf.cost as cost, rf.created_at as createdAt, rf.checksum as checksum, rev.user_id as reviewReporterId, rev.assignee_id as reviewAssigneeId, rev.status as reviewStatus, " +
+ " rev.severity as reviewSeverity, rev.resolution as reviewResolution, rev.manual_severity as reviewManualSeverity, rev.data as reviewData, rev.updated_at as reviewUpdatedAt, " +
+ " s.root_project_id as rootProjectId, rev.manual_violation as reviewManualViolation, planreviews.action_plan_id as planId " +
+ " from rule_failures rf " +
+ " inner join snapshots s on s.id=rf.snapshot_id " +
+ " left join reviews rev on rev.rule_failure_permanent_id=rf.permanent_id " +
+ " left join action_plans_reviews planreviews on planreviews.review_id=rev.id " +
+ " where ");
for (int i = 0; i < GROUP_SIZE; i++) {
if (i > 0) {
- SQL += " or ";
+ sb.append(" or ");
}
- SQL += "rf.id=?";
+ sb.append("rf.id=?");
}
+ SQL = sb.toString();
}
- private static Map<Integer, String> SEVERITIES = ImmutableMap.of(1, Severity.INFO, 2, Severity.MINOR, 3, Severity.MAJOR, 4, Severity.CRITICAL, 5, Severity.BLOCKER);
+ private static final Map<Integer, String> SEVERITIES = ImmutableMap.of(1, Severity.INFO, 2, Severity.MINOR, 3, Severity.MAJOR, 4, Severity.CRITICAL, 5, Severity.BLOCKER);
@Override
protected Map<String, Object> handleRow(ResultSet rs) throws SQLException {
@@ -331,7 +335,7 @@ public class ConvertViolationsToIssues implements DatabaseMigration {
}
private static class ReviewCommentsHandler extends AbstractListHandler<Map<String, Object>> {
- static String SQL = "select created_at as createdAt, updated_at as updatedAt, user_id as userId, review_text as reviewText from review_comments where review_id=";
+ static final String SQL = "select created_at as createdAt, updated_at as updatedAt, user_id as userId, review_text as reviewText from review_comments where review_id=";
@Override
protected Map<String, Object> handleRow(ResultSet rs) throws SQLException {
diff --git a/sonar-server/src/main/webapp/WEB-INF/app/controllers/api/users_controller.rb b/sonar-server/src/main/webapp/WEB-INF/app/controllers/api/users_controller.rb
index 9ced56dd192..cf255eb9f8f 100644
--- a/sonar-server/src/main/webapp/WEB-INF/app/controllers/api/users_controller.rb
+++ b/sonar-server/src/main/webapp/WEB-INF/app/controllers/api/users_controller.rb
@@ -123,13 +123,8 @@ class Api::UsersController < Api::ApiController
end
- def delete
- # TODO : DROP
- deactivate
- end
-
#
- # POST /api/users/delete
+ # POST /api/users/deactivate
#
# -- Mandatory parameters
# 'login' is the user identifier
diff --git a/sonar-ws-client/src/main/java/org/sonar/wsclient/user/UserClient.java b/sonar-ws-client/src/main/java/org/sonar/wsclient/user/UserClient.java
index 762bc8cdaf1..a6c8df0e583 100644
--- a/sonar-ws-client/src/main/java/org/sonar/wsclient/user/UserClient.java
+++ b/sonar-ws-client/src/main/java/org/sonar/wsclient/user/UserClient.java
@@ -39,12 +39,6 @@ public interface UserClient {
User update(UserParameters userParameters);
/**
- * TODO to remove
- */
- @Deprecated
- void delete(UserParameters userParameters);
-
- /**
* @since 3.7
*/
void deactivate(String login);