NIFI-9054 Calling Nifi Registry's createExtensionBundleVersion REST endpoint will cause NullPointerException (#5309)

Co-authored-by: Robert Kalmar <rkalmar@cloudera.com>
This commit is contained in:
Róbert Kalmár 2021-08-19 15:57:17 +02:00 committed by GitHub
parent c2c3727dd5
commit 388b79d1ee
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 10 deletions

View File

@ -333,10 +333,12 @@ public class StandardExtensionService implements ExtensionService {
extensionEntity.setId(UUID.randomUUID().toString());
extensionEntity.setBundleVersionId(versionEntity.getId());
extensionEntity.getRestrictions().forEach(r -> {
r.setId(UUID.randomUUID().toString());
r.setExtensionId(extensionEntity.getId());
});
if (extensionEntity.getRestrictions() != null) {
extensionEntity.getRestrictions().forEach(r -> {
r.setId(UUID.randomUUID().toString());
r.setExtensionId(extensionEntity.getId());
});
}
extensionEntity.getProvidedServiceApis().forEach(p -> {
p.setId(UUID.randomUUID().toString());

View File

@ -210,12 +210,10 @@ public class ExtensionMappings {
entity.setProvidedServiceApis(Collections.emptySet());
}
if (extension.getRestricted() != null) {
if (extension.getRestricted().getRestrictions() != null) {
entity.setRestrictions(extension.getRestricted().getRestrictions().stream()
.map(r -> map(r))
.collect(Collectors.toSet()));
}
if (extension.getRestricted() != null && extension.getRestricted().getRestrictions() != null) {
entity.setRestrictions(extension.getRestricted().getRestrictions().stream()
.map(r -> map(r))
.collect(Collectors.toSet()));
} else {
entity.setRestrictions(Collections.emptySet());
}