Fix issue Felix-996.
Now, 'arch -factory xxx' will display facotry description as follows:
description of xxx (1)
[empty line]
description of xxx (2)
...
Despite having several times the same factory can be weird with the configuration admin, it makes sense in some cases.
git-svn-id: https://svn.apache.org/repos/asf/felix/trunk@757684 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/ipojo/arch/src/main/java/org/apache/felix/ipojo/arch/ArchCommandImpl.java b/ipojo/arch/src/main/java/org/apache/felix/ipojo/arch/ArchCommandImpl.java
index 1af581c..4010b7d 100644
--- a/ipojo/arch/src/main/java/org/apache/felix/ipojo/arch/ArchCommandImpl.java
+++ b/ipojo/arch/src/main/java/org/apache/felix/ipojo/arch/ArchCommandImpl.java
@@ -197,13 +197,20 @@
* @param err : error print stream (if the factory is not found)
*/
private void printFactory(String name, PrintStream out, PrintStream err) {
+ boolean found = false;
for (int i = 0; i < m_factories.length; i++) {
if (m_factories[i].getName().equalsIgnoreCase(name)) {
+ // Skip a line if already found
+ if (found) {
+ out.println();
+ }
out.println(m_factories[i].getDescription());
- return;
+ found = true;
}
}
- err.println("Factory " + name + " not found");
+ if (! found) {
+ err.println("Factory " + name + " not found");
+ }
}
/**