@@ -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; | |||
} | |||
@@ -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; |
@@ -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; |
@@ -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++; | |||
} | |||
@@ -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; |
@@ -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)); |
@@ -591,7 +591,7 @@ public class RequestTest { | |||
@Test | |||
public void fail_if_multi_param_is_not_defined() { | |||
expectedException.expect(IllegalArgumentException.class); | |||
expectedException.expectMessage("BUG - parameter 'unknown' is undefined for action 'my_action'"); | |||
expectedException.expectMessage("Parameter 'unknown' not found for action 'my_action'"); | |||
underTest.multiParam("unknown"); | |||
} |