SMX4KNL-266: features/install -i throws ArrayStoreException
git-svn-id: https://svn.apache.org/repos/asf/servicemix/smx4/kernel/trunk@767911 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/gshell/gshell-features/src/main/java/org/apache/servicemix/kernel/gshell/features/internal/FeaturesServiceImpl.java b/gshell/gshell-features/src/main/java/org/apache/servicemix/kernel/gshell/features/internal/FeaturesServiceImpl.java
index 5914efc..1c03515 100644
--- a/gshell/gshell-features/src/main/java/org/apache/servicemix/kernel/gshell/features/internal/FeaturesServiceImpl.java
+++ b/gshell/gshell-features/src/main/java/org/apache/servicemix/kernel/gshell/features/internal/FeaturesServiceImpl.java
@@ -321,7 +321,11 @@
}
public String[] listInstalledFeatures() {
- return installed.keySet().toArray(new String[installed.size()]);
+ List<String> result = new ArrayList<String>();
+ for (Feature feature : installed.keySet()) {
+ result.add(feature.getName());
+ }
+ return result.toArray(new String[result.size()]);
}
protected Feature getFeature(String name, String version) throws Exception {
diff --git a/gshell/gshell-features/src/test/java/org/apache/servicemix/kernel/gshell/features/FeaturesServiceTest.java b/gshell/gshell-features/src/test/java/org/apache/servicemix/kernel/gshell/features/FeaturesServiceTest.java
index d04745d..5909722 100644
--- a/gshell/gshell-features/src/test/java/org/apache/servicemix/kernel/gshell/features/FeaturesServiceTest.java
+++ b/gshell/gshell-features/src/test/java/org/apache/servicemix/kernel/gshell/features/FeaturesServiceTest.java
@@ -125,6 +125,10 @@
replay(preferencesService, prefs, repositoriesNode, featuresNode, bundleContext, installedBundle);
svc.installFeature("f1");
+
+ String[] installed = svc.listInstalledFeatures();
+ assertEquals(1, installed.length);
+ assertEquals("f1", installed[0]);
}
public void testUninstallFeature() throws Exception {