Skip to content

Commit 3f334c8

Browse files
committed
#23 Also return false if id value in query params is null
Since the implementation of isNameEqual returns false, if the value in the map is null, we do this for id the same way to be consistent. Signed-off-by: Sven Strittmatter <sven.strittmatter@iteratec.com>
1 parent 3bf738d commit 3f334c8

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

src/main/java/io/securecodebox/persistence/defectdojo/model/QueryParamsComparator.java

+4-1
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,10 @@ static boolean isIdEqual(HasId model, Map<String, Object> queryParams) {
3939
return false;
4040
}
4141

42-
// FIXME: Since th generic type for value is Object, possible NPE here!
42+
if (isNull(queryParams.get(QUERY_PARAM_KEY_FOR_ID))) {
43+
return false;
44+
}
45+
4346
return queryParams.get(QUERY_PARAM_KEY_FOR_ID).equals(model.getId());
4447
}
4548

src/test/java/io/securecodebox/persistence/defectdojo/model/QueryParamsComparatorTest.java

-1
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,6 @@ void isIdEqual_falseIfQueryParamsDoesNotContainId() {
5050
}
5151

5252
@Test
53-
@Disabled("Unclear if this behaviour will break something.")
5453
void isIdEqual_falseIfQueryParamValueIsNull() {
5554
final var queryParams = new HashMap<String, Object>();
5655
queryParams.put(QueryParamsComparator.QUERY_PARAM_KEY_FOR_ID, null);

0 commit comments

Comments
 (0)