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/04/23 10:39:52 UTC

svn commit: r767853 - in /felix/trunk/shell/src/main/java/org/apache/felix/shell/impl: ExportsCommandImpl.java RequirersCommandImpl.java

Author: rickhall
Date: Thu Apr 23 08:39:52 2009
New Revision: 767853

URL: http://svn.apache.org/viewvc?rev=767853&view=rev
Log:
Handle invalid bundle case properly properly in "requirers" and "exports"
commnands. (FELIX-1019)

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

Modified: felix/trunk/shell/src/main/java/org/apache/felix/shell/impl/ExportsCommandImpl.java
URL: http://svn.apache.org/viewvc/felix/trunk/shell/src/main/java/org/apache/felix/shell/impl/ExportsCommandImpl.java?rev=767853&r1=767852&r2=767853&view=diff
==============================================================================
--- felix/trunk/shell/src/main/java/org/apache/felix/shell/impl/ExportsCommandImpl.java (original)
+++ felix/trunk/shell/src/main/java/org/apache/felix/shell/impl/ExportsCommandImpl.java Thu Apr 23 08:39:52 2009
@@ -78,13 +78,20 @@
                 {
                     long l = Long.parseLong(id);
                     Bundle bundle = m_context.getBundle(l);
-                    ExportedPackage[] exports = pa.getExportedPackages(bundle);
-                    if (separatorNeeded)
+                    if (bundle != null)
                     {
-                        out.println("");
+                        ExportedPackage[] exports = pa.getExportedPackages(bundle);
+                        if (separatorNeeded)
+                        {
+                            out.println("");
+                        }
+                        printExports(out, bundle, exports);
+                        separatorNeeded = true;
+                    }
+                    else
+                    {
+                        err.println("Bundle ID " + id + " is invalid.");
                     }
-                    printExports(out, bundle, exports);
-                    separatorNeeded = true;
                 }
                 catch (NumberFormatException ex)
                 {

Modified: felix/trunk/shell/src/main/java/org/apache/felix/shell/impl/RequirersCommandImpl.java
URL: http://svn.apache.org/viewvc/felix/trunk/shell/src/main/java/org/apache/felix/shell/impl/RequirersCommandImpl.java?rev=767853&r1=767852&r2=767853&view=diff
==============================================================================
--- felix/trunk/shell/src/main/java/org/apache/felix/shell/impl/RequirersCommandImpl.java (original)
+++ felix/trunk/shell/src/main/java/org/apache/felix/shell/impl/RequirersCommandImpl.java Thu Apr 23 08:39:52 2009
@@ -78,19 +78,26 @@
                 {
                     long l = Long.parseLong(id);
                     Bundle bundle = m_context.getBundle(l);
-                    RequiredBundle[] rbs = pa.getRequiredBundles(bundle.getSymbolicName());
-                    for (int i = 0; (rbs != null) && (i < rbs.length); i++)
+                    if (bundle != null)
                     {
-                        if (rbs[i].getBundle() == bundle)
+                        RequiredBundle[] rbs = pa.getRequiredBundles(bundle.getSymbolicName());
+                        for (int i = 0; (rbs != null) && (i < rbs.length); i++)
                         {
-                            if (separatorNeeded)
+                            if (rbs[i].getBundle() == bundle)
                             {
-                                out.println("");
+                                if (separatorNeeded)
+                                {
+                                    out.println("");
+                                }
+                                printRequiredBundles(out, bundle, rbs[i].getRequiringBundles());
+                                separatorNeeded = true;
                             }
-                            printRequiredBundles(out, bundle, rbs[i].getRequiringBundles());
-                            separatorNeeded = true;
                         }
                     }
+                    else
+                    {
+                        err.println("Bundle ID " + id + " is invalid.");
+                    }
                 }
                 catch (NumberFormatException ex)
                 {