Author: ffang
Date: Thu Feb  5 11:17:39 2009
New Revision: 741077

URL: http://svn.apache.org/viewvc?rev=741077&view=rev
Log:
[SMX4KNL-176]features/install xxx' tries to install version 0.0.0 instead of 
the latest one

Modified:
    
servicemix/smx4/kernel/trunk/gshell/gshell-features/src/main/java/org/apache/servicemix/kernel/gshell/features/internal/FeaturesServiceImpl.java

Modified: 
servicemix/smx4/kernel/trunk/gshell/gshell-features/src/main/java/org/apache/servicemix/kernel/gshell/features/internal/FeaturesServiceImpl.java
URL: 
http://svn.apache.org/viewvc/servicemix/smx4/kernel/trunk/gshell/gshell-features/src/main/java/org/apache/servicemix/kernel/gshell/features/internal/FeaturesServiceImpl.java?rev=741077&r1=741076&r2=741077&view=diff
==============================================================================
--- 
servicemix/smx4/kernel/trunk/gshell/gshell-features/src/main/java/org/apache/servicemix/kernel/gshell/features/internal/FeaturesServiceImpl.java
 (original)
+++ 
servicemix/smx4/kernel/trunk/gshell/gshell-features/src/main/java/org/apache/servicemix/kernel/gshell/features/internal/FeaturesServiceImpl.java
 Thu Feb  5 11:17:39 2009
@@ -142,7 +142,17 @@
     }
 
     public void installFeature(String name) throws Exception {
-       installFeature(name, FeatureImpl.DEFAULT_VERSION);//install feature 
with default version
+       //if not specify the features version, then use the latest version
+       String latestVersion = FeatureImpl.DEFAULT_VERSION;
+       Set<String> allVersions = getFeatures().get(name).keySet();
+       for (String version : allVersions) {
+               Version verlatest = new Version(latestVersion.replace('-', 
'.'));
+               Version ver = new Version(version.replace('-', '.'));
+               if (verlatest.compareTo(ver) < 0) {
+                       latestVersion = version;
+               }
+       }
+       installFeature(name, latestVersion);
     }
 
     public void installFeature(String name, String version) throws Exception {


Reply via email to