diff options
author | Simon Brandhof <simon.brandhof@sonarsource.com> | 2015-10-20 10:14:19 +0200 |
---|---|---|
committer | Simon Brandhof <simon.brandhof@sonarsource.com> | 2015-10-20 10:14:19 +0200 |
commit | f5d5b1625934b89c3524f52b4ee3b1dfe8f299a5 (patch) | |
tree | 20d92ba2715cd106908c4efe5d3284fff20228b5 /server | |
parent | 37d1cc65466e63cb7ac7e8245c290e60b11804c6 (diff) | |
download | sonarqube-f5d5b1625934b89c3524f52b4ee3b1dfe8f299a5.tar.gz sonarqube-f5d5b1625934b89c3524f52b4ee3b1dfe8f299a5.zip |
Fix quality flaws
Diffstat (limited to 'server')
-rw-r--r-- | server/sonar-server/src/main/java/org/sonar/server/es/BulkIndexer.java | 10 | ||||
-rw-r--r-- | server/sonar-server/src/main/java/org/sonar/server/test/index/TestResultSetIterator.java | 10 |
2 files changed, 9 insertions, 11 deletions
diff --git a/server/sonar-server/src/main/java/org/sonar/server/es/BulkIndexer.java b/server/sonar-server/src/main/java/org/sonar/server/es/BulkIndexer.java index 56352214b12..706454ed545 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/es/BulkIndexer.java +++ b/server/sonar-server/src/main/java/org/sonar/server/es/BulkIndexer.java @@ -46,6 +46,8 @@ import java.util.concurrent.Semaphore; import java.util.concurrent.TimeUnit; import java.util.concurrent.atomic.AtomicLong; +import static java.lang.String.format; + /** * Helper to bulk requests in an efficient way : * <ul> @@ -76,7 +78,7 @@ public class BulkIndexer implements Startable { public BulkIndexer(EsClient client, String indexName) { this.client = client; this.indexName = indexName; - this.progress = new ProgressLogger(String.format("Progress[BulkIndexer[%s]]", indexName), counter, LOGGER) + this.progress = new ProgressLogger(format("Progress[BulkIndexer[%s]]", indexName), counter, LOGGER) .setPluralLabel("requests"); this.concurrentRequests = Math.max(1, Runtime.getRuntime().availableProcessors() - 1); @@ -235,11 +237,7 @@ public class BulkIndexer implements Startable { for (BulkItemResponse item : response.getItems()) { if (item.isFailed()) { - StringBuilder sb = new StringBuilder(); - String msg = sb - .append("index [").append(item.getIndex()).append("], type [").append(item.getType()).append("], id [").append(item.getId()) - .append("], message [").append(item.getFailureMessage()).append("]").toString(); - LOGGER.error(msg); + LOGGER.error("index [{}], type [{}], id [{}], message [{}]", item.getIndex(), item.getType(), item.getId(), item.getFailureMessage()); } } } diff --git a/server/sonar-server/src/main/java/org/sonar/server/test/index/TestResultSetIterator.java b/server/sonar-server/src/main/java/org/sonar/server/test/index/TestResultSetIterator.java index e1ffd9d2e54..8c8316e5dbf 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/test/index/TestResultSetIterator.java +++ b/server/sonar-server/src/main/java/org/sonar/server/test/index/TestResultSetIterator.java @@ -55,10 +55,14 @@ import static org.sonar.server.test.index.TestIndexDefinition.TYPE; /** * Scroll over table FILE_SOURCES of test type and directly parse data required to - * populate the index sourcelines + * populate the index tests/test */ public class TestResultSetIterator extends ResultSetIterator<Row> { + private TestResultSetIterator(PreparedStatement stmt) throws SQLException { + super(stmt); + } + public static TestResultSetIterator create(DbClient dbClient, DbSession session, long afterDate, @Nullable String projectUuid) { try { return new TestResultSetIterator(FileSourcesUpdaterHelper.preparedStatementToSelectFileSources(dbClient, session, FileSourceDto.Type.TEST, afterDate, projectUuid)); @@ -67,10 +71,6 @@ public class TestResultSetIterator extends ResultSetIterator<Row> { } } - private TestResultSetIterator(PreparedStatement stmt) throws SQLException { - super(stmt); - } - @Override protected Row read(ResultSet rs) throws SQLException { String projectUuid = rs.getString(1); |