FileDocCategorySizeDatePackage
SecuritySupport.javaAPI DocJava SE 5 API4342Fri Aug 26 14:58:24 BST 2005javax.xml.validation

SecuritySupport

public class SecuritySupport extends Object
This class is duplicated for each JAXP subpackage so keep it in sync. It is package private and therefore is not exposed as part of the JAXP API. Security related methods that only work on J2SE 1.2 and newer.

Fields Summary
Constructors Summary
Methods Summary
booleandoesFileExist(java.io.File f)

    return ((Boolean)
            AccessController.doPrivileged(new PrivilegedAction() {
                public Object run() {
                    return new Boolean(f.exists());
                }
            })).booleanValue();
    
java.lang.ClassLoadergetContextClassLoader()

	return (ClassLoader)
		AccessController.doPrivileged(new PrivilegedAction() {
	    public Object run() {
		ClassLoader cl = null;
		try {
		    cl = Thread.currentThread().getContextClassLoader();
		} catch (SecurityException ex) { }
		return cl;
	    }
	});
    
java.io.FileInputStreamgetFileInputStream(java.io.File file)

	try {
            return (FileInputStream)
                AccessController.doPrivileged(new PrivilegedExceptionAction() {
                    public Object run() throws FileNotFoundException {
                        return new FileInputStream(file);
                    }
                });
	} catch (PrivilegedActionException e) {
	    throw (FileNotFoundException)e.getException();
	}
    
java.io.InputStreamgetResourceAsStream(java.lang.ClassLoader cl, java.lang.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);
                    }
                    return ris;
                }
            });
    
java.net.URLgetResourceAsURL(java.lang.ClassLoader cl, java.lang.String name)

        return (URL)
            AccessController.doPrivileged(new PrivilegedAction() {
                public Object run() {
                    URL url;
                    if (cl == null) {
                        url = ClassLoader.getSystemResource(name);
                    } else {
                        url = cl.getSystemResource(name);
                    }
                    return url;
                }
            });
    
java.util.EnumerationgetResources(java.lang.ClassLoader cl, java.lang.String name)

        try{
        return (Enumeration)
            AccessController.doPrivileged(new PrivilegedExceptionAction() {
                public Object run() throws IOException{
                    Enumeration enumeration;
                    if (cl == null) {
                        enumeration = ClassLoader.getSystemResources(name);
                    } else {
                        enumeration = cl.getSystemResources(name);
                    }
                    return enumeration;
                }
            });
        }catch(PrivilegedActionException e){
            throw (IOException)e.getException();
        }
    
java.lang.StringgetSystemProperty(java.lang.String propName)

	return (String)
            AccessController.doPrivileged(new PrivilegedAction() {
                public Object run() {
                    return System.getProperty(propName);
                }
            });
    
java.io.InputStreamgetURLInputStream(java.net.URL url)

	try {
            return (InputStream)
                AccessController.doPrivileged(new PrivilegedExceptionAction() {
                    public Object run() throws IOException {
                        return url.openStream();
                    }
                });
	} catch (PrivilegedActionException e) {
	    throw (IOException)e.getException();
	}