diff --git a/backend/moderation/src/main/java/org/eclipse/sw360/moderation/db/ModerationDatabaseHandler.java b/backend/moderation/src/main/java/org/eclipse/sw360/moderation/db/ModerationDatabaseHandler.java index 463d33d458..e33df14818 100644 --- a/backend/moderation/src/main/java/org/eclipse/sw360/moderation/db/ModerationDatabaseHandler.java +++ b/backend/moderation/src/main/java/org/eclipse/sw360/moderation/db/ModerationDatabaseHandler.java @@ -177,7 +177,10 @@ public ModerationRequest getRequest(String requestId) { public List getRequestByDocumentId(String documentId) { List 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; } diff --git a/rest/resource-server/src/main/java/org/eclipse/sw360/rest/resourceserver/core/RestControllerHelper.java b/rest/resource-server/src/main/java/org/eclipse/sw360/rest/resourceserver/core/RestControllerHelper.java index d4d700f4ed..18778a019a 100644 --- a/rest/resource-server/src/main/java/org/eclipse/sw360/rest/resourceserver/core/RestControllerHelper.java +++ b/rest/resource-server/src/main/java/org/eclipse/sw360/rest/resourceserver/core/RestControllerHelper.java @@ -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;