aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSimon Brandhof <simon.brandhof@sonarsource.com>2014-07-01 13:43:04 +0200
committerSimon Brandhof <simon.brandhof@sonarsource.com>2014-07-01 13:51:23 +0200
commitef3e590d1ba5372d825216f85816463fa8e50a99 (patch)
treed43b93223e5440c3f4d8582eae406ff9863cc8a5
parentcbe3819ae9e045049816761ff598ae5e74eac2e2 (diff)
downloadsonarqube-ef3e590d1ba5372d825216f85816463fa8e50a99.tar.gz
sonarqube-ef3e590d1ba5372d825216f85816463fa8e50a99.zip
Fix some quality flaws
-rw-r--r--plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/issue/notification/NewIssuesEmailTemplate.java10
-rw-r--r--sonar-batch/src/main/java/org/sonar/batch/bootstrap/DefaultPluginsReferential.java3
-rw-r--r--sonar-batch/src/main/java/org/sonar/batch/languages/package-info.java2
-rw-r--r--sonar-batch/src/main/java/org/sonar/batch/phases/GraphPersister.java1
-rw-r--r--sonar-batch/src/main/java/org/sonar/batch/rules/package-info.java2
-rw-r--r--sonar-batch/src/main/java/org/sonar/batch/scan/filesystem/DefaultModuleFileSystem.java9
-rw-r--r--sonar-batch/src/main/java/org/sonar/batch/scan2/package-info.java2
-rw-r--r--sonar-batch/src/main/java/org/sonar/batch/settings/package-info.java2
-rw-r--r--sonar-core/src/main/java/org/sonar/core/graph/graphson/GraphsonUtil.java56
-rw-r--r--sonar-core/src/main/java/org/sonar/core/persistence/BatchSession.java41
-rw-r--r--sonar-plugin-api/src/main/java/org/sonar/api/batch/analyzer/internal/package-info.java2
-rw-r--r--sonar-plugin-api/src/main/java/org/sonar/api/batch/analyzer/issue/internal/package-info.java2
-rw-r--r--sonar-plugin-api/src/main/java/org/sonar/api/batch/analyzer/issue/package-info.java2
-rw-r--r--sonar-plugin-api/src/main/java/org/sonar/api/batch/analyzer/measure/internal/package-info.java2
-rw-r--r--sonar-plugin-api/src/main/java/org/sonar/api/batch/analyzer/measure/package-info.java2
-rw-r--r--sonar-plugin-api/src/main/java/org/sonar/api/batch/analyzer/package-info.java2
-rw-r--r--sonar-plugin-api/src/main/java/org/sonar/api/batch/fs/internal/DefaultFileSystem.java2
-rw-r--r--sonar-server/src/main/java/org/sonar/server/activity/index/ActivityNormalizer.java16
-rw-r--r--sonar-server/src/main/java/org/sonar/server/db/migrations/v43/NotResolvedIssuesOnRemovedComponentsMigration.java3
-rw-r--r--sonar-server/src/main/java/org/sonar/server/platform/ServerComponents.java3
-rw-r--r--sonar-server/src/main/java/org/sonar/server/rule/index/RuleDoc.java2
-rw-r--r--sonar-server/src/main/java/org/sonar/server/search/ws/BaseMapping.java6
-rw-r--r--sonar-ws-client/src/main/java/org/sonar/wsclient/unmarshallers/ServerSetupUnmarshaller.java7
23 files changed, 89 insertions, 90 deletions
diff --git a/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/issue/notification/NewIssuesEmailTemplate.java b/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/issue/notification/NewIssuesEmailTemplate.java
index b6d547d6d4c..d8e94277b2a 100644
--- a/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/issue/notification/NewIssuesEmailTemplate.java
+++ b/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/issue/notification/NewIssuesEmailTemplate.java
@@ -64,10 +64,10 @@ public class NewIssuesEmailTemplate extends EmailTemplate {
sb.append("Project: ").append(projectName).append("\n\n");
sb.append(notification.getFieldValue("count")).append(" new issues").append("\n\n");
sb.append(" ");
- for (Iterator<String> severityIterator = Lists.reverse(Severity.ALL).iterator(); severityIterator.hasNext(); ) {
+ for (Iterator<String> severityIterator = Lists.reverse(Severity.ALL).iterator(); severityIterator.hasNext();) {
String severity = severityIterator.next();
- String severityLabel = i18n.message(getLocale(), "severity."+ severity, severity);
- sb.append(severityLabel).append(": ").append(notification.getFieldValue("count-"+ severity));
+ String severityLabel = i18n.message(getLocale(), "severity." + severity, severity);
+ sb.append(severityLabel).append(": ").append(notification.getFieldValue("count-" + severity));
if (severityIterator.hasNext()) {
sb.append(" ");
}
@@ -76,12 +76,10 @@ public class NewIssuesEmailTemplate extends EmailTemplate {
appendFooter(sb, notification);
- EmailMessage message = new EmailMessage()
+ return new EmailMessage()
.setMessageId("new-issues/" + notification.getFieldValue(FIELD_PROJECT_KEY))
.setSubject(projectName + ": new issues")
.setMessage(sb.toString());
-
- return message;
}
private void appendFooter(StringBuilder sb, Notification notification) {
diff --git a/sonar-batch/src/main/java/org/sonar/batch/bootstrap/DefaultPluginsReferential.java b/sonar-batch/src/main/java/org/sonar/batch/bootstrap/DefaultPluginsReferential.java
index 4d3c8d30d64..1332f59b062 100644
--- a/sonar-batch/src/main/java/org/sonar/batch/bootstrap/DefaultPluginsReferential.java
+++ b/sonar-batch/src/main/java/org/sonar/batch/bootstrap/DefaultPluginsReferential.java
@@ -55,7 +55,7 @@ public class DefaultPluginsReferential implements PluginsReferential {
public File pluginFile(final RemotePlugin remote) {
try {
final RemotePluginFile file = remote.file();
- File cachedFile = fileCache.get(file.getFilename(), file.getHash(), new FileCache.Downloader() {
+ return fileCache.get(file.getFilename(), file.getHash(), new FileCache.Downloader() {
public void download(String filename, File toFile) throws IOException {
String url = "/deploy/plugins/" + remote.getKey() + "/" + file.getFilename();
if (LOG.isDebugEnabled()) {
@@ -66,7 +66,6 @@ public class DefaultPluginsReferential implements PluginsReferential {
server.download(url, toFile);
}
});
- return cachedFile;
} catch (Exception e) {
throw new IllegalStateException("Fail to download plugin: " + remote.getKey(), e);
diff --git a/sonar-batch/src/main/java/org/sonar/batch/languages/package-info.java b/sonar-batch/src/main/java/org/sonar/batch/languages/package-info.java
index ef8790b337f..7a5d7a96ff6 100644
--- a/sonar-batch/src/main/java/org/sonar/batch/languages/package-info.java
+++ b/sonar-batch/src/main/java/org/sonar/batch/languages/package-info.java
@@ -18,4 +18,4 @@
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
@javax.annotation.ParametersAreNonnullByDefault
-package org.sonar.batch.languages; \ No newline at end of file
+package org.sonar.batch.languages;
diff --git a/sonar-batch/src/main/java/org/sonar/batch/phases/GraphPersister.java b/sonar-batch/src/main/java/org/sonar/batch/phases/GraphPersister.java
index 3fc0f17db9a..32b26389862 100644
--- a/sonar-batch/src/main/java/org/sonar/batch/phases/GraphPersister.java
+++ b/sonar-batch/src/main/java/org/sonar/batch/phases/GraphPersister.java
@@ -32,7 +32,6 @@ import org.sonar.core.graph.graphson.GraphsonMode;
import org.sonar.core.graph.graphson.GraphsonWriter;
import org.sonar.core.graph.jdbc.GraphDto;
import org.sonar.core.graph.jdbc.GraphDtoMapper;
-import org.sonar.core.persistence.BatchSession;
import org.sonar.core.persistence.DbSession;
import org.sonar.core.persistence.MyBatis;
diff --git a/sonar-batch/src/main/java/org/sonar/batch/rules/package-info.java b/sonar-batch/src/main/java/org/sonar/batch/rules/package-info.java
index 819e886c070..1522091f4eb 100644
--- a/sonar-batch/src/main/java/org/sonar/batch/rules/package-info.java
+++ b/sonar-batch/src/main/java/org/sonar/batch/rules/package-info.java
@@ -18,4 +18,4 @@
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
@javax.annotation.ParametersAreNonnullByDefault
-package org.sonar.batch.rules; \ No newline at end of file
+package org.sonar.batch.rules;
diff --git a/sonar-batch/src/main/java/org/sonar/batch/scan/filesystem/DefaultModuleFileSystem.java b/sonar-batch/src/main/java/org/sonar/batch/scan/filesystem/DefaultModuleFileSystem.java
index 7205c1c483f..0e534a334f9 100644
--- a/sonar-batch/src/main/java/org/sonar/batch/scan/filesystem/DefaultModuleFileSystem.java
+++ b/sonar-batch/src/main/java/org/sonar/batch/scan/filesystem/DefaultModuleFileSystem.java
@@ -70,17 +70,20 @@ public class DefaultModuleFileSystem extends DefaultFileSystem implements Module
/**
* Used by scan2
*/
- public DefaultModuleFileSystem(ModuleInputFileCache moduleInputFileCache, ProjectDefinition def, Settings settings, FileIndexer indexer, ModuleFileSystemInitializer initializer) {
+ public DefaultModuleFileSystem(ModuleInputFileCache moduleInputFileCache, ProjectDefinition def, Settings settings,
+ FileIndexer indexer, ModuleFileSystemInitializer initializer) {
this(moduleInputFileCache, def.getKey(), settings, indexer, initializer, null);
}
- public DefaultModuleFileSystem(ModuleInputFileCache moduleInputFileCache, ProjectDefinition def, Project project, Settings settings, FileIndexer indexer,
+ public DefaultModuleFileSystem(ModuleInputFileCache moduleInputFileCache, ProjectDefinition def, Project project,
+ Settings settings, FileIndexer indexer,
ModuleFileSystemInitializer initializer,
ComponentIndexer componentIndexer) {
this(moduleInputFileCache, project.getKey(), settings, indexer, initializer, componentIndexer);
}
- private DefaultModuleFileSystem(ModuleInputFileCache moduleInputFileCache, String moduleKey, Settings settings, FileIndexer indexer, ModuleFileSystemInitializer initializer,
+ private DefaultModuleFileSystem(ModuleInputFileCache moduleInputFileCache, String moduleKey, Settings settings,
+ FileIndexer indexer, ModuleFileSystemInitializer initializer,
@Nullable ComponentIndexer componentIndexer) {
super(moduleInputFileCache);
this.componentIndexer = componentIndexer;
diff --git a/sonar-batch/src/main/java/org/sonar/batch/scan2/package-info.java b/sonar-batch/src/main/java/org/sonar/batch/scan2/package-info.java
index d5d167bf737..62ae62716bb 100644
--- a/sonar-batch/src/main/java/org/sonar/batch/scan2/package-info.java
+++ b/sonar-batch/src/main/java/org/sonar/batch/scan2/package-info.java
@@ -18,4 +18,4 @@
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
@javax.annotation.ParametersAreNonnullByDefault
-package org.sonar.batch.scan2; \ No newline at end of file
+package org.sonar.batch.scan2;
diff --git a/sonar-batch/src/main/java/org/sonar/batch/settings/package-info.java b/sonar-batch/src/main/java/org/sonar/batch/settings/package-info.java
index 6d2df16d3ab..7e52b5b6d3e 100644
--- a/sonar-batch/src/main/java/org/sonar/batch/settings/package-info.java
+++ b/sonar-batch/src/main/java/org/sonar/batch/settings/package-info.java
@@ -18,4 +18,4 @@
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
@javax.annotation.ParametersAreNonnullByDefault
-package org.sonar.batch.settings; \ No newline at end of file
+package org.sonar.batch.settings;
diff --git a/sonar-core/src/main/java/org/sonar/core/graph/graphson/GraphsonUtil.java b/sonar-core/src/main/java/org/sonar/core/graph/graphson/GraphsonUtil.java
index f529267ab80..fae97eca964 100644
--- a/sonar-core/src/main/java/org/sonar/core/graph/graphson/GraphsonUtil.java
+++ b/sonar-core/src/main/java/org/sonar/core/graph/graphson/GraphsonUtil.java
@@ -77,12 +77,12 @@ class GraphsonUtil {
* A GraphSONUtility that includes the specified properties.
*/
GraphsonUtil(GraphsonMode mode, ElementFactory factory,
- Set<String> vertexPropertyKeys, Set<String> edgePropertyKeys) {
+ Set<String> vertexPropertyKeys, Set<String> edgePropertyKeys) {
this(mode, factory, ElementPropertyConfig.includeProperties(vertexPropertyKeys, edgePropertyKeys));
}
GraphsonUtil(GraphsonMode mode, ElementFactory factory,
- ElementPropertyConfig config) {
+ ElementPropertyConfig config) {
this.vertexPropertyKeys = config.getVertexPropertyKeys();
this.edgePropertyKeys = config.getEdgePropertyKeys();
this.vertexPropertiesRule = config.getVertexPropertiesRule();
@@ -110,7 +110,7 @@ class GraphsonUtil {
*/
static JSONObject jsonFromElement(Element element, @Nullable Set<String> propertyKeys, GraphsonMode mode) {
GraphsonUtil graphson = element instanceof Edge ? new GraphsonUtil(mode, null, null, propertyKeys)
- : new GraphsonUtil(mode, null, propertyKeys, null);
+ : new GraphsonUtil(mode, null, propertyKeys, null);
return graphson.jsonFromElement(element);
}
@@ -123,7 +123,7 @@ class GraphsonUtil {
* @param propertyKeys a list of keys to include on reading of element properties
*/
static Vertex vertexFromJson(JSONObject json, ElementFactory factory, GraphsonMode mode,
- Set<String> propertyKeys) throws IOException {
+ Set<String> propertyKeys) throws IOException {
GraphsonUtil graphson = new GraphsonUtil(mode, factory, propertyKeys, null);
return graphson.vertexFromJson(json);
}
@@ -137,7 +137,7 @@ class GraphsonUtil {
* @param propertyKeys a list of keys to include on reading of element properties
*/
static Vertex vertexFromJson(String json, ElementFactory factory, GraphsonMode mode,
- Set<String> propertyKeys) throws ParseException {
+ Set<String> propertyKeys) throws ParseException {
GraphsonUtil graphson = new GraphsonUtil(mode, factory, propertyKeys, null);
return graphson.vertexFromJson(json);
}
@@ -151,39 +151,35 @@ class GraphsonUtil {
* @param propertyKeys a list of keys to include on reading of element properties
*/
static Vertex vertexFromJson(InputStream json, ElementFactory factory, GraphsonMode mode,
- Set<String> propertyKeys) throws IOException, ParseException {
+ Set<String> propertyKeys) throws IOException, ParseException {
GraphsonUtil graphson = new GraphsonUtil(mode, factory, propertyKeys, null);
return graphson.vertexFromJson(json);
}
private static boolean includeReservedKey(GraphsonMode mode, String key,
- Set<String> propertyKeys,
- ElementPropertiesRule rule) {
- // the key is always included in modes other than compact. if it is compact, then validate that the
+ Set<String> propertyKeys,
+ ElementPropertiesRule rule) {
+ // the key is always included in modes other than compact. if it is compact, then validate that the
// key is in the property key list
return mode != GraphsonMode.COMPACT || includeKey(key, propertyKeys, rule);
}
private static boolean includeKey(String key, Set<String> propertyKeys,
- ElementPropertiesRule rule) {
+ ElementPropertiesRule rule) {
if (propertyKeys == null) {
// when null always include the key and shortcut this piece
return true;
}
- // default the key situation. if it's included then it should be explicitly defined in the
+ // default the key situation. if it's included then it should be explicitly defined in the
// property keys list to be included or the reverse otherwise
boolean keySituation = rule == ElementPropertiesRule.INCLUDE;
- switch (rule) {
- case INCLUDE:
- keySituation = propertyKeys.contains(key);
- break;
- case EXCLUDE:
- keySituation = !propertyKeys.contains(key);
- break;
+ if (rule == ElementPropertiesRule.INCLUDE) {
+ keySituation = propertyKeys.contains(key);
+ } else if (rule == ElementPropertiesRule.EXCLUDE) {
+ keySituation = !propertyKeys.contains(key);
}
-
return keySituation;
}
@@ -196,8 +192,8 @@ class GraphsonUtil {
* @param propertyKeys a list of keys to include when reading of element properties
*/
static Edge edgeFromJson(String json, Vertex out, Vertex in,
- ElementFactory factory, GraphsonMode mode,
- Set<String> propertyKeys) throws IOException, ParseException {
+ ElementFactory factory, GraphsonMode mode,
+ Set<String> propertyKeys) throws IOException, ParseException {
GraphsonUtil graphson = new GraphsonUtil(mode, factory, null, propertyKeys);
return graphson.edgeFromJson(json, out, in);
}
@@ -211,8 +207,8 @@ class GraphsonUtil {
* @param propertyKeys a list of keys to include when reading of element properties
*/
static Edge edgeFromJson(InputStream json, Vertex out, Vertex in,
- ElementFactory factory, GraphsonMode mode,
- Set<String> propertyKeys) throws IOException, ParseException {
+ ElementFactory factory, GraphsonMode mode,
+ Set<String> propertyKeys) throws IOException, ParseException {
GraphsonUtil graphson = new GraphsonUtil(mode, factory, null, propertyKeys);
return graphson.edgeFromJson(json, out, in);
}
@@ -226,8 +222,8 @@ class GraphsonUtil {
* @param propertyKeys a list of keys to include when reading of element properties
*/
static Edge edgeFromJson(JSONObject json, Vertex out, Vertex in,
- ElementFactory factory, GraphsonMode mode,
- Set<String> propertyKeys) throws IOException {
+ ElementFactory factory, GraphsonMode mode,
+ Set<String> propertyKeys) throws IOException {
GraphsonUtil graphson = new GraphsonUtil(mode, factory, null, propertyKeys);
return graphson.edgeFromJson(json, out, in);
}
@@ -249,7 +245,7 @@ class GraphsonUtil {
private static boolean isReservedKey(String key) {
return key.equals(GraphsonTokens._ID) || key.equals(GraphsonTokens._TYPE) || key.equals(GraphsonTokens._LABEL)
- || key.equals(GraphsonTokens._OUT_V) || key.equals(GraphsonTokens._IN_V);
+ || key.equals(GraphsonTokens._OUT_V) || key.equals(GraphsonTokens._IN_V);
}
private static JSONArray createJSONList(List list, Set<String> propertyKeys, boolean showTypes) {
@@ -285,7 +281,7 @@ class GraphsonUtil {
value = createJSONMap((Map) value, propertyKeys, showTypes);
} else if (value instanceof Element) {
value = jsonFromElement((Element) value, propertyKeys,
- showTypes ? GraphsonMode.EXTENDED : GraphsonMode.NORMAL);
+ showTypes ? GraphsonMode.EXTENDED : GraphsonMode.NORMAL);
} else if (value.getClass().isArray()) {
value = createJSONList(convertArrayToList(value), propertyKeys, showTypes);
}
@@ -466,7 +462,7 @@ class GraphsonUtil {
} else if (type.equals(GraphsonTokens.TYPE_MAP)) {
- // maps are converted to a ObjectNode. called recursively to traverse
+ // maps are converted to a ObjectNode. called recursively to traverse
// the entire object graph within the map.
JSONObject convertedMap = new JSONObject();
JSONObject jsonObject = (JSONObject) value;
@@ -482,7 +478,7 @@ class GraphsonUtil {
} else {
- // this must be a primitive value or a complex object. if a complex
+ // this must be a primitive value or a complex object. if a complex
// object it will be handled by a call to toString and stored as a
// string value
putObject(valueAndType, GraphsonTokens.VALUE, value);
@@ -637,7 +633,7 @@ class GraphsonUtil {
putObject(jsonElement, GraphsonTokens._ID, element.getId());
}
- // it's important to keep the order of these straight. check Edge first and then Vertex because there
+ // it's important to keep the order of these straight. check Edge first and then Vertex because there
// are graph implementations that have Edge extend from Vertex
if (element instanceof Edge) {
Edge edge = (Edge) element;
diff --git a/sonar-core/src/main/java/org/sonar/core/persistence/BatchSession.java b/sonar-core/src/main/java/org/sonar/core/persistence/BatchSession.java
index a12942e13a9..d7f3d8255bd 100644
--- a/sonar-core/src/main/java/org/sonar/core/persistence/BatchSession.java
+++ b/sonar-core/src/main/java/org/sonar/core/persistence/BatchSession.java
@@ -29,7 +29,6 @@ import org.apache.ibatis.session.RowBounds;
import org.apache.ibatis.session.SqlSession;
import org.sonar.core.cluster.WorkQueue;
-import java.sql.Connection;
import java.util.List;
import java.util.Map;
@@ -40,7 +39,6 @@ public class BatchSession extends DbSession {
private final int batchSize;
private int count = 0;
-
BatchSession(WorkQueue queue, SqlSession session) {
this(queue, session, MAX_BATCH_SIZE);
}
@@ -50,67 +48,80 @@ public class BatchSession extends DbSession {
this.batchSize = batchSize;
}
+ @Override
public void select(String statement, Object parameter, ResultHandler handler) {
reset();
super.select(statement, parameter, handler);
}
+ @Override
public void select(String statement, ResultHandler handler) {
reset();
super.select(statement, handler);
}
+ @Override
public <T> T selectOne(String statement) {
reset();
return (T) super.selectOne(statement);
}
+ @Override
public <T> T selectOne(String statement, Object parameter) {
reset();
return (T) super.selectOne(statement, parameter);
}
+ @Override
public <E> List<E> selectList(String statement) {
reset();
return super.selectList(statement);
}
+ @Override
public <E> List<E> selectList(String statement, Object parameter) {
reset();
return super.selectList(statement, parameter);
}
+ @Override
public <E> List<E> selectList(String statement, Object parameter, RowBounds rowBounds) {
reset();
return super.selectList(statement, parameter, rowBounds);
}
+ @Override
public <K, V> Map<K, V> selectMap(String statement, String mapKey) {
reset();
return super.selectMap(statement, mapKey);
}
+ @Override
public <K, V> Map<K, V> selectMap(String statement, Object parameter, String mapKey) {
reset();
return super.selectMap(statement, parameter, mapKey);
}
+ @Override
public <K, V> Map<K, V> selectMap(String statement, Object parameter, String mapKey, RowBounds rowBounds) {
reset();
return super.selectMap(statement, parameter, mapKey, rowBounds);
}
+ @Override
public void select(String statement, Object parameter, RowBounds rowBounds, ResultHandler handler) {
reset();
super.select(statement, parameter, rowBounds, handler);
}
+ @Override
public int insert(String statement) {
makeSureGeneratedKeysAreNotUsedInBatchInserts(statement);
increment();
return super.insert(statement);
}
+ @Override
public int insert(String statement, Object parameter) {
makeSureGeneratedKeysAreNotUsedInBatchInserts(statement);
increment();
@@ -130,72 +141,66 @@ public class BatchSession extends DbSession {
}
}
+ @Override
public int update(String statement) {
increment();
return super.update(statement);
}
+ @Override
public int update(String statement, Object parameter) {
increment();
return super.update(statement, parameter);
}
+ @Override
public int delete(String statement) {
increment();
return super.delete(statement);
}
+ @Override
public int delete(String statement, Object parameter) {
increment();
return super.delete(statement, parameter);
}
+ @Override
public void commit() {
super.commit();
reset();
}
+ @Override
public void commit(boolean force) {
super.commit(force);
reset();
}
+ @Override
public void rollback() {
super.rollback();
reset();
}
+ @Override
public void rollback(boolean force) {
super.rollback(force);
reset();
}
+ @Override
public List<BatchResult> flushStatements() {
List<BatchResult> batchResults = super.flushStatements();
reset();
return batchResults;
}
- public void close() {
- super.close();
- }
-
- public void clearCache() {
- super.clearCache();
- }
-
- public Configuration getConfiguration() {
- return super.getConfiguration();
- }
-
+ @Override
public <T> T getMapper(Class<T> type) {
return getConfiguration().getMapper(type, this);
}
- public Connection getConnection() {
- return super.getConnection();
- }
-
private BatchSession increment() {
count += 1;
if (count >= batchSize) {
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/batch/analyzer/internal/package-info.java b/sonar-plugin-api/src/main/java/org/sonar/api/batch/analyzer/internal/package-info.java
index faacc1f77a6..b61bc2267b8 100644
--- a/sonar-plugin-api/src/main/java/org/sonar/api/batch/analyzer/internal/package-info.java
+++ b/sonar-plugin-api/src/main/java/org/sonar/api/batch/analyzer/internal/package-info.java
@@ -18,4 +18,4 @@
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
@javax.annotation.ParametersAreNonnullByDefault
-package org.sonar.api.batch.analyzer.internal; \ No newline at end of file
+package org.sonar.api.batch.analyzer.internal;
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/batch/analyzer/issue/internal/package-info.java b/sonar-plugin-api/src/main/java/org/sonar/api/batch/analyzer/issue/internal/package-info.java
index 61cb3773bcf..4034ce7fdfa 100644
--- a/sonar-plugin-api/src/main/java/org/sonar/api/batch/analyzer/issue/internal/package-info.java
+++ b/sonar-plugin-api/src/main/java/org/sonar/api/batch/analyzer/issue/internal/package-info.java
@@ -18,4 +18,4 @@
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
@javax.annotation.ParametersAreNonnullByDefault
-package org.sonar.api.batch.analyzer.issue.internal; \ No newline at end of file
+package org.sonar.api.batch.analyzer.issue.internal;
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/batch/analyzer/issue/package-info.java b/sonar-plugin-api/src/main/java/org/sonar/api/batch/analyzer/issue/package-info.java
index 1f3b2671fab..7ccdcaf5e21 100644
--- a/sonar-plugin-api/src/main/java/org/sonar/api/batch/analyzer/issue/package-info.java
+++ b/sonar-plugin-api/src/main/java/org/sonar/api/batch/analyzer/issue/package-info.java
@@ -18,4 +18,4 @@
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
@javax.annotation.ParametersAreNonnullByDefault
-package org.sonar.api.batch.analyzer.issue; \ No newline at end of file
+package org.sonar.api.batch.analyzer.issue;
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/batch/analyzer/measure/internal/package-info.java b/sonar-plugin-api/src/main/java/org/sonar/api/batch/analyzer/measure/internal/package-info.java
index d948c6e9894..a508e1eacb0 100644
--- a/sonar-plugin-api/src/main/java/org/sonar/api/batch/analyzer/measure/internal/package-info.java
+++ b/sonar-plugin-api/src/main/java/org/sonar/api/batch/analyzer/measure/internal/package-info.java
@@ -18,4 +18,4 @@
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
@javax.annotation.ParametersAreNonnullByDefault
-package org.sonar.api.batch.analyzer.measure.internal; \ No newline at end of file
+package org.sonar.api.batch.analyzer.measure.internal;
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/batch/analyzer/measure/package-info.java b/sonar-plugin-api/src/main/java/org/sonar/api/batch/analyzer/measure/package-info.java
index 42629447320..a72c5a175f1 100644
--- a/sonar-plugin-api/src/main/java/org/sonar/api/batch/analyzer/measure/package-info.java
+++ b/sonar-plugin-api/src/main/java/org/sonar/api/batch/analyzer/measure/package-info.java
@@ -18,4 +18,4 @@
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
@javax.annotation.ParametersAreNonnullByDefault
-package org.sonar.api.batch.analyzer.measure; \ No newline at end of file
+package org.sonar.api.batch.analyzer.measure;
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/batch/analyzer/package-info.java b/sonar-plugin-api/src/main/java/org/sonar/api/batch/analyzer/package-info.java
index 02b956c1976..4ae26db9bf1 100644
--- a/sonar-plugin-api/src/main/java/org/sonar/api/batch/analyzer/package-info.java
+++ b/sonar-plugin-api/src/main/java/org/sonar/api/batch/analyzer/package-info.java
@@ -18,4 +18,4 @@
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
@javax.annotation.ParametersAreNonnullByDefault
-package org.sonar.api.batch.analyzer; \ No newline at end of file
+package org.sonar.api.batch.analyzer;
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/batch/fs/internal/DefaultFileSystem.java b/sonar-plugin-api/src/main/java/org/sonar/api/batch/fs/internal/DefaultFileSystem.java
index ac2abd69414..2002c6feb1f 100644
--- a/sonar-plugin-api/src/main/java/org/sonar/api/batch/fs/internal/DefaultFileSystem.java
+++ b/sonar-plugin-api/src/main/java/org/sonar/api/batch/fs/internal/DefaultFileSystem.java
@@ -204,7 +204,7 @@ public class DefaultFileSystem implements FileSystem {
// nothing to do by default
}
- public static abstract class Cache {
+ public abstract static class Cache {
protected abstract Iterable<InputFile> inputFiles();
@CheckForNull
diff --git a/sonar-server/src/main/java/org/sonar/server/activity/index/ActivityNormalizer.java b/sonar-server/src/main/java/org/sonar/server/activity/index/ActivityNormalizer.java
index 6758799a3d4..96c2e6e7979 100644
--- a/sonar-server/src/main/java/org/sonar/server/activity/index/ActivityNormalizer.java
+++ b/sonar-server/src/main/java/org/sonar/server/activity/index/ActivityNormalizer.java
@@ -48,14 +48,14 @@ public class ActivityNormalizer extends BaseNormalizer<ActivityDto, String> {
public static final class LogFields extends Indexable {
- public final static IndexField KEY = add(IndexField.Type.STRING, "key");
- public final static IndexField TYPE = addSortable(IndexField.Type.STRING, "type");
- public final static IndexField ACTION = addSortable(IndexField.Type.STRING, "action");
- public final static IndexField CREATED_AT = addSortable(IndexField.Type.DATE, "createdAt");
- public final static IndexField UPDATED_AT = addSortable(IndexField.Type.DATE, BaseNormalizer.UPDATED_AT_FIELD);
- public final static IndexField LOGIN = addSearchable(IndexField.Type.STRING, "login");
- public final static IndexField DETAILS = addSearchable(IndexField.Type.OBJECT, "details");
- public final static IndexField MESSAGE = addSearchable(IndexField.Type.STRING, "message");
+ public static final IndexField KEY = add(IndexField.Type.STRING, "key");
+ public static final IndexField TYPE = addSortable(IndexField.Type.STRING, "type");
+ public static final IndexField ACTION = addSortable(IndexField.Type.STRING, "action");
+ public static final IndexField CREATED_AT = addSortable(IndexField.Type.DATE, "createdAt");
+ public static final IndexField UPDATED_AT = addSortable(IndexField.Type.DATE, BaseNormalizer.UPDATED_AT_FIELD);
+ public static final IndexField LOGIN = addSearchable(IndexField.Type.STRING, "login");
+ public static final IndexField DETAILS = addSearchable(IndexField.Type.OBJECT, "details");
+ public static final IndexField MESSAGE = addSearchable(IndexField.Type.STRING, "message");
public static Set<IndexField> ALL_FIELDS = getAllFields();
diff --git a/sonar-server/src/main/java/org/sonar/server/db/migrations/v43/NotResolvedIssuesOnRemovedComponentsMigration.java b/sonar-server/src/main/java/org/sonar/server/db/migrations/v43/NotResolvedIssuesOnRemovedComponentsMigration.java
index a06d94615fd..8563f27f283 100644
--- a/sonar-server/src/main/java/org/sonar/server/db/migrations/v43/NotResolvedIssuesOnRemovedComponentsMigration.java
+++ b/sonar-server/src/main/java/org/sonar/server/db/migrations/v43/NotResolvedIssuesOnRemovedComponentsMigration.java
@@ -20,7 +20,6 @@
package org.sonar.server.db.migrations.v43;
-import com.google.common.annotations.VisibleForTesting;
import org.sonar.api.issue.Issue;
import org.sonar.api.utils.System2;
import org.sonar.core.persistence.Database;
@@ -81,7 +80,7 @@ public class NotResolvedIssuesOnRemovedComponentsMigration implements DatabaseMi
return true;
}
}
- );
+ );
}
private static class Row {
diff --git a/sonar-server/src/main/java/org/sonar/server/platform/ServerComponents.java b/sonar-server/src/main/java/org/sonar/server/platform/ServerComponents.java
index 79b4fa8d66a..3ecbb8bb0dc 100644
--- a/sonar-server/src/main/java/org/sonar/server/platform/ServerComponents.java
+++ b/sonar-server/src/main/java/org/sonar/server/platform/ServerComponents.java
@@ -384,7 +384,7 @@ class ServerComponents {
* when its schema is up-to-date.
*/
Collection level3Components() {
- List components = Lists.newArrayList(
+ return Lists.newArrayList(
PersistentSettings.class,
DefaultDatabaseConnector.class,
ThreadLocalDatabaseSessionFactory.class,
@@ -394,7 +394,6 @@ class ServerComponents {
UriReader.class,
ServerIdGenerator.class
);
- return components;
}
diff --git a/sonar-server/src/main/java/org/sonar/server/rule/index/RuleDoc.java b/sonar-server/src/main/java/org/sonar/server/rule/index/RuleDoc.java
index 13b799f1870..0ff56b58ae1 100644
--- a/sonar-server/src/main/java/org/sonar/server/rule/index/RuleDoc.java
+++ b/sonar-server/src/main/java/org/sonar/server/rule/index/RuleDoc.java
@@ -45,7 +45,7 @@ import java.util.Map;
*/
public class RuleDoc extends BaseDoc implements Rule {
- public final static String MANUAL_REPOSITORY = "manual";
+ public static final String MANUAL_REPOSITORY = "manual";
RuleDoc(@Nullable Map<String, Object> fields) {
super(fields);
diff --git a/sonar-server/src/main/java/org/sonar/server/search/ws/BaseMapping.java b/sonar-server/src/main/java/org/sonar/server/search/ws/BaseMapping.java
index c36d5016a61..0d7e44d56d8 100644
--- a/sonar-server/src/main/java/org/sonar/server/search/ws/BaseMapping.java
+++ b/sonar-server/src/main/java/org/sonar/server/search/ws/BaseMapping.java
@@ -28,6 +28,7 @@ import org.sonar.server.search.IndexUtils;
import org.sonar.server.search.QueryOptions;
import javax.annotation.Nullable;
+
import java.util.Arrays;
import java.util.List;
import java.util.Set;
@@ -107,7 +108,7 @@ public abstract class BaseMapping implements ServerComponent {
void write(JsonWriter json, D doc);
}
- public static abstract class IndexField<D> implements Field<D> {
+ public abstract static class IndexField<D> implements Field<D> {
protected final String[] indexFields;
protected IndexField(String... indexFields) {
@@ -138,7 +139,8 @@ public abstract class BaseMapping implements ServerComponent {
@Override
public void write(JsonWriter json, BaseDoc doc) {
Object val = doc.getNullableField(indexFields[0]);
- if (val == null && indexFields.length == 2) { // There is an alternative value
+ if (val == null && indexFields.length == 2) {
+ // There is an alternative value
val = doc.getNullableField(indexFields[1]);
}
json.prop(key, val != null ? val.toString() : null);
diff --git a/sonar-ws-client/src/main/java/org/sonar/wsclient/unmarshallers/ServerSetupUnmarshaller.java b/sonar-ws-client/src/main/java/org/sonar/wsclient/unmarshallers/ServerSetupUnmarshaller.java
index 966d8b8c837..ae72b1324a9 100644
--- a/sonar-ws-client/src/main/java/org/sonar/wsclient/unmarshallers/ServerSetupUnmarshaller.java
+++ b/sonar-ws-client/src/main/java/org/sonar/wsclient/unmarshallers/ServerSetupUnmarshaller.java
@@ -31,10 +31,9 @@ public class ServerSetupUnmarshaller implements Unmarshaller<ServerSetup> {
public ServerSetup toModel(String json) {
WSUtils utils = WSUtils.getINSTANCE();
Object map = utils.parse(json);
- ServerSetup server = new ServerSetup()
- .setStatus(utils.getString(map, "status"))
- .setMessage(utils.getString(map, "msg"));
- return server;
+ return new ServerSetup()
+ .setStatus(utils.getString(map, "status"))
+ .setMessage(utils.getString(map, "msg"));
}
public List<ServerSetup> toModels(String json) {