|
13 | 13 | import java.util.Set;
|
14 | 14 | import java.util.stream.Collectors;
|
15 | 15 |
|
| 16 | +import com.devonfw.tools.ide.version.BoundaryType; |
16 | 17 | import org.owasp.dependencycheck.Engine;
|
17 | 18 | import org.owasp.dependencycheck.analyzer.AbstractAnalyzer;
|
18 | 19 | import org.owasp.dependencycheck.analyzer.AnalysisPhase;
|
@@ -295,16 +296,28 @@ public static VersionRange getVersionRangeFromInterval(String si, String se, Str
|
295 | 296 | throw new IllegalStateException(
|
296 | 297 | "Vulnerability has no interval of affected versions or single affected version.");
|
297 | 298 | }
|
298 |
| - return VersionRange.of(s + VersionRange.getVersionSeparator() + s); |
| 299 | + VersionIdentifier singleAffectedVersion = VersionIdentifier.of(s); |
| 300 | + return new VersionRange(singleAffectedVersion, singleAffectedVersion, BoundaryType.OPEN); |
299 | 301 | }
|
300 | 302 |
|
301 |
| - String leftBoundary = se == null ? VersionRange.getStartIncludingPrefix() + Objects.toString(si, "") |
302 |
| - : VersionRange.getStartExcludingPrefix() + se; |
| 303 | + boolean leftExclusive = si == null; |
| 304 | + boolean rightExclusive = ei == null; |
303 | 305 |
|
304 |
| - String rightBoundary = ee == null ? Objects.toString(ei, "") + VersionRange.getEndIncludingSuffix() |
305 |
| - : ee + VersionRange.getEndExcludingSuffix(); |
| 306 | + VersionIdentifier min = null; |
| 307 | + if (si != null) { |
| 308 | + min = VersionIdentifier.of(si); |
| 309 | + } else if (se != null) { |
| 310 | + min = VersionIdentifier.of(se); |
| 311 | + } |
| 312 | + |
| 313 | + VersionIdentifier max = null; |
| 314 | + if (ei != null) { |
| 315 | + max = VersionIdentifier.of(ei); |
| 316 | + } else if (ee != null) { |
| 317 | + max = VersionIdentifier.of(ee); |
| 318 | + } |
306 | 319 |
|
307 |
| - return VersionRange.of(leftBoundary + VersionRange.getVersionSeparator() + rightBoundary); |
| 320 | + return new VersionRange(min, max, BoundaryType.of(leftExclusive, rightExclusive)); |
308 | 321 | }
|
309 | 322 |
|
310 | 323 | private static void printAffectedVersions(IdeContext context) {
|
@@ -333,14 +346,14 @@ private static void printAffectedVersions(IdeContext context) {
|
333 | 346 | } else {
|
334 | 347 | if (min != null) {
|
335 | 348 | System.out.println("Tool " + tool.getName() + " with edition " + edition.getName() + " and versions "
|
336 |
| - + new VersionRange(min, version, false, true) + " are affected by vulnerabilities."); |
| 349 | + + new VersionRange(min, version, BoundaryType.of(false, true)) + " are affected by vulnerabilities."); |
337 | 350 | min = null;
|
338 | 351 | }
|
339 | 352 | }
|
340 | 353 | }
|
341 | 354 | if (min != null) {
|
342 | 355 | System.out.println("Tool " + tool.getName() + " with edition " + edition.getName() + " and versions "
|
343 |
| - + new VersionRange(min, null, false, true) + " are affected by vulnerabilities."); |
| 356 | + + new VersionRange(min, null, BoundaryType.of(false, true)) + " are affected by vulnerabilities."); |
344 | 357 | }
|
345 | 358 | }
|
346 | 359 | }
|
|
0 commit comments