private Enumeration findResourcesInBundle()

in jpa-container/src/main/java/org/apache/aries/jpa/container/parser/impl/TempBundleDelegatingClassLoader.java [149:171]


    private Enumeration<URL> findResourcesInBundle(final String resName, final Bundle inBundle) throws IOException {
        Enumeration<URL> resources = null;
        try {
            // Bundle.getResources requires privileges that the client may not
            // have but we need
            // use a doPriv so that only this bundle needs the privileges
            resources = AccessController.doPrivileged(new PrivilegedExceptionAction<Enumeration<URL>>() {
                @Override
                public Enumeration<URL> run() throws IOException {
                    return inBundle.getResources(resName);
                }
            });
        } catch (PrivilegedActionException pae) {
            // thrownException can never be a RuntimeException, as that would escape the doPriv normally
            Exception thrownException = pae.getException();
            if (thrownException instanceof IOException) {
                throw (IOException)thrownException;
            } else {
                LOG.warn("Exception during findResourcesInBundle", pae);
            }
        }
        return resources;
    }