if ((token != null) && (bundle == null)) { org.osgi.service.packageadmin.ExportedPackage pkg = packageAdmin.getExportedPackage(token);  if (pkg != null) { packages = new org.osgi.service.packageadmin.ExportedPackage[] {pkg}; } } else {
if (token != null) packages = packageAdmin.getExportedPackages(token); if (packages == null)
	public void _packages(CommandInterpreter intp) throws Exception {		org.osgi.framework.Bundle bundle = null;		String token = intp.nextArgument();		if (token != null) {			bundle = getBundleFromToken(intp, token, false);		}		org.osgi.framework.ServiceReference packageAdminRef = context.getServiceReference("org.osgi.service.packageadmin.PackageAdmin"); //$NON-NLS-1$		if (packageAdminRef != null) {			org.osgi.service.packageadmin.PackageAdmin packageAdmin = (org.osgi.service.packageadmin.PackageAdmin) context.getService(packageAdminRef);			if (packageAdmin != null) {				try {					org.osgi.service.packageadmin.ExportedPackage[] packages = null;					if ((token != null) && (bundle == null)) {						org.osgi.service.packageadmin.ExportedPackage pkg = packageAdmin.getExportedPackage(token);						if (pkg != null) {							packages = new org.osgi.service.packageadmin.ExportedPackage[] {pkg};						}					} else {						packages = packageAdmin.getExportedPackages(bundle);					}					if (packages == null) {						intp.println(ConsoleMsg.CONSOLE_NO_EXPORTED_PACKAGES_MESSAGE);					} else {						for (int i = 0; i < packages.length; i++) {							org.osgi.service.packageadmin.ExportedPackage pkg = packages[i];							intp.print(pkg);							boolean removalPending = pkg.isRemovalPending();							if (removalPending) {								intp.print("("); //$NON-NLS-1$								intp.print(ConsoleMsg.CONSOLE_REMOVAL_PENDING_MESSAGE);								intp.println(")"); //$NON-NLS-1$							}							org.osgi.framework.Bundle exporter = pkg.getExportingBundle();							if (exporter != null) {								intp.print("<"); //$NON-NLS-1$								intp.print(exporter);								intp.println(">"); //$NON-NLS-1$								org.osgi.framework.Bundle[] importers = pkg.getImportingBundles();								for (int j = 0; j < importers.length; j++) {									intp.print("  "); //$NON-NLS-1$									intp.print(importers[j]);									intp.print(" "); //$NON-NLS-1$									intp.println(ConsoleMsg.CONSOLE_IMPORTS_MESSAGE);								}							} else {								intp.print("<"); //$NON-NLS-1$								intp.print(ConsoleMsg.CONSOLE_STALE_MESSAGE);								intp.println(">"); //$NON-NLS-1$							}						}					}				} finally {					context.ungetService(packageAdminRef);				}			}		} else {			intp.println(ConsoleMsg.CONSOLE_NO_EXPORTED_PACKAGES_NO_PACKAGE_ADMIN_MESSAGE);		}	}