return null;
} else {
Feature feature = versions.get(version);
if (feature == null) {
if (FeatureImpl.DEFAULT_VERSION.equals(version)) {
Version latest = new Version(cleanupVersion(version));
for (String available : versions.keySet()) {
Version availableVersion = new Version(cleanupVersion(available));
if (availableVersion.compareTo(latest) > 0) {
feature = versions.get(available);
latest = availableVersion;
}
}
} else {
Version latest = new Version(cleanupVersion(FeatureImpl.DEFAULT_VERSION));
VersionRange versionRange = new VersionRange(version, true, true);
for (String available : versions.keySet()) {
Version availableVersion = new Version(cleanupVersion(available));
if (availableVersion.compareTo(latest) > 0 && versionRange.contains(availableVersion)) {
feature = versions.get(available);
latest = availableVersion;
}
}
}