Skip to content

Commit

Permalink
devonfw#103: updated urlSecJsonFile.contains
Browse files Browse the repository at this point in the history
if a single warning affects all versions, it is ignored
  • Loading branch information
MattesMrzik committed Dec 19, 2023
1 parent 4fbef6e commit 1b9224b
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -302,9 +302,9 @@ public boolean contains(VersionIdentifier version, boolean ignoreWarningsThatAff
VersionRange versionRange = warning.getVersionRange();
if (ignoreWarningsThatAffectAllVersions) {
boolean includesOldestVersion = versionRange.getMin() == null
|| sortedVersions.get(sortedVersions.size() - 1).equals(versionRange.getMin());
|| warning.getVersionRange().contains(sortedVersions.get(sortedVersions.size() - 1));
boolean includesNewestVersion = versionRange.getMax() == null
|| sortedVersions.get(0).equals(versionRange.getMax());
|| warning.getVersionRange().contains(sortedVersions.get(0));
if (includesOldestVersion && includesNewestVersion) {
continue;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,8 @@ public void testSecurityRiskInteractionAllVersionAffectedBySingleWarning() {
UrlSecurityJsonFile securityFile = context.getUrls().getEdition(tool.getName(), tool.getEdition())
.getSecurityJsonFile();

securityFile.addSecurityWarning(VersionRange.of(">"));
securityFile.addSecurityWarning(VersionRange.of(">")); // should get ignored
securityFile.addSecurityWarning(VersionRange.of("0>11")); // should get ignored
securityFile.addSecurityWarning(VersionRange.of("2>5"));

// act & assert
Expand Down

0 comments on commit 1b9224b

Please sign in to comment.