Applied patch (FELIX-473) to fix a bug in retrieving a command's service
reference.
git-svn-id: https://svn.apache.org/repos/asf/felix/trunk@616921 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/shell/src/main/java/org/apache/felix/shell/impl/Activator.java b/shell/src/main/java/org/apache/felix/shell/impl/Activator.java
index aae9b35..056bcf7 100644
--- a/shell/src/main/java/org/apache/felix/shell/impl/Activator.java
+++ b/shell/src/main/java/org/apache/felix/shell/impl/Activator.java
@@ -225,7 +225,18 @@
public synchronized ServiceReference getCommandReference(String name)
{
- return (ServiceReference) m_commandNameMap.get(name);
+ ServiceReference ref = null;
+ Iterator itr = m_commandRefMap.entrySet().iterator();
+ while (itr.hasNext())
+ {
+ Map.Entry entry = (Map.Entry) itr.next();
+ if (((Command) entry.getValue()).getName().equals(name))
+ {
+ ref = (ServiceReference) entry.getKey();
+ break;
+ }
+ }
+ return ref;
}
public synchronized void removeCommand(ServiceReference ref)