You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@felix.apache.org by ri...@apache.org on 2009/08/07 20:42:38 UTC

svn commit: r802140 - /felix/trunk/shell/src/main/java/org/apache/felix/shell/impl/InspectCommandImpl.java

Author: rickhall
Date: Fri Aug  7 18:42:37 2009
New Revision: 802140

URL: http://svn.apache.org/viewvc?rev=802140&view=rev
Log:
Forgot to create array when specifying bundle IDs. (FELIX-1151)

Modified:
    felix/trunk/shell/src/main/java/org/apache/felix/shell/impl/InspectCommandImpl.java

Modified: felix/trunk/shell/src/main/java/org/apache/felix/shell/impl/InspectCommandImpl.java
URL: http://svn.apache.org/viewvc/felix/trunk/shell/src/main/java/org/apache/felix/shell/impl/InspectCommandImpl.java?rev=802140&r1=802139&r2=802140&view=diff
==============================================================================
--- felix/trunk/shell/src/main/java/org/apache/felix/shell/impl/InspectCommandImpl.java (original)
+++ felix/trunk/shell/src/main/java/org/apache/felix/shell/impl/InspectCommandImpl.java Fri Aug  7 18:42:37 2009
@@ -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));
+    }
+
+    private static boolean isValidDirection(String direction)
     {
-        return
-            (((PACKAGE_TYPE.startsWith(type) || BUNDLE_TYPE.startsWith(type)
-                || FRAGMENT_TYPE.startsWith(type) || SERVICE_TYPE.startsWith(type)))
-            && (CAPABILITY.startsWith(direction)
-                || REQUIREMENT.startsWith(direction)));
+        return (CAPABILITY.startsWith(direction) || REQUIREMENT.startsWith(direction));
     }
 
     private static boolean isFragment(Bundle bundle)