Skip to content

Commit

Permalink
fix(moderation): fix moderation creation
Browse files Browse the repository at this point in the history
Signed-off-by: Gaurav Mishra <[email protected]>
  • Loading branch information
GMishx committed Dec 16, 2024
1 parent c8b2756 commit ce1ae55
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,10 @@ public ModerationRequest getRequest(String requestId) {
public List<ModerationRequest> getRequestByDocumentId(String documentId) {
List<ModerationRequest> requests = CommonUtils.nullToEmptyList(repository.getRequestsByDocumentId(documentId));

Collections.sort(requests, CommonUtils.compareByTimeStampDescending());
if (!requests.isEmpty()) {
// nullToEmptyList returns ImmutableList which is not sortable.
requests.sort(CommonUtils.compareByTimeStampDescending());
}

return requests;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -905,8 +905,13 @@ public Component convertToEmbeddedComponent(Component component) {
embeddedComponent.setMainLicenseIds(component.getMainLicenseIds());
embeddedComponent.setVcs(component.getVcs());
if (CommonUtils.isNotNullEmptyOrWhitespace(component.getDefaultVendorId())) {
Vendor defaultVendor = vendorService.getVendorById(component.getDefaultVendorId());
embeddedComponent.setDefaultVendor(defaultVendor);
try {
Vendor defaultVendor = vendorService.getVendorById(component.getDefaultVendorId());
embeddedComponent.setDefaultVendor(defaultVendor);
} catch (RuntimeException e) {
LOGGER.error("Failed to retrieve default vendor '{}' from SW360 database.",
component.getDefaultVendorId(), e);
}
}
embeddedComponent.setType(null);
return embeddedComponent;
Expand Down

0 comments on commit ce1ae55

Please sign in to comment.