You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@isis.apache.org by ah...@apache.org on 2021/01/13 06:31:21 UTC
[isis] branch master updated: ISIS-2297: potential NPE
This is an automated email from the ASF dual-hosted git repository.
ahuber pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/isis.git
The following commit(s) were added to refs/heads/master by this push:
new ce9cfaa ISIS-2297: potential NPE
ce9cfaa is described below
commit ce9cfaa0b70223f36ddd6cb9bb503c2d13f19f04
Author: Andi Huber <ah...@apache.org>
AuthorDate: Wed Jan 13 07:31:06 2021 +0100
ISIS-2297: potential NPE
---
.../app/feature/ApplicationFeatureViewModel.java | 43 +++++++++++-----------
1 file changed, 21 insertions(+), 22 deletions(-)
diff --git a/extensions/security/secman/model/src/main/java/org/apache/isis/extensions/secman/model/app/feature/ApplicationFeatureViewModel.java b/extensions/security/secman/model/src/main/java/org/apache/isis/extensions/secman/model/app/feature/ApplicationFeatureViewModel.java
index c2de85d..cf27f43 100644
--- a/extensions/security/secman/model/src/main/java/org/apache/isis/extensions/secman/model/app/feature/ApplicationFeatureViewModel.java
+++ b/extensions/security/secman/model/src/main/java/org/apache/isis/extensions/secman/model/app/feature/ApplicationFeatureViewModel.java
@@ -87,18 +87,17 @@ public abstract class ApplicationFeatureViewModel implements ViewModel {
case MEMBER:
final ApplicationFeature feature = applicationFeatureRepository.findFeature(featureId);
- if(feature == null) {
- // TODO: not sure why, yet...
- return null;
- }
- switch(feature.getMemberType()) {
- case PROPERTY:
- return ApplicationClassProperty.class;
- case COLLECTION:
- return ApplicationClassCollection.class;
- case ACTION:
- return ApplicationClassAction.class;
+ if(feature != null) {
+ switch(feature.getMemberType()) {
+ case PROPERTY:
+ return ApplicationClassProperty.class;
+ case COLLECTION:
+ return ApplicationClassCollection.class;
+ case ACTION:
+ return ApplicationClassAction.class;
+ }
}
+
}
throw new IllegalArgumentException("could not determine feature type; featureId = " + featureId);
}
@@ -236,17 +235,17 @@ public abstract class ApplicationFeatureViewModel implements ViewModel {
final ApplicationFeatureId parentId;
parentId = getType() == ApplicationFeatureType.MEMBER
? getFeatureId().getParentClassId()
- : getFeatureId().getParentPackageId();
- if(parentId == null) {
- return null;
- }
- final ApplicationFeature feature = applicationFeatureRepository.findFeature(parentId);
- if (feature == null) {
- return null;
- }
- final Class<? extends ApplicationFeatureViewModel> cls =
- viewModelClassFor(parentId, applicationFeatureRepository);
- return factory.viewModel(cls, parentId.asEncodedString());
+ : getFeatureId().getParentPackageId();
+ if(parentId == null) {
+ return null;
+ }
+ final ApplicationFeature feature = applicationFeatureRepository.findFeature(parentId);
+ if (feature == null) {
+ return null;
+ }
+ final Class<? extends ApplicationFeatureViewModel> cls =
+ viewModelClassFor(parentId, applicationFeatureRepository);
+ return factory.viewModel(cls, parentId.asEncodedString());
}