Code example for PrivilegedActionException

Methods: getException

0
                    public Object run() throws FileNotFoundException {
                        return new FileInputStream(file);
                    } 
                }); 
        } catch (PrivilegedActionException e) {
            throw (FileNotFoundException)e.getException();
        } 
    } 
 
    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);
Stop searching for code, let great code find you!  Add Codota to your java IDE