aboutsummaryrefslogtreecommitdiffstats
path: root/plugins
diff options
context:
space:
mode:
Diffstat (limited to 'plugins')
-rw-r--r--plugins/sonar-checkstyle-plugin/src/main/java/org/sonar/plugins/checkstyle/CheckstyleSensor.java1
-rw-r--r--plugins/sonar-cobertura-plugin/src/main/java/org/sonar/plugins/cobertura/api/CoberturaUtils.java1
-rw-r--r--plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/timemachine/ViolationPersisterDecorator.java9
-rw-r--r--plugins/sonar-findbugs-plugin/src/main/java/org/sonar/plugins/findbugs/FindbugsSensor.java1
-rw-r--r--plugins/sonar-pmd-plugin/src/main/java/org/sonar/plugins/pmd/PmdSensor.java5
-rw-r--r--plugins/sonar-squid-java-plugin/src/main/java/org/sonar/java/squid/check/EmptyFileCheck.java4
-rw-r--r--plugins/sonar-surefire-plugin/src/main/java/org/sonar/plugins/surefire/SurefirePlugin.java6
7 files changed, 15 insertions, 12 deletions
diff --git a/plugins/sonar-checkstyle-plugin/src/main/java/org/sonar/plugins/checkstyle/CheckstyleSensor.java b/plugins/sonar-checkstyle-plugin/src/main/java/org/sonar/plugins/checkstyle/CheckstyleSensor.java
index 3b2311e0f1f..83eb1b544fa 100644
--- a/plugins/sonar-checkstyle-plugin/src/main/java/org/sonar/plugins/checkstyle/CheckstyleSensor.java
+++ b/plugins/sonar-checkstyle-plugin/src/main/java/org/sonar/plugins/checkstyle/CheckstyleSensor.java
@@ -23,7 +23,6 @@ import org.sonar.api.batch.Sensor;
import org.sonar.api.batch.SensorContext;
import org.sonar.api.profiles.RulesProfile;
import org.sonar.api.resources.Project;
-import org.sonar.api.utils.Logs;
public class CheckstyleSensor implements Sensor {
diff --git a/plugins/sonar-cobertura-plugin/src/main/java/org/sonar/plugins/cobertura/api/CoberturaUtils.java b/plugins/sonar-cobertura-plugin/src/main/java/org/sonar/plugins/cobertura/api/CoberturaUtils.java
index c4e24332fe2..70a6a843780 100644
--- a/plugins/sonar-cobertura-plugin/src/main/java/org/sonar/plugins/cobertura/api/CoberturaUtils.java
+++ b/plugins/sonar-cobertura-plugin/src/main/java/org/sonar/plugins/cobertura/api/CoberturaUtils.java
@@ -39,6 +39,7 @@ public final class CoberturaUtils {
* @deprecated in 2.8, because assumes that Sonar executed from Maven. Not used any more in sonar-cobertura-plugin.
* See http://jira.codehaus.org/browse/SONAR-2321
*/
+ @Deprecated
public static File getReport(Project project) {
File report = getReportFromProperty(project);
if (report == null) {
diff --git a/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/timemachine/ViolationPersisterDecorator.java b/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/timemachine/ViolationPersisterDecorator.java
index ece114c8144..4935390e21d 100644
--- a/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/timemachine/ViolationPersisterDecorator.java
+++ b/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/timemachine/ViolationPersisterDecorator.java
@@ -23,7 +23,9 @@ import com.google.common.collect.LinkedHashMultimap;
import com.google.common.collect.Lists;
import com.google.common.collect.Multimap;
import org.apache.commons.codec.digest.DigestUtils;
+import org.apache.commons.lang.ObjectUtils;
import org.apache.commons.lang.StringUtils;
+import org.apache.commons.lang.math.NumberUtils;
import org.sonar.api.batch.*;
import org.sonar.api.database.model.RuleFailureModel;
import org.sonar.api.database.model.SnapshotSource;
@@ -123,7 +125,7 @@ public class ViolationPersisterDecorator implements Decorator {
return violationMap;
}
- private final boolean isNotAlreadyMapped(Violation newViolation, Map<Violation, RuleFailureModel> violationMap) {
+ private boolean isNotAlreadyMapped(Violation newViolation, Map<Violation, RuleFailureModel> violationMap) {
return violationMap.get(newViolation) == null;
}
@@ -161,7 +163,10 @@ public class ViolationPersisterDecorator implements Decorator {
}
private boolean isSameLine(Violation newViolation, RuleFailureModel pastViolation) {
- return pastViolation.getLine() == newViolation.getLineId(); //When lines are null, we also return true
+ if (pastViolation.getLine()==null && newViolation.getLineId()==null) {
+ return true;
+ }
+ return ObjectUtils.equals(pastViolation.getLine(), newViolation.getLineId());
}
private boolean isSameMessage(Violation newViolation, RuleFailureModel pastViolation) {
diff --git a/plugins/sonar-findbugs-plugin/src/main/java/org/sonar/plugins/findbugs/FindbugsSensor.java b/plugins/sonar-findbugs-plugin/src/main/java/org/sonar/plugins/findbugs/FindbugsSensor.java
index 7a5b86c0830..5a62645666f 100644
--- a/plugins/sonar-findbugs-plugin/src/main/java/org/sonar/plugins/findbugs/FindbugsSensor.java
+++ b/plugins/sonar-findbugs-plugin/src/main/java/org/sonar/plugins/findbugs/FindbugsSensor.java
@@ -19,7 +19,6 @@
*/
package org.sonar.plugins.findbugs;
-import org.apache.commons.lang.StringUtils;
import org.sonar.api.CoreProperties;
import org.sonar.api.batch.Sensor;
import org.sonar.api.batch.SensorContext;
diff --git a/plugins/sonar-pmd-plugin/src/main/java/org/sonar/plugins/pmd/PmdSensor.java b/plugins/sonar-pmd-plugin/src/main/java/org/sonar/plugins/pmd/PmdSensor.java
index 079be40e4f3..8be261318ba 100644
--- a/plugins/sonar-pmd-plugin/src/main/java/org/sonar/plugins/pmd/PmdSensor.java
+++ b/plugins/sonar-pmd-plugin/src/main/java/org/sonar/plugins/pmd/PmdSensor.java
@@ -19,16 +19,15 @@
*/
package org.sonar.plugins.pmd;
-import java.io.File;
-
import org.sonar.api.batch.Sensor;
import org.sonar.api.batch.SensorContext;
import org.sonar.api.profiles.RulesProfile;
import org.sonar.api.resources.Project;
import org.sonar.api.rules.RuleFinder;
-import org.sonar.api.utils.Logs;
import org.sonar.api.utils.XmlParserException;
+import java.io.File;
+
public class PmdSensor implements Sensor {
private RulesProfile profile;
diff --git a/plugins/sonar-squid-java-plugin/src/main/java/org/sonar/java/squid/check/EmptyFileCheck.java b/plugins/sonar-squid-java-plugin/src/main/java/org/sonar/java/squid/check/EmptyFileCheck.java
index 40e276d4d13..9377f080c6a 100644
--- a/plugins/sonar-squid-java-plugin/src/main/java/org/sonar/java/squid/check/EmptyFileCheck.java
+++ b/plugins/sonar-squid-java-plugin/src/main/java/org/sonar/java/squid/check/EmptyFileCheck.java
@@ -22,9 +22,7 @@ package org.sonar.java.squid.check;
import org.sonar.check.Priority;
import org.sonar.check.Rule;
-import org.sonar.check.RuleProperty;
import org.sonar.squid.api.CheckMessage;
-import org.sonar.squid.api.SourceClass;
import org.sonar.squid.api.SourceFile;
import org.sonar.squid.measures.Metric;
@@ -35,7 +33,7 @@ public final class EmptyFileCheck extends SquidCheck {
@Override
public void visitFile(SourceFile file) {
int loc = file.getInt(Metric.LINES_OF_CODE);
- if (loc==0) {
+ if (loc == 0) {
CheckMessage message = new CheckMessage(this, "This Java file is empty");
file.log(message);
}
diff --git a/plugins/sonar-surefire-plugin/src/main/java/org/sonar/plugins/surefire/SurefirePlugin.java b/plugins/sonar-surefire-plugin/src/main/java/org/sonar/plugins/surefire/SurefirePlugin.java
index 27f9abe2d8e..1cefa95d4e9 100644
--- a/plugins/sonar-surefire-plugin/src/main/java/org/sonar/plugins/surefire/SurefirePlugin.java
+++ b/plugins/sonar-surefire-plugin/src/main/java/org/sonar/plugins/surefire/SurefirePlugin.java
@@ -19,9 +19,11 @@
*/
package org.sonar.plugins.surefire;
-import org.sonar.api.*;
+import org.sonar.api.CoreProperties;
+import org.sonar.api.Properties;
+import org.sonar.api.Property;
+import org.sonar.api.SonarPlugin;
-import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;