Skip to content

Commit

Permalink
restructure,check for null
Browse files Browse the repository at this point in the history
  • Loading branch information
cbridgha committed Jul 16, 2024
1 parent eb96f63 commit c8e60d8
Showing 1 changed file with 11 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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.
*/
Expand Down Expand Up @@ -252,16 +252,21 @@ public ProvisioningFeatureDefinition getFeature(String featureName) {
* @return List<ProvisioningFeatureDefinition>
*/
public List<ProvisioningFeatureDefinition> findAllPossibleVersions(ProvisioningFeatureDefinition versionlessFeature) {
ProvisioningFeatureDefinition publicFeature = null;
List<ProvisioningFeatureDefinition> 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<String> 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);
}
}
}
Expand All @@ -286,11 +291,9 @@ private ProvisioningFeatureDefinition getVersionedFeature(String versionlessLink
if (versionedFeatureDef.getVisibility() == Visibility.PUBLIC) {
return versionedFeatureDef;
}
result = versionedFeatureDef;
break;
}
}
return result;
return null;
}

/**
Expand Down

0 comments on commit c8e60d8

Please sign in to comment.