aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSimon Brandhof <simon.brandhof@gmail.com>2011-11-03 15:34:10 +0100
committerSimon Brandhof <simon.brandhof@gmail.com>2011-11-03 15:34:18 +0100
commit1c87ee80aeefcac5ea4934a4b8d3ccdd20dfbde1 (patch)
treec416d3460d15e668a16d47acc09c5c867867e162
parentb0d440578ea601e2f3fdc3afe624cfb13a4aea51 (diff)
downloadsonarqube-1c87ee80aeefcac5ea4934a4b8d3ccdd20dfbde1.tar.gz
sonarqube-1c87ee80aeefcac5ea4934a4b8d3ccdd20dfbde1.zip
Fix coding violations
-rw-r--r--plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/security/ApplyProjectRolesDecorator.java2
-rw-r--r--plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/sensors/WeightedViolationsDecorator.java2
-rw-r--r--plugins/sonar-dbcleaner-plugin/src/main/java/org/sonar/plugins/dbcleaner/runner/DefaultPurgeContext.java3
-rw-r--r--plugins/sonar-design-plugin/src/main/java/org/sonar/plugins/design/ui/page/client/DependencyInfo.java2
-rw-r--r--plugins/sonar-jacoco-plugin/src/main/java/org/sonar/plugins/jacoco/JacocoAntInitializer.java3
-rw-r--r--plugins/sonar-squid-java-plugin/src/main/java/org/sonar/plugins/squid/bridges/DependencyIndex.java1
-rw-r--r--plugins/sonar-squid-java-plugin/src/main/java/org/sonar/plugins/squid/bridges/ResourceIndex.java2
-rw-r--r--sonar-application/src/main/java/org/sonar/application/JettyEmbedder.java2
-rw-r--r--sonar-duplications/src/main/java/org/sonar/duplications/token/TokenQueue.java7
-rw-r--r--sonar-graph/src/main/java/org/sonar/graph/IncrementalCyclesAndFESSolver.java3
-rw-r--r--sonar-plugin-api/src/main/java/org/sonar/api/profiles/RulesProfile.java12
-rw-r--r--sonar-plugin-api/src/main/java/org/sonar/api/utils/DateUtils.java1
-rw-r--r--sonar-server/src/main/java/org/sonar/server/charts/ChartsServlet.java1
-rw-r--r--sonar-server/src/main/java/org/sonar/server/charts/deprecated/CustomBarRenderer.java1
-rw-r--r--sonar-server/src/main/java/org/sonar/server/configuration/Backup.java5
-rw-r--r--sonar-server/src/main/java/org/sonar/server/configuration/ProfilesBackup.java7
-rw-r--r--sonar-server/src/main/java/org/sonar/server/filters/FilterResult.java1
-rw-r--r--sonar-server/src/main/java/org/sonar/server/plugins/BatchResourcesServlet.java1
-rw-r--r--sonar-server/src/main/java/org/sonar/server/plugins/StaticResourcesServlet.java1
-rw-r--r--sonar-server/src/main/java/org/sonar/server/startup/GwtPublisher.java4
20 files changed, 38 insertions, 23 deletions
diff --git a/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/security/ApplyProjectRolesDecorator.java b/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/security/ApplyProjectRolesDecorator.java
index df4f66f9b04..883a7d41bf7 100644
--- a/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/security/ApplyProjectRolesDecorator.java
+++ b/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/security/ApplyProjectRolesDecorator.java
@@ -29,7 +29,7 @@ public class ApplyProjectRolesDecorator implements Decorator {
private RoleManager roleManager;
- protected ApplyProjectRolesDecorator(RoleManager roleManager) {
+ ApplyProjectRolesDecorator(RoleManager roleManager) {
this.roleManager = roleManager;
}
diff --git a/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/sensors/WeightedViolationsDecorator.java b/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/sensors/WeightedViolationsDecorator.java
index a0b636d1481..330cf8fe365 100644
--- a/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/sensors/WeightedViolationsDecorator.java
+++ b/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/sensors/WeightedViolationsDecorator.java
@@ -55,7 +55,7 @@ public class WeightedViolationsDecorator implements Decorator {
/**
* for unit tests
*/
- protected WeightedViolationsDecorator(Map<RulePriority, Integer> weights) {
+ WeightedViolationsDecorator(Map<RulePriority, Integer> weights) {
this.weights = weights;
}
diff --git a/plugins/sonar-dbcleaner-plugin/src/main/java/org/sonar/plugins/dbcleaner/runner/DefaultPurgeContext.java b/plugins/sonar-dbcleaner-plugin/src/main/java/org/sonar/plugins/dbcleaner/runner/DefaultPurgeContext.java
index ea49d64e485..adb577ed4df 100644
--- a/plugins/sonar-dbcleaner-plugin/src/main/java/org/sonar/plugins/dbcleaner/runner/DefaultPurgeContext.java
+++ b/plugins/sonar-dbcleaner-plugin/src/main/java/org/sonar/plugins/dbcleaner/runner/DefaultPurgeContext.java
@@ -61,6 +61,9 @@ public final class DefaultPurgeContext implements org.sonar.api.batch.PurgeConte
return project;
}
+ /**
+ * @deprecated
+ */
@Deprecated
public Integer getLastSnapshotId() {
return currentSid;
diff --git a/plugins/sonar-design-plugin/src/main/java/org/sonar/plugins/design/ui/page/client/DependencyInfo.java b/plugins/sonar-design-plugin/src/main/java/org/sonar/plugins/design/ui/page/client/DependencyInfo.java
index 22047918857..412322fb779 100644
--- a/plugins/sonar-design-plugin/src/main/java/org/sonar/plugins/design/ui/page/client/DependencyInfo.java
+++ b/plugins/sonar-design-plugin/src/main/java/org/sonar/plugins/design/ui/page/client/DependencyInfo.java
@@ -37,7 +37,7 @@ import org.sonar.wsclient.services.Resource;
import java.util.List;
-public class DependencyInfo extends Composite {
+public final class DependencyInfo extends Composite {
private static DependencyInfo INSTANCE = new DependencyInfo();
diff --git a/plugins/sonar-jacoco-plugin/src/main/java/org/sonar/plugins/jacoco/JacocoAntInitializer.java b/plugins/sonar-jacoco-plugin/src/main/java/org/sonar/plugins/jacoco/JacocoAntInitializer.java
index e74e2a7a3c8..83584e2b123 100644
--- a/plugins/sonar-jacoco-plugin/src/main/java/org/sonar/plugins/jacoco/JacocoAntInitializer.java
+++ b/plugins/sonar-jacoco-plugin/src/main/java/org/sonar/plugins/jacoco/JacocoAntInitializer.java
@@ -26,6 +26,7 @@ import org.sonar.api.batch.SupportedEnvironment;
import org.sonar.api.resources.Project;
import java.util.Hashtable;
+import java.util.Map;
@SupportedEnvironment("ant")
public class JacocoAntInitializer extends Initializer implements CoverageExtension {
@@ -48,7 +49,7 @@ public class JacocoAntInitializer extends Initializer implements CoverageExtensi
@Override
public void execute(org.sonar.api.resources.Project project) {
- Hashtable<String, Target> hastable = antProject.getTargets();
+ Map<String, Target> hastable = antProject.getTargets();
String jvmArg = configuration.getJvmArgument();
String[] names = configuration.getAntTargets();
for (String name : names) {
diff --git a/plugins/sonar-squid-java-plugin/src/main/java/org/sonar/plugins/squid/bridges/DependencyIndex.java b/plugins/sonar-squid-java-plugin/src/main/java/org/sonar/plugins/squid/bridges/DependencyIndex.java
index f46c399e9b4..8ecf0417a0d 100644
--- a/plugins/sonar-squid-java-plugin/src/main/java/org/sonar/plugins/squid/bridges/DependencyIndex.java
+++ b/plugins/sonar-squid-java-plugin/src/main/java/org/sonar/plugins/squid/bridges/DependencyIndex.java
@@ -25,4 +25,5 @@ import org.sonar.graph.Edge;
import java.util.HashMap;
public final class DependencyIndex extends HashMap<Edge, Dependency> {
+ private static final long serialVersionUID = -3915853089587077911L;
}
diff --git a/plugins/sonar-squid-java-plugin/src/main/java/org/sonar/plugins/squid/bridges/ResourceIndex.java b/plugins/sonar-squid-java-plugin/src/main/java/org/sonar/plugins/squid/bridges/ResourceIndex.java
index ba49a80d6de..dcb0a150e8e 100644
--- a/plugins/sonar-squid-java-plugin/src/main/java/org/sonar/plugins/squid/bridges/ResourceIndex.java
+++ b/plugins/sonar-squid-java-plugin/src/main/java/org/sonar/plugins/squid/bridges/ResourceIndex.java
@@ -39,6 +39,8 @@ import java.util.HashMap;
public final class ResourceIndex extends HashMap<SourceCode, Resource> {
+ private static final long serialVersionUID = -918346378374943773L;
+
public ResourceIndex loadSquidResources(Squid squid, SensorContext context, Project project) {
loadSquidProject(squid, project);
loadSquidPackages(squid, context);
diff --git a/sonar-application/src/main/java/org/sonar/application/JettyEmbedder.java b/sonar-application/src/main/java/org/sonar/application/JettyEmbedder.java
index 713ecab0267..309e3a40bcf 100644
--- a/sonar-application/src/main/java/org/sonar/application/JettyEmbedder.java
+++ b/sonar-application/src/main/java/org/sonar/application/JettyEmbedder.java
@@ -175,7 +175,7 @@ public class JettyEmbedder {
return null;
}
- protected Server getServer() {
+ Server getServer() {
return server;
}
diff --git a/sonar-duplications/src/main/java/org/sonar/duplications/token/TokenQueue.java b/sonar-duplications/src/main/java/org/sonar/duplications/token/TokenQueue.java
index 6fcd544e27e..a825b83e250 100644
--- a/sonar-duplications/src/main/java/org/sonar/duplications/token/TokenQueue.java
+++ b/sonar-duplications/src/main/java/org/sonar/duplications/token/TokenQueue.java
@@ -19,14 +19,11 @@
*/
package org.sonar.duplications.token;
-import java.util.Iterator;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.ListIterator;
+import java.util.*;
public class TokenQueue implements Iterable<Token> {
- private final LinkedList<Token> tokenQueue;
+ private final Deque<Token> tokenQueue;
public TokenQueue(List<Token> tokenList) {
tokenQueue = new LinkedList<Token>(tokenList);
diff --git a/sonar-graph/src/main/java/org/sonar/graph/IncrementalCyclesAndFESSolver.java b/sonar-graph/src/main/java/org/sonar/graph/IncrementalCyclesAndFESSolver.java
index 051cdc92f1d..e90cb46a55b 100644
--- a/sonar-graph/src/main/java/org/sonar/graph/IncrementalCyclesAndFESSolver.java
+++ b/sonar-graph/src/main/java/org/sonar/graph/IncrementalCyclesAndFESSolver.java
@@ -26,7 +26,6 @@ import java.util.Set;
public class IncrementalCyclesAndFESSolver<V> {
private Set<Cycle> cycles = new HashSet<Cycle>();
- private Set<Edge> edgesToExclude = new HashSet<Edge>();
private long searchCyclesCalls = 0;
private static final int DEFAULT_MAX_SEARCH_DEPTH_AT_FIRST = 3;
private static final int DEFAULT_MAX_CYCLES_TO_FOUND_BY_ITERATION = 100;
@@ -46,7 +45,7 @@ public class IncrementalCyclesAndFESSolver<V> {
searchCyclesCalls += cycleDetector.getSearchCyclesCalls();
cycles.addAll(cycleDetector.getCycles());
solver = new MinimumFeedbackEdgeSetSolver(cycles);
- edgesToExclude = solver.getEdges();
+ Set<Edge> edgesToExclude = solver.getEdges();
do {
iterations++;
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/profiles/RulesProfile.java b/sonar-plugin-api/src/main/java/org/sonar/api/profiles/RulesProfile.java
index 0455940f88f..20c3b4cd571 100644
--- a/sonar-plugin-api/src/main/java/org/sonar/api/profiles/RulesProfile.java
+++ b/sonar-plugin-api/src/main/java/org/sonar/api/profiles/RulesProfile.java
@@ -25,8 +25,6 @@ import org.apache.commons.collections.Transformer;
import org.apache.commons.lang.StringUtils;
import org.apache.commons.lang.builder.EqualsBuilder;
import org.apache.commons.lang.builder.HashCodeBuilder;
-import org.apache.commons.lang.builder.ReflectionToStringBuilder;
-import org.apache.commons.lang.builder.ToStringStyle;
import org.sonar.api.database.model.ResourceModel;
import org.sonar.api.rules.ActiveRule;
import org.sonar.api.rules.Rule;
@@ -143,20 +141,20 @@ public class RulesProfile implements Cloneable {
this.name = s;
return this;
}
-
+
public int getVersion() {
return version;
}
-
+
public RulesProfile setVersion(int version) {
this.version = version;
return this;
}
-
+
public Boolean getUsed() {
return used;
}
-
+
public RulesProfile setUsed(Boolean used) {
this.used = used;
return this;
@@ -308,6 +306,7 @@ public class RulesProfile implements Cloneable {
/**
* Note: disabled rules are excluded.
+ *
* @return the list of active rules for a given severity
*/
public List<ActiveRule> getActiveRules(RulePriority severity) {
@@ -344,6 +343,7 @@ public class RulesProfile implements Cloneable {
/**
* Note: disabled rules are excluded.
+ *
* @return an active rule from a plugin key and a rule key if the rule is activated, null otherwise
*/
public ActiveRule getActiveRule(String repositoryKey, String ruleKey) {
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/utils/DateUtils.java b/sonar-plugin-api/src/main/java/org/sonar/api/utils/DateUtils.java
index c41d5a3684f..cd6f77b4f5f 100644
--- a/sonar-plugin-api/src/main/java/org/sonar/api/utils/DateUtils.java
+++ b/sonar-plugin-api/src/main/java/org/sonar/api/utils/DateUtils.java
@@ -67,6 +67,7 @@ public final class DateUtils {
}
static class ThreadSafeDateFormat extends DateFormat {
+ private static final long serialVersionUID = -8856468429474634301L;
private final String format;
ThreadSafeDateFormat(String format) {
diff --git a/sonar-server/src/main/java/org/sonar/server/charts/ChartsServlet.java b/sonar-server/src/main/java/org/sonar/server/charts/ChartsServlet.java
index c4e2fda39bb..3f9ef2d756c 100644
--- a/sonar-server/src/main/java/org/sonar/server/charts/ChartsServlet.java
+++ b/sonar-server/src/main/java/org/sonar/server/charts/ChartsServlet.java
@@ -42,6 +42,7 @@ import java.util.Map;
public class ChartsServlet extends HttpServlet {
private static final Logger LOG = LoggerFactory.getLogger(ChartsServlet.class);
+ private static final long serialVersionUID = 669857447198433893L;
@Override
public void doGet(HttpServletRequest request, HttpServletResponse response)
diff --git a/sonar-server/src/main/java/org/sonar/server/charts/deprecated/CustomBarRenderer.java b/sonar-server/src/main/java/org/sonar/server/charts/deprecated/CustomBarRenderer.java
index 7bc2e1fa0dc..f149053d34e 100644
--- a/sonar-server/src/main/java/org/sonar/server/charts/deprecated/CustomBarRenderer.java
+++ b/sonar-server/src/main/java/org/sonar/server/charts/deprecated/CustomBarRenderer.java
@@ -25,6 +25,7 @@ import java.awt.*;
public class CustomBarRenderer extends BarRenderer {
+ private static final long serialVersionUID = -1598934457150811079L;
public static final Paint[] COLORS = new Paint[]{Color.red, Color.blue, Color.green,
Color.yellow, Color.orange, Color.cyan,
Color.magenta, Color.blue};
diff --git a/sonar-server/src/main/java/org/sonar/server/configuration/Backup.java b/sonar-server/src/main/java/org/sonar/server/configuration/Backup.java
index 635f256bb79..b1cc6b5502b 100644
--- a/sonar-server/src/main/java/org/sonar/server/configuration/Backup.java
+++ b/sonar-server/src/main/java/org/sonar/server/configuration/Backup.java
@@ -61,7 +61,10 @@ public class Backup {
backupables.add(new ProfilesBackup(session));
}
- protected Backup(List<Backupable> backupables) {
+ /**
+ * For unit tests
+ */
+ Backup(List<Backupable> backupables) {
this();
this.backupables = backupables;
}
diff --git a/sonar-server/src/main/java/org/sonar/server/configuration/ProfilesBackup.java b/sonar-server/src/main/java/org/sonar/server/configuration/ProfilesBackup.java
index 958fe22220b..daea84804a5 100644
--- a/sonar-server/src/main/java/org/sonar/server/configuration/ProfilesBackup.java
+++ b/sonar-server/src/main/java/org/sonar/server/configuration/ProfilesBackup.java
@@ -45,7 +45,10 @@ public class ProfilesBackup implements Backupable {
this.session = session;
}
- protected ProfilesBackup(Collection<RulesProfile> profiles) {
+ /**
+ * for unit tests
+ */
+ ProfilesBackup(Collection<RulesProfile> profiles) {
this.profiles = profiles;
}
@@ -200,7 +203,7 @@ public class ProfilesBackup implements Backupable {
while (reader.hasMoreChildren()) {
reader.moveDown();
valuesRule.put(reader.getNodeName(), reader.getValue());
- if (reader.getNodeName().equals("params")) {
+ if ("params".equals(reader.getNodeName())) {
while (reader.hasMoreChildren()) {
reader.moveDown();
Map<String, String> valuesParam = readNode(reader);
diff --git a/sonar-server/src/main/java/org/sonar/server/filters/FilterResult.java b/sonar-server/src/main/java/org/sonar/server/filters/FilterResult.java
index ae0ebf15c53..71a7a48a2c1 100644
--- a/sonar-server/src/main/java/org/sonar/server/filters/FilterResult.java
+++ b/sonar-server/src/main/java/org/sonar/server/filters/FilterResult.java
@@ -114,6 +114,7 @@ public class FilterResult {
}
static final class StringIgnoreCaseComparator implements Comparator, Serializable {
+ private static final long serialVersionUID = 963926659201833101L;
private int index;
StringIgnoreCaseComparator(int index) {
diff --git a/sonar-server/src/main/java/org/sonar/server/plugins/BatchResourcesServlet.java b/sonar-server/src/main/java/org/sonar/server/plugins/BatchResourcesServlet.java
index 856d14c98c7..187192bbb23 100644
--- a/sonar-server/src/main/java/org/sonar/server/plugins/BatchResourcesServlet.java
+++ b/sonar-server/src/main/java/org/sonar/server/plugins/BatchResourcesServlet.java
@@ -44,6 +44,7 @@ import javax.servlet.http.HttpServletResponse;
public class BatchResourcesServlet extends HttpServlet {
private static final Logger LOG = LoggerFactory.getLogger(BatchResourcesServlet.class);
+ private static final long serialVersionUID = -2100128371794649028L;
@Override
public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
diff --git a/sonar-server/src/main/java/org/sonar/server/plugins/StaticResourcesServlet.java b/sonar-server/src/main/java/org/sonar/server/plugins/StaticResourcesServlet.java
index 83068721c6c..afe8d4d63d3 100644
--- a/sonar-server/src/main/java/org/sonar/server/plugins/StaticResourcesServlet.java
+++ b/sonar-server/src/main/java/org/sonar/server/plugins/StaticResourcesServlet.java
@@ -37,6 +37,7 @@ import javax.servlet.http.HttpServletResponse;
public class StaticResourcesServlet extends HttpServlet {
private static final Logger LOG = LoggerFactory.getLogger(StaticResourcesServlet.class);
+ private static final long serialVersionUID = -2577454614650178426L;
@Override
public void doGet(HttpServletRequest request, HttpServletResponse response)
diff --git a/sonar-server/src/main/java/org/sonar/server/startup/GwtPublisher.java b/sonar-server/src/main/java/org/sonar/server/startup/GwtPublisher.java
index 6f3e0c69e52..40933363222 100644
--- a/sonar-server/src/main/java/org/sonar/server/startup/GwtPublisher.java
+++ b/sonar-server/src/main/java/org/sonar/server/startup/GwtPublisher.java
@@ -50,12 +50,12 @@ public class GwtPublisher {
this.settings = settings;
}
- protected GwtPublisher(GwtExtension[] extensions, File outputDir) {
+ GwtPublisher(GwtExtension[] extensions, File outputDir) {
this.extensions = extensions;
this.outputDir = outputDir;
}
- protected GwtPublisher() {
+ GwtPublisher() {
}
public void start() {