public Bundle getBundle()

in src/main/java/org/apache/sling/launchpad/base/impl/SlingFelix.java [111:139]


    public Bundle getBundle(Class<?> clazz) {
        Method getBundleMethod = this.getBundleMethod;
        if (getBundleMethod == null) {
            Class<?> provider = Felix.class; // super class actually
            try {
                getBundleMethod = provider.getDeclaredMethod("getBundle", Class.class);
                getBundleMethod.setAccessible(true);
                this.getBundleMethod = getBundleMethod;
            } catch (Exception e) {
                throw new NoSuchMethodError("getBundle");
            }
        }

        try {
            return (Bundle) getBundleMethod.invoke(this, clazz);
        } catch (IllegalArgumentException e) {
            // we don't expect this, we checked everything
        } catch (IllegalAccessException e) {
            // we don't expect this, because we set the method accessible
        } catch (InvocationTargetException e) {
            // unpack and rethrow
            Throwable t = e.getCause();
            if (t instanceof RuntimeException) {
                throw (RuntimeException) t;
            }
        }

        return null;
    }