Skip to content
This repository was archived by the owner on Feb 26, 2021. It is now read-only.

Commit b1e37b5

Browse files
committed
Make sure latestTestResponseId is set, always
1 parent 7872e25 commit b1e37b5

File tree

1 file changed

+5
-5
lines changed
  • scb-persistenceproviders/defectdojo-persistenceprovider/src/main/java/io/securecodebox/persistence

1 file changed

+5
-5
lines changed

scb-persistenceproviders/defectdojo-persistenceprovider/src/main/java/io/securecodebox/persistence/DefectDojoService.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -275,13 +275,13 @@ private Optional<Long> getTestIdByEngagementName(long engagementId, String testN
275275
Optional<Long> testResponseId = null;
276276
Optional<Long> latestTestResponseId = Optional.empty();
277277
for(TestResponse test : response.getBody().getResults()) {
278-
if(testName == null) {
279-
if(!latestTestResponseId.isPresent() || latestTestResponseId.get() < test.getId()) {
280-
latestTestResponseId = Optional.of(test.getId());
281-
}
282-
} else if (test.getTitle() != null && test.getTitle().equals(testName)) {
278+
if(testName == null || (test.getTitle() != null && test.getTitle().equals(testName))) {
283279
testResponseId = Optional.of(test.getId());
284280
}
281+
if(!latestTestResponseId.isPresent() || latestTestResponseId.get() < test.getId()) {
282+
latestTestResponseId = Optional.of(test.getId());
283+
}
284+
285285
}
286286
if(testResponseId != null) {
287287
return testResponseId;

0 commit comments

Comments
 (0)