From c8e60d8fa72848df11478d9b60f84225f38d6c75 Mon Sep 17 00:00:00 2001 From: Chuck Bridgham Date: Mon, 15 Jul 2024 20:43:40 -0400 Subject: [PATCH] restructure,check for null --- .../kernel/KernelResolverRepository.java | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/dev/com.ibm.ws.repository.resolver/src/com/ibm/ws/repository/resolver/internal/kernel/KernelResolverRepository.java b/dev/com.ibm.ws.repository.resolver/src/com/ibm/ws/repository/resolver/internal/kernel/KernelResolverRepository.java index 47cd993efc0..f56f2a0c90d 100644 --- a/dev/com.ibm.ws.repository.resolver/src/com/ibm/ws/repository/resolver/internal/kernel/KernelResolverRepository.java +++ b/dev/com.ibm.ws.repository.resolver/src/com/ibm/ws/repository/resolver/internal/kernel/KernelResolverRepository.java @@ -21,6 +21,8 @@ import java.util.Map; import java.util.Map.Entry; +import org.osgi.framework.Version; + import com.ibm.ws.kernel.feature.Visibility; import com.ibm.ws.kernel.feature.provisioning.FeatureResource; import com.ibm.ws.kernel.feature.provisioning.ProvisioningFeatureDefinition; @@ -36,8 +38,6 @@ import com.ibm.ws.repository.resources.RepositoryResource; import com.ibm.ws.repository.resources.internal.RepositoryResourceImpl; -import junit.runner.Version; - /** * Implementation of {@link FeatureResolver.Repository} which is backed by a collection of {@link EsaResource}s. */ @@ -252,16 +252,21 @@ public ProvisioningFeatureDefinition getFeature(String featureName) { * @return List */ public List findAllPossibleVersions(ProvisioningFeatureDefinition versionlessFeature) { + ProvisioningFeatureDefinition publicFeature = null; List result = new ArrayList<>(); for (FeatureResource dependency : versionlessFeature.getConstituents(SubsystemContentType.FEATURE_TYPE)) { - result.add(getVersionedFeature(dependency.getSymbolicName())); - + publicFeature = getVersionedFeature(dependency.getSymbolicName()); + if (publicFeature != null) + result.add(publicFeature); + String baseName = getFeatureBaseName(dependency.getSymbolicName()); List tolerates = dependency.getTolerates(); if (tolerates != null) { for (String toleratedVersion : tolerates) { String featureName = baseName + toleratedVersion; - result.add(getVersionedFeature(featureName)); + publicFeature = getVersionedFeature(featureName); + if (publicFeature != null) + result.add(publicFeature); } } } @@ -286,11 +291,9 @@ private ProvisioningFeatureDefinition getVersionedFeature(String versionlessLink if (versionedFeatureDef.getVisibility() == Visibility.PUBLIC) { return versionedFeatureDef; } - result = versionedFeatureDef; - break; } } - return result; + return null; } /**