final Constructor cons = cls .getConstructor(new Class[] { PluginDescriptor.class }); return (Plugin) cons.newInstance(new Object[] { this });
if (plugin != null) { return plugin; } else { final Constructor cons = cls .getConstructor(new Class[] { PluginDescriptor.class }); return (Plugin) cons.newInstance(new Object[] { this }); }
    private Plugin createPlugin() throws PluginException {        if (className == null) {            return new EmptyPlugin(this);        } else {            try {                // final Class cls =                // Thread.currentThread().getContextClassLoader().loadClass(className);                final ClassLoader cl = getPluginClassLoader();                // System.out.println("cl=" + cl.getClass().getName());                final Class cls = cl.loadClass(className);                final Constructor cons = cls                        .getConstructor(new Class[] { PluginDescriptor.class });                return (Plugin) cons.newInstance(new Object[] { this });            } catch (ClassNotFoundException ex) {                throw new PluginException(ex);            } catch (IllegalAccessException ex) {                throw new PluginException(ex);            } catch (InstantiationException ex) {                throw new PluginException(ex);            } catch (InvocationTargetException ex) {                throw new PluginException(ex.getTargetException());            } catch (NoSuchMethodException ex) {                throw new PluginException(ex);            }        }    }