Skip to content

Commit

Permalink
Fix partial license objects being returned by /api/v1/component f…
Browse files Browse the repository at this point in the history
…or components with unresolved license (#578)
  • Loading branch information
nscuro authored Feb 15, 2024
1 parent efa9fd9 commit fc10adb
Showing 1 changed file with 13 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -217,23 +217,22 @@ public static Component mapToComponent(ComponentProjection result) {
project.setVersion(result.projectVersion);
componentPersistent.setProject(project);

var license = new License();
license.setName(result.licenseName);
if (result.licenseUuid != null) {
final var license = new License();
license.setUuid(UUID.fromString(result.licenseUuid));
license.setLicenseId(result.licenseId);
license.setName(result.licenseName);
if (result.isCustomLicense != null) {
license.setCustomLicense(result.isCustomLicense);
}
if (result.isFsfLibre != null) {
license.setFsfLibre(result.isFsfLibre);
}
if (result.isOsiApproved != null) {
license.setOsiApproved(result.isOsiApproved);
}
componentPersistent.setResolvedLicense(license);
}
if (result.isCustomLicense != null) {
license.setCustomLicense(result.isCustomLicense);
}
if (result.isFsfLibre != null) {
license.setFsfLibre(result.isFsfLibre);
}
license.setLicenseId(result.licenseId);
if (result.isOsiApproved != null) {
license.setOsiApproved(result.isOsiApproved);
}
license.setName(result.licenseName);
componentPersistent.setResolvedLicense(license);

var componentMetaInformation = new ComponentMetaInformation(result.publishedAt,
result.integrityCheckStatus != null ? IntegrityMatchStatus.valueOf(result.integrityCheckStatus) : null,
Expand Down

0 comments on commit fc10adb

Please sign in to comment.