diff --git a/src/main/java/org/dependencytrack/model/DependencyMetrics.java b/src/main/java/org/dependencytrack/model/DependencyMetrics.java index 4ed1bc1b6..6ca73019b 100644 --- a/src/main/java/org/dependencytrack/model/DependencyMetrics.java +++ b/src/main/java/org/dependencytrack/model/DependencyMetrics.java @@ -241,7 +241,7 @@ public void setLow(int low) { } public int getUnassigned() { - return unassigned; + return unassigned != null ? unassigned : 0; } public void setUnassigned(int unassigned) { @@ -265,7 +265,7 @@ public void setSuppressed(int suppressed) { } public int getFindingsTotal() { - return findingsTotal; + return findingsTotal != null ? findingsTotal : 0; } public void setFindingsTotal(int findingsTotal) { @@ -273,7 +273,7 @@ public void setFindingsTotal(int findingsTotal) { } public int getFindingsAudited() { - return findingsAudited; + return findingsAudited != null ? findingsAudited : 0; } public void setFindingsAudited(int findingsAudited) { @@ -281,7 +281,7 @@ public void setFindingsAudited(int findingsAudited) { } public int getFindingsUnaudited() { - return findingsUnaudited; + return findingsUnaudited != null ? findingsUnaudited : 0; } public void setFindingsUnaudited(int findingsUnaudited) { @@ -297,7 +297,7 @@ public void setInheritedRiskScore(double inheritedRiskScore) { } public int getPolicyViolationsFail() { - return policyViolationsFail; + return policyViolationsFail != null ? policyViolationsFail : 0; } public void setPolicyViolationsFail(int policyViolationsFail) { @@ -305,7 +305,7 @@ public void setPolicyViolationsFail(int policyViolationsFail) { } public int getPolicyViolationsWarn() { - return policyViolationsWarn; + return policyViolationsWarn != null ? policyViolationsWarn : 0; } public void setPolicyViolationsWarn(int policyViolationsWarn) { @@ -313,7 +313,7 @@ public void setPolicyViolationsWarn(int policyViolationsWarn) { } public int getPolicyViolationsInfo() { - return policyViolationsInfo; + return policyViolationsInfo != null ? policyViolationsInfo : 0; } public void setPolicyViolationsInfo(int policyViolationsInfo) { @@ -321,7 +321,7 @@ public void setPolicyViolationsInfo(int policyViolationsInfo) { } public int getPolicyViolationsTotal() { - return policyViolationsTotal; + return policyViolationsTotal != null ? policyViolationsTotal : 0; } public void setPolicyViolationsTotal(int policyViolationsTotal) { @@ -329,7 +329,7 @@ public void setPolicyViolationsTotal(int policyViolationsTotal) { } public int getPolicyViolationsAudited() { - return policyViolationsAudited; + return policyViolationsAudited != null ? policyViolationsAudited : 0; } public void setPolicyViolationsAudited(int policyViolationsAudited) { @@ -337,7 +337,7 @@ public void setPolicyViolationsAudited(int policyViolationsAudited) { } public int getPolicyViolationsUnaudited() { - return policyViolationsUnaudited; + return policyViolationsUnaudited != null ? policyViolationsUnaudited : 0; } public void setPolicyViolationsUnaudited(int policyViolationsUnaudited) { @@ -345,7 +345,7 @@ public void setPolicyViolationsUnaudited(int policyViolationsUnaudited) { } public int getPolicyViolationsSecurityTotal() { - return policyViolationsSecurityTotal; + return policyViolationsSecurityTotal != null ? policyViolationsSecurityTotal : 0; } public void setPolicyViolationsSecurityTotal(int policyViolationsSecurityTotal) { @@ -353,7 +353,7 @@ public void setPolicyViolationsSecurityTotal(int policyViolationsSecurityTotal) } public int getPolicyViolationsSecurityAudited() { - return policyViolationsSecurityAudited; + return policyViolationsSecurityAudited != null ? policyViolationsSecurityAudited : 0; } public void setPolicyViolationsSecurityAudited(int policyViolationsSecurityAudited) { @@ -361,7 +361,7 @@ public void setPolicyViolationsSecurityAudited(int policyViolationsSecurityAudit } public int getPolicyViolationsSecurityUnaudited() { - return policyViolationsSecurityUnaudited; + return policyViolationsSecurityUnaudited != null ? policyViolationsSecurityUnaudited : 0; } public void setPolicyViolationsSecurityUnaudited(int policyViolationsSecurityUnaudited) { @@ -369,7 +369,7 @@ public void setPolicyViolationsSecurityUnaudited(int policyViolationsSecurityUna } public int getPolicyViolationsLicenseTotal() { - return policyViolationsLicenseTotal; + return policyViolationsLicenseTotal != null ? policyViolationsLicenseTotal : 0; } public void setPolicyViolationsLicenseTotal(int policyViolationsLicenseTotal) { @@ -377,7 +377,7 @@ public void setPolicyViolationsLicenseTotal(int policyViolationsLicenseTotal) { } public int getPolicyViolationsLicenseAudited() { - return policyViolationsLicenseAudited; + return policyViolationsLicenseAudited != null ? policyViolationsLicenseAudited : 0; } public void setPolicyViolationsLicenseAudited(int policyViolationsLicenseAudited) { @@ -385,7 +385,7 @@ public void setPolicyViolationsLicenseAudited(int policyViolationsLicenseAudited } public int getPolicyViolationsLicenseUnaudited() { - return policyViolationsLicenseUnaudited; + return policyViolationsLicenseUnaudited != null ? policyViolationsLicenseUnaudited : 0; } public void setPolicyViolationsLicenseUnaudited(int policyViolationsLicenseUnaudited) { @@ -393,7 +393,7 @@ public void setPolicyViolationsLicenseUnaudited(int policyViolationsLicenseUnaud } public int getPolicyViolationsOperationalTotal() { - return policyViolationsOperationalTotal; + return policyViolationsOperationalTotal != null ? policyViolationsOperationalTotal : 0; } public void setPolicyViolationsOperationalTotal(int policyViolationsOperationalTotal) { @@ -401,7 +401,7 @@ public void setPolicyViolationsOperationalTotal(int policyViolationsOperationalT } public int getPolicyViolationsOperationalAudited() { - return policyViolationsOperationalAudited; + return policyViolationsOperationalAudited != null ? policyViolationsOperationalAudited : 0; } public void setPolicyViolationsOperationalAudited(int policyViolationsOperationalAudited) { @@ -409,7 +409,7 @@ public void setPolicyViolationsOperationalAudited(int policyViolationsOperationa } public int getPolicyViolationsOperationalUnaudited() { - return policyViolationsOperationalUnaudited; + return policyViolationsOperationalUnaudited != null ? policyViolationsOperationalUnaudited : 0; } public void setPolicyViolationsOperationalUnaudited(int policyViolationsOperationalUnaudited) { diff --git a/src/main/java/org/dependencytrack/model/PortfolioMetrics.java b/src/main/java/org/dependencytrack/model/PortfolioMetrics.java index 38e2adfc5..f12678add 100644 --- a/src/main/java/org/dependencytrack/model/PortfolioMetrics.java +++ b/src/main/java/org/dependencytrack/model/PortfolioMetrics.java @@ -229,7 +229,7 @@ public void setLow(int low) { } public int getUnassigned() { - return unassigned; + return unassigned != null ? unassigned : 0; } public void setUnassigned(int unassigned) { @@ -285,7 +285,7 @@ public void setSuppressed(int suppressed) { } public int getFindingsTotal() { - return findingsTotal; + return findingsTotal != null ? findingsTotal : 0; } public void setFindingsTotal(int findingsTotal) { @@ -293,7 +293,7 @@ public void setFindingsTotal(int findingsTotal) { } public int getFindingsAudited() { - return findingsAudited; + return findingsAudited != null ? findingsAudited : 0; } public void setFindingsAudited(int findingsAudited) { @@ -301,7 +301,7 @@ public void setFindingsAudited(int findingsAudited) { } public int getFindingsUnaudited() { - return findingsUnaudited; + return findingsUnaudited != null ? findingsUnaudited : 0; } public void setFindingsUnaudited(int findingsUnaudited) { @@ -317,7 +317,7 @@ public void setInheritedRiskScore(double inheritedRiskScore) { } public int getPolicyViolationsFail() { - return policyViolationsFail; + return policyViolationsFail != null ? policyViolationsFail : 0; } public void setPolicyViolationsFail(int policyViolationsFail) { @@ -325,7 +325,7 @@ public void setPolicyViolationsFail(int policyViolationsFail) { } public int getPolicyViolationsWarn() { - return policyViolationsWarn; + return policyViolationsWarn != null ? policyViolationsWarn : 0; } public void setPolicyViolationsWarn(int policyViolationsWarn) { @@ -333,7 +333,7 @@ public void setPolicyViolationsWarn(int policyViolationsWarn) { } public int getPolicyViolationsInfo() { - return policyViolationsInfo; + return policyViolationsInfo != null ? policyViolationsInfo : 0; } public void setPolicyViolationsInfo(int policyViolationsInfo) { @@ -341,7 +341,7 @@ public void setPolicyViolationsInfo(int policyViolationsInfo) { } public int getPolicyViolationsTotal() { - return policyViolationsTotal; + return policyViolationsTotal != null ? policyViolationsTotal : 0; } public void setPolicyViolationsTotal(int policyViolationsTotal) { @@ -349,7 +349,7 @@ public void setPolicyViolationsTotal(int policyViolationsTotal) { } public int getPolicyViolationsAudited() { - return policyViolationsAudited; + return policyViolationsAudited != null ? policyViolationsAudited : 0; } public void setPolicyViolationsAudited(int policyViolationsAudited) { @@ -357,7 +357,7 @@ public void setPolicyViolationsAudited(int policyViolationsAudited) { } public int getPolicyViolationsUnaudited() { - return policyViolationsUnaudited; + return policyViolationsUnaudited != null ? policyViolationsUnaudited : 0; } public void setPolicyViolationsUnaudited(int policyViolationsUnaudited) { @@ -365,7 +365,7 @@ public void setPolicyViolationsUnaudited(int policyViolationsUnaudited) { } public int getPolicyViolationsSecurityTotal() { - return policyViolationsSecurityTotal; + return policyViolationsSecurityTotal != null ? policyViolationsSecurityTotal : 0; } public void setPolicyViolationsSecurityTotal(int policyViolationsSecurityTotal) { @@ -373,7 +373,7 @@ public void setPolicyViolationsSecurityTotal(int policyViolationsSecurityTotal) } public int getPolicyViolationsSecurityAudited() { - return policyViolationsSecurityAudited; + return policyViolationsSecurityAudited != null ? policyViolationsSecurityAudited : 0; } public void setPolicyViolationsSecurityAudited(int policyViolationsSecurityAudited) { @@ -381,7 +381,7 @@ public void setPolicyViolationsSecurityAudited(int policyViolationsSecurityAudit } public int getPolicyViolationsSecurityUnaudited() { - return policyViolationsSecurityUnaudited; + return policyViolationsSecurityUnaudited != null ? policyViolationsSecurityUnaudited : 0; } public void setPolicyViolationsSecurityUnaudited(int policyViolationsSecurityUnaudited) { @@ -389,7 +389,7 @@ public void setPolicyViolationsSecurityUnaudited(int policyViolationsSecurityUna } public int getPolicyViolationsLicenseTotal() { - return policyViolationsLicenseTotal; + return policyViolationsLicenseTotal != null ? policyViolationsLicenseTotal : 0; } public void setPolicyViolationsLicenseTotal(int policyViolationsLicenseTotal) { @@ -397,7 +397,7 @@ public void setPolicyViolationsLicenseTotal(int policyViolationsLicenseTotal) { } public int getPolicyViolationsLicenseAudited() { - return policyViolationsLicenseAudited; + return policyViolationsLicenseAudited != null ? policyViolationsLicenseAudited : 0; } public void setPolicyViolationsLicenseAudited(int policyViolationsLicenseAudited) { @@ -405,7 +405,7 @@ public void setPolicyViolationsLicenseAudited(int policyViolationsLicenseAudited } public int getPolicyViolationsLicenseUnaudited() { - return policyViolationsLicenseUnaudited; + return policyViolationsLicenseUnaudited != null ? policyViolationsLicenseUnaudited : 0; } public void setPolicyViolationsLicenseUnaudited(int policyViolationsLicenseUnaudited) { @@ -413,7 +413,7 @@ public void setPolicyViolationsLicenseUnaudited(int policyViolationsLicenseUnaud } public int getPolicyViolationsOperationalTotal() { - return policyViolationsOperationalTotal; + return policyViolationsOperationalTotal != null ? policyViolationsOperationalTotal : 0; } public void setPolicyViolationsOperationalTotal(int policyViolationsOperationalTotal) { @@ -421,7 +421,7 @@ public void setPolicyViolationsOperationalTotal(int policyViolationsOperationalT } public int getPolicyViolationsOperationalAudited() { - return policyViolationsOperationalAudited; + return policyViolationsOperationalAudited != null ? policyViolationsOperationalAudited : 0; } public void setPolicyViolationsOperationalAudited(int policyViolationsOperationalAudited) { @@ -429,7 +429,7 @@ public void setPolicyViolationsOperationalAudited(int policyViolationsOperationa } public int getPolicyViolationsOperationalUnaudited() { - return policyViolationsOperationalUnaudited; + return policyViolationsOperationalUnaudited != null ? policyViolationsOperationalUnaudited : 0; } public void setPolicyViolationsOperationalUnaudited(int policyViolationsOperationalUnaudited) { diff --git a/src/main/java/org/dependencytrack/model/ProjectMetrics.java b/src/main/java/org/dependencytrack/model/ProjectMetrics.java index 86706da80..2bd72b9da 100644 --- a/src/main/java/org/dependencytrack/model/ProjectMetrics.java +++ b/src/main/java/org/dependencytrack/model/ProjectMetrics.java @@ -234,7 +234,7 @@ public void setLow(int low) { } public int getUnassigned() { - return unassigned; + return unassigned != null ? unassigned : 0; } public void setUnassigned(int unassigned) { @@ -274,7 +274,7 @@ public void setSuppressed(int suppressed) { } public int getFindingsTotal() { - return findingsTotal; + return findingsTotal != null ? findingsTotal : 0; } public void setFindingsTotal(int findingsTotal) { @@ -282,7 +282,7 @@ public void setFindingsTotal(int findingsTotal) { } public int getFindingsAudited() { - return findingsAudited; + return findingsAudited != null ? findingsAudited : 0; } public void setFindingsAudited(int findingsAudited) { @@ -290,7 +290,7 @@ public void setFindingsAudited(int findingsAudited) { } public int getFindingsUnaudited() { - return findingsUnaudited; + return findingsUnaudited != null ? findingsUnaudited : 0; } public void setFindingsUnaudited(int findingsUnaudited) { @@ -306,7 +306,7 @@ public void setInheritedRiskScore(double inheritedRiskScore) { } public int getPolicyViolationsFail() { - return policyViolationsFail; + return policyViolationsFail != null ? policyViolationsFail : 0; } public void setPolicyViolationsFail(int policyViolationsFail) { @@ -314,7 +314,7 @@ public void setPolicyViolationsFail(int policyViolationsFail) { } public int getPolicyViolationsWarn() { - return policyViolationsWarn; + return policyViolationsWarn != null ? policyViolationsWarn : 0; } public void setPolicyViolationsWarn(int policyViolationsWarn) { @@ -322,7 +322,7 @@ public void setPolicyViolationsWarn(int policyViolationsWarn) { } public int getPolicyViolationsInfo() { - return policyViolationsInfo; + return policyViolationsInfo != null ? policyViolationsInfo : 0; } public void setPolicyViolationsInfo(int policyViolationsInfo) { @@ -330,7 +330,7 @@ public void setPolicyViolationsInfo(int policyViolationsInfo) { } public int getPolicyViolationsTotal() { - return policyViolationsTotal; + return policyViolationsTotal != null ? policyViolationsTotal : 0; } public void setPolicyViolationsTotal(int policyViolationsTotal) { @@ -338,7 +338,7 @@ public void setPolicyViolationsTotal(int policyViolationsTotal) { } public int getPolicyViolationsAudited() { - return policyViolationsAudited; + return policyViolationsAudited != null ? policyViolationsAudited : 0; } public void setPolicyViolationsAudited(int policyViolationsAudited) { @@ -346,7 +346,7 @@ public void setPolicyViolationsAudited(int policyViolationsAudited) { } public int getPolicyViolationsUnaudited() { - return policyViolationsUnaudited; + return policyViolationsUnaudited != null ? policyViolationsUnaudited : 0; } public void setPolicyViolationsUnaudited(int policyViolationsUnaudited) { @@ -354,7 +354,7 @@ public void setPolicyViolationsUnaudited(int policyViolationsUnaudited) { } public int getPolicyViolationsSecurityTotal() { - return policyViolationsSecurityTotal; + return policyViolationsSecurityTotal != null ? policyViolationsSecurityTotal : 0; } public void setPolicyViolationsSecurityTotal(int policyViolationsSecurityTotal) { @@ -362,7 +362,7 @@ public void setPolicyViolationsSecurityTotal(int policyViolationsSecurityTotal) } public int getPolicyViolationsSecurityAudited() { - return policyViolationsSecurityAudited; + return policyViolationsSecurityAudited != null ? policyViolationsSecurityAudited : 0; } public void setPolicyViolationsSecurityAudited(int policyViolationsSecurityAudited) { @@ -370,7 +370,7 @@ public void setPolicyViolationsSecurityAudited(int policyViolationsSecurityAudit } public int getPolicyViolationsSecurityUnaudited() { - return policyViolationsSecurityUnaudited; + return policyViolationsSecurityUnaudited != null ? policyViolationsSecurityUnaudited : 0; } public void setPolicyViolationsSecurityUnaudited(int policyViolationsSecurityUnaudited) { @@ -378,7 +378,7 @@ public void setPolicyViolationsSecurityUnaudited(int policyViolationsSecurityUna } public int getPolicyViolationsLicenseTotal() { - return policyViolationsLicenseTotal; + return policyViolationsLicenseTotal != null ? policyViolationsLicenseTotal : 0; } public void setPolicyViolationsLicenseTotal(int policyViolationsLicenseTotal) { @@ -386,7 +386,7 @@ public void setPolicyViolationsLicenseTotal(int policyViolationsLicenseTotal) { } public int getPolicyViolationsLicenseAudited() { - return policyViolationsLicenseAudited; + return policyViolationsLicenseAudited != null ? policyViolationsLicenseAudited : 0; } public void setPolicyViolationsLicenseAudited(int policyViolationsLicenseAudited) { @@ -394,7 +394,7 @@ public void setPolicyViolationsLicenseAudited(int policyViolationsLicenseAudited } public int getPolicyViolationsLicenseUnaudited() { - return policyViolationsLicenseUnaudited; + return policyViolationsLicenseUnaudited != null ? policyViolationsLicenseUnaudited : 0; } public void setPolicyViolationsLicenseUnaudited(int policyViolationsLicenseUnaudited) { @@ -402,7 +402,7 @@ public void setPolicyViolationsLicenseUnaudited(int policyViolationsLicenseUnaud } public int getPolicyViolationsOperationalTotal() { - return policyViolationsOperationalTotal; + return policyViolationsOperationalTotal != null ? policyViolationsOperationalTotal : 0; } public void setPolicyViolationsOperationalTotal(int policyViolationsOperationalTotal) { @@ -410,7 +410,7 @@ public void setPolicyViolationsOperationalTotal(int policyViolationsOperationalT } public int getPolicyViolationsOperationalAudited() { - return policyViolationsOperationalAudited; + return policyViolationsOperationalAudited != null ? policyViolationsOperationalAudited : 0; } public void setPolicyViolationsOperationalAudited(int policyViolationsOperationalAudited) { @@ -418,7 +418,7 @@ public void setPolicyViolationsOperationalAudited(int policyViolationsOperationa } public int getPolicyViolationsOperationalUnaudited() { - return policyViolationsOperationalUnaudited; + return policyViolationsOperationalUnaudited != null ? policyViolationsOperationalUnaudited : 0; } public void setPolicyViolationsOperationalUnaudited(int policyViolationsOperationalUnaudited) {