Forgot to create array when specifying bundle IDs. (FELIX-1151)


git-svn-id: https://svn.apache.org/repos/asf/felix/trunk@802140 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/shell/src/main/java/org/apache/felix/shell/impl/InspectCommandImpl.java b/shell/src/main/java/org/apache/felix/shell/impl/InspectCommandImpl.java
index af2fec6..25b7a52 100644
--- a/shell/src/main/java/org/apache/felix/shell/impl/InspectCommandImpl.java
+++ b/shell/src/main/java/org/apache/felix/shell/impl/InspectCommandImpl.java
@@ -88,7 +88,7 @@
                 ids[i] = st.nextToken().trim();
             }
             // Verify arguments.
-            if (validTypeAndDirection(type, direction))
+            if (isValidType(type) && isValidDirection(direction))
             {
                 // Now determine what needs to be printed.
                 if (PACKAGE_TYPE.startsWith(type))
@@ -138,7 +138,14 @@
             }
             else
             {
-                out.println("Invalid arguments.");
+                if (!isValidType(type))
+                {
+                    out.println("Invalid argument: " + type);
+                }
+                if (!isValidDirection(direction))
+                {
+                    out.println("Invalid argument: " + direction);
+                }
             }
         }
     }
@@ -161,6 +168,7 @@
             }
             else
             {
+                bundles = new Bundle[ids.length];
                 for (int idIdx = 0; idIdx < ids.length; idIdx++)
                 {
                     try
@@ -228,6 +236,7 @@
         }
         else
         {
+            bundles = new Bundle[ids.length];
             for (int idIdx = 0; idIdx < ids.length; idIdx++)
             {
                 try
@@ -322,6 +331,7 @@
             }
             else
             {
+                bundles = new Bundle[ids.length];
                 for (int idIdx = 0; idIdx < ids.length; idIdx++)
                 {
                     try
@@ -398,6 +408,7 @@
         }
         else
         {
+            bundles = new Bundle[ids.length];
             for (int idIdx = 0; idIdx < ids.length; idIdx++)
             {
                 try
@@ -489,6 +500,7 @@
             }
             else
             {
+                bundles = new Bundle[ids.length];
                 for (int idIdx = 0; idIdx < ids.length; idIdx++)
                 {
                     try
@@ -564,6 +576,7 @@
             }
             else
             {
+                bundles = new Bundle[ids.length];
                 for (int idIdx = 0; idIdx < ids.length; idIdx++)
                 {
                     try
@@ -632,6 +645,7 @@
         }
         else
         {
+            bundles = new Bundle[ids.length];
             for (int idIdx = 0; idIdx < ids.length; idIdx++)
             {
                 try
@@ -715,6 +729,7 @@
         }
         else
         {
+            bundles = new Bundle[ids.length];
             for (int idIdx = 0; idIdx < ids.length; idIdx++)
             {
                 try
@@ -808,13 +823,15 @@
         m_context.ungetService(m_ref);
     }
 
-    private boolean validTypeAndDirection(String type, String direction)
+    private static boolean isValidType(String type)
     {
-        return
-            (((PACKAGE_TYPE.startsWith(type) || BUNDLE_TYPE.startsWith(type)
-                || FRAGMENT_TYPE.startsWith(type) || SERVICE_TYPE.startsWith(type)))
-            && (CAPABILITY.startsWith(direction)
-                || REQUIREMENT.startsWith(direction)));
+        return (PACKAGE_TYPE.startsWith(type) || BUNDLE_TYPE.startsWith(type)
+            || FRAGMENT_TYPE.startsWith(type) || SERVICE_TYPE.startsWith(type));
+    }
+
+    private static boolean isValidDirection(String direction)
+    {
+        return (CAPABILITY.startsWith(direction) || REQUIREMENT.startsWith(direction));
     }
 
     private static boolean isFragment(Bundle bundle)