aboutsummaryrefslogtreecommitdiffstats
path: root/sonar-plugin-api-impl
diff options
context:
space:
mode:
authorDuarte Meneses <duarte.meneses@sonarsource.com>2019-07-10 10:41:04 -0500
committerSonarTech <sonartech@sonarsource.com>2019-07-12 20:21:15 +0200
commit0621ff4a475e52aeb0a3d770a339a5d59a1991e6 (patch)
treee8203739bfdcbb401d0be1c7c8f3d520ce0424f2 /sonar-plugin-api-impl
parent6ce2c8689b7a574ac6cc6906210de4f45247e7aa (diff)
downloadsonarqube-0621ff4a475e52aeb0a3d770a339a5d59a1991e6.tar.gz
sonarqube-0621ff4a475e52aeb0a3d770a339a5d59a1991e6.zip
Fix code quality issues
Diffstat (limited to 'sonar-plugin-api-impl')
-rw-r--r--sonar-plugin-api-impl/src/main/java/org/sonar/api/batch/fs/internal/DefaultIndexedFile.java2
-rw-r--r--sonar-plugin-api-impl/src/main/java/org/sonar/api/batch/fs/internal/DefaultTextPointer.java2
-rw-r--r--sonar-plugin-api-impl/src/main/java/org/sonar/api/batch/fs/internal/DefaultTextRange.java2
-rw-r--r--sonar-plugin-api-impl/src/main/java/org/sonar/api/batch/fs/internal/TestInputFileBuilder.java4
-rw-r--r--sonar-plugin-api-impl/src/main/java/org/sonar/api/batch/sensor/internal/DefaultStorable.java4
-rw-r--r--sonar-plugin-api-impl/src/main/java/org/sonar/api/impl/ws/ValidatingRequest.java5
6 files changed, 11 insertions, 8 deletions
diff --git a/sonar-plugin-api-impl/src/main/java/org/sonar/api/batch/fs/internal/DefaultIndexedFile.java b/sonar-plugin-api-impl/src/main/java/org/sonar/api/batch/fs/internal/DefaultIndexedFile.java
index 229280fca5b..59b9c06fff2 100644
--- a/sonar-plugin-api-impl/src/main/java/org/sonar/api/batch/fs/internal/DefaultIndexedFile.java
+++ b/sonar-plugin-api-impl/src/main/java/org/sonar/api/batch/fs/internal/DefaultIndexedFile.java
@@ -126,7 +126,7 @@ public class DefaultIndexedFile extends DefaultInputComponent implements Indexed
return true;
}
- if (!(o instanceof DefaultIndexedFile)) {
+ if (o == null || o.getClass() != this.getClass()) {
return false;
}
diff --git a/sonar-plugin-api-impl/src/main/java/org/sonar/api/batch/fs/internal/DefaultTextPointer.java b/sonar-plugin-api-impl/src/main/java/org/sonar/api/batch/fs/internal/DefaultTextPointer.java
index c10efd01de7..200bda8427b 100644
--- a/sonar-plugin-api-impl/src/main/java/org/sonar/api/batch/fs/internal/DefaultTextPointer.java
+++ b/sonar-plugin-api-impl/src/main/java/org/sonar/api/batch/fs/internal/DefaultTextPointer.java
@@ -51,7 +51,7 @@ public class DefaultTextPointer implements TextPointer {
@Override
public boolean equals(Object obj) {
- if (!(obj instanceof DefaultTextPointer)) {
+ if (obj == null || obj.getClass() != this.getClass()) {
return false;
}
DefaultTextPointer other = (DefaultTextPointer) obj;
diff --git a/sonar-plugin-api-impl/src/main/java/org/sonar/api/batch/fs/internal/DefaultTextRange.java b/sonar-plugin-api-impl/src/main/java/org/sonar/api/batch/fs/internal/DefaultTextRange.java
index efef79cf367..c46deeffe14 100644
--- a/sonar-plugin-api-impl/src/main/java/org/sonar/api/batch/fs/internal/DefaultTextRange.java
+++ b/sonar-plugin-api-impl/src/main/java/org/sonar/api/batch/fs/internal/DefaultTextRange.java
@@ -59,7 +59,7 @@ public class DefaultTextRange implements TextRange {
@Override
public boolean equals(Object obj) {
- if (!(obj instanceof DefaultTextRange)) {
+ if (obj == null || obj.getClass() != this.getClass()) {
return false;
}
DefaultTextRange other = (DefaultTextRange) obj;
diff --git a/sonar-plugin-api-impl/src/main/java/org/sonar/api/batch/fs/internal/TestInputFileBuilder.java b/sonar-plugin-api-impl/src/main/java/org/sonar/api/batch/fs/internal/TestInputFileBuilder.java
index 00f9319c2d4..bcbb27428d7 100644
--- a/sonar-plugin-api-impl/src/main/java/org/sonar/api/batch/fs/internal/TestInputFileBuilder.java
+++ b/sonar-plugin-api-impl/src/main/java/org/sonar/api/batch/fs/internal/TestInputFileBuilder.java
@@ -86,10 +86,10 @@ public class TestInputFileBuilder {
* filePath must point to a file that is within the module base directory.
*/
public TestInputFileBuilder(String projectKey, File moduleBaseDir, File filePath) {
- String relativePath = moduleBaseDir.toPath().relativize(filePath.toPath()).toString();
+ String relativePathStr = moduleBaseDir.toPath().relativize(filePath.toPath()).toString();
this.projectKey = projectKey;
setModuleBaseDir(moduleBaseDir.toPath());
- this.relativePath = PathUtils.sanitize(relativePath);
+ this.relativePath = PathUtils.sanitize(relativePathStr);
this.id = batchId++;
}
diff --git a/sonar-plugin-api-impl/src/main/java/org/sonar/api/batch/sensor/internal/DefaultStorable.java b/sonar-plugin-api-impl/src/main/java/org/sonar/api/batch/sensor/internal/DefaultStorable.java
index 822ffbc2a40..d0ff1b59e60 100644
--- a/sonar-plugin-api-impl/src/main/java/org/sonar/api/batch/sensor/internal/DefaultStorable.java
+++ b/sonar-plugin-api-impl/src/main/java/org/sonar/api/batch/sensor/internal/DefaultStorable.java
@@ -28,8 +28,8 @@ import static org.sonar.api.utils.Preconditions.checkState;
public abstract class DefaultStorable {
- protected final transient SensorStorage storage;
- private transient boolean saved = false;
+ protected final SensorStorage storage;
+ private boolean saved = false;
public DefaultStorable() {
this.storage = null;
diff --git a/sonar-plugin-api-impl/src/main/java/org/sonar/api/impl/ws/ValidatingRequest.java b/sonar-plugin-api-impl/src/main/java/org/sonar/api/impl/ws/ValidatingRequest.java
index 6e7d90b6a06..dda4cbd337c 100644
--- a/sonar-plugin-api-impl/src/main/java/org/sonar/api/impl/ws/ValidatingRequest.java
+++ b/sonar-plugin-api-impl/src/main/java/org/sonar/api/impl/ws/ValidatingRequest.java
@@ -85,6 +85,9 @@ public abstract class ValidatingRequest extends Request {
@Override
public List<String> multiParam(String key) {
WebService.Param definition = action.param(key);
+ if (definition == null) {
+ throw new IllegalArgumentException("Parameter '" + key + "' not found for action '" + action.key() + "'");
+ }
List<String> values = readMultiParamOrDefaultValue(key, definition);
return validateValues(values, definition);
}
@@ -224,7 +227,7 @@ public abstract class ValidatingRequest extends Request {
checkArgument(valueAsInt <= maximumValue, "'%s' value (%s) must be less than %s", key, valueAsInt, maximumValue);
}
- private static void validateRequiredValue(String key, WebService.Param definition, String value) {
+ private static void validateRequiredValue(String key, WebService.Param definition, @Nullable String value) {
boolean required = definition.isRequired();
if (required) {
checkArgument(value != null, format(MSG_PARAMETER_MISSING, key));