Code example for PrivilegedActionException

Methods: getException

0
                public Object run() throws FileNotFoundException {
                    return new FileInputStream(file);
                } 
            }); 
        } catch (PrivilegedActionException e) {
            throw (FileNotFoundException)e.getException();
        } 
    } 
     
    static InputStream getResourceAsStream(final ClassLoader cl,
            final String name)
    { 
        return (InputStream)
        AccessController.doPrivileged(new PrivilegedAction() {
            public Object run() {
                InputStream ris;
                if (cl == null) {
                    ris = ClassLoader.getSystemResourceAsStream(name);
                } else { 
                    ris = cl.getResourceAsStream(name);
                }