BootLog.info("Adding permissions for " + cs);
    private final void loadExtension(Extension ext) {        final String id = ext.getDeclaringPluginDescriptor().getId();        final URL url;        try {            url = new URL("plugin:" + id + "!/");            final ClassLoader cl = ext.getDeclaringPluginDescriptor()                    .getPluginClassLoader();            final CodeSource cs = new CodeSource(url, null);            final Permissions perms = new Permissions();            codeSource2Permissions.put(cs, perms);            BootLog.info("Adding permissions for " + cs);            final ConfigurationElement[] elems = ext.getConfigurationElements();            final int count = elems.length;            for (int i = 0; i < count; i++) {                final ConfigurationElement elem = elems[ i];                final String type = elem.getAttribute("class");                final String name = elem.getAttribute("name");                final String actions = elem.getAttribute("actions");                if (type != null) {                    final Object perm;                    try {                        final Class permClass = cl.loadClass(type);                        if ((name != null) && (actions != null)) {                            final Constructor c = permClass                                    .getConstructor(NAME_ACTIONS_ARGS);                            perm = c.newInstance(new Object[] { name, actions});                        } else if (name != null) {                            final Constructor c = permClass                                    .getConstructor(NAME_ARGS);                            perm = c.newInstance(new Object[] { name});                        } else {                            perm = permClass.newInstance();                        }                        final Permission p = (Permission) perm;                        perms.add(p);                    } catch (ClassNotFoundException ex) {                        BootLog                                .error("Permission class " + type                                        + " not found");                    } catch (InstantiationException ex) {                        BootLog.error("Cannot instantiate permission class "                                + type);                    } catch (IllegalAccessException ex) {                        BootLog.error("Illegal access to permission class "                                + type);                    } catch (NoSuchMethodException ex) {                        BootLog                                .error("Constructor not found on permission class "                                        + type);                    } catch (InvocationTargetException ex) {                        BootLog.error("Error constructing permission class "                                + type, ex);                    } catch (ClassCastException ex) {                        BootLog.error("Permission class " + type                                + " not instance of Permission");                    }                }            }        } catch (MalformedURLException ex) {            BootLog.error("Cannot create plugin codesource", ex);        }    }