protected URL findResource()

in atomos/src/main/java/org/apache/felix/atomos/impl/modules/ModuleConnectLoader.java [135:161]


    protected URL findResource(String moduleName, String name) throws IOException
    {
        URL resource = null;
        if (this.resolvedModule.name().equals(moduleName))
        {
            try
            {
                resource = AccessController.doPrivileged(
                    (PrivilegedExceptionAction<URL>) (() -> {
                        URI rURI = this.reader.find(name).orElse(null);
                        return rURI == null ? null : rURI.toURL();
                    }));
            }
            catch (PrivilegedActionException e)
            {
                if (e.getCause() instanceof IOException)
                {
                    throw (IOException) e.getCause();
                }
                else
                {
                    throw new IOException(e);
                }
            }
        }
        return resource;
    }