Skip to content

Commit

Permalink
fix: improve code
Browse files Browse the repository at this point in the history
Co-authored-by: Hans Aikema <[email protected]>
  • Loading branch information
jeremylong and aikebah authored Nov 8, 2023
1 parent 10b740a commit 09fc658
Showing 1 changed file with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -991,19 +991,19 @@ private int updateOrInsertVulnerability(DefCveItem cve, String description) {
callUpdate.setNull(17, java.sql.Types.NULL);
callUpdate.setNull(18, java.sql.Types.NULL);
}
Optional<CvssV3> optCvssv30 = null;
Optional<CvssV3> optCvssv30 = Optional.empty();
if (cve.getCve().getMetrics() != null && cve.getCve().getMetrics().getCvssMetricV30() != null) {
optCvssv30 = cve.getCve().getMetrics().getCvssMetricV30().stream().sorted(Comparator.comparing(CvssV3::getType)).findFirst();
}
Optional<CvssV3> optCvssv31 = null;
Optional<CvssV3> optCvssv31 = Optional.empty();
if (cve.getCve().getMetrics() != null && cve.getCve().getMetrics().getCvssMetricV31() != null) {
optCvssv31 = cve.getCve().getMetrics().getCvssMetricV31().stream().sorted(Comparator.comparing(CvssV3::getType)).findFirst();
}

CvssV3 cvssv3 = null;
if (optCvssv31 != null && optCvssv31.isPresent()) {
if (optCvssv31.isPresent()) {
cvssv3 = optCvssv31.get();
} else if (optCvssv30 != null && optCvssv30.isPresent()) {
} else if (optCvssv30.isPresent()) {
cvssv3 = optCvssv30.get();
}
if (cvssv3 != null) {
Expand Down

0 comments on commit 09fc658

Please sign in to comment.