@@ -129,23 +129,16 @@ public ReportData getRiskReportData(ProjectView project, ProjectVersionView vers
129
129
HttpUrl originalVersionUrl = version .getHref ();
130
130
boolean policyFailure = false ;
131
131
for (ProjectVersionComponentVersionView projectVersionComponentView : bomEntries ) {
132
+ if (projectVersionComponentView .getIgnored ()) {
133
+ continue ;
134
+ }
132
135
String policyStatus = projectVersionComponentView .getApprovalStatus ().toString ();
133
136
if (StringUtils .isBlank (policyStatus )) {
134
- HttpUrl componentPolicyStatusURL ;
135
- if (!StringUtils .isBlank (projectVersionComponentView .getComponentVersion ())) {
136
- componentPolicyStatusURL = getComponentPolicyURL (originalVersionUrl , projectVersionComponentView .getComponentVersion ());
137
- } else {
138
- componentPolicyStatusURL = getComponentPolicyURL (originalVersionUrl , projectVersionComponentView .getComponent ());
139
- }
140
- if (!policyFailure ) {
141
- // FIXME if we could check if Black Duck has the policy module we could remove a lot of the mess
142
- try {
143
- PolicyStatusView bomPolicyStatus = blackDuckApiClient .getResponse (componentPolicyStatusURL , PolicyStatusView .class );
144
- policyStatus = bomPolicyStatus .getApprovalStatus ().toString ();
145
- } catch (IntegrationException e ) {
146
- policyFailure = true ;
147
- logger .debug ("Could not get the component policy status, the Black Duck policy module is not enabled" );
148
- }
137
+ try {
138
+ policyStatus = checkPolicyStatusIfBlank (projectVersionComponentView , policyStatus , originalVersionUrl , policyFailure );
139
+ } catch (IntegrationException e ) {
140
+ policyFailure = true ;
141
+ logger .debug ("Could not get the component policy status, the Black Duck policy module is not enabled" );
149
142
}
150
143
}
151
144
@@ -161,6 +154,21 @@ public ReportData getRiskReportData(ProjectView project, ProjectVersionView vers
161
154
return reportData ;
162
155
}
163
156
157
+ private String checkPolicyStatusIfBlank (ProjectVersionComponentVersionView projectVersionComponentView , String policyStatus , HttpUrl originalVersionUrl , boolean policyFailure ) throws IntegrationException {
158
+ HttpUrl componentPolicyStatusURL ;
159
+ if (!StringUtils .isBlank (projectVersionComponentView .getComponentVersion ())) {
160
+ componentPolicyStatusURL = getComponentPolicyURL (originalVersionUrl , projectVersionComponentView .getComponentVersion ());
161
+ } else {
162
+ componentPolicyStatusURL = getComponentPolicyURL (originalVersionUrl , projectVersionComponentView .getComponent ());
163
+ }
164
+ if (!policyFailure ) {
165
+ // FIXME if we could check if Black Duck has the policy module we could remove a lot of the mess
166
+ PolicyStatusView bomPolicyStatus = blackDuckApiClient .getResponse (componentPolicyStatusURL , PolicyStatusView .class );
167
+ policyStatus = bomPolicyStatus .getApprovalStatus ().toString ();
168
+ }
169
+ return policyStatus ;
170
+ }
171
+
164
172
private LocalDateTime getDateTimeOfLatestScanForProjectVersion (ProjectVersionView projectVersion , String projectName ) throws IntegrationException {
165
173
List <CodeLocationView > codeLocations = blackDuckApiClient .getAllResponses (projectVersion .metaCodelocationsLink ());
166
174
if (codeLocations .isEmpty ()) {
0 commit comments