FileDocCategorySizeDatePackage
SecuritySupport.javaAPI DocJava SE 5 API5398Fri Aug 26 14:55:56 BST 2005com.sun.org.apache.xerces.internal.xinclude

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. Base class with security related methods that work on JDK 1.1.

Fields Summary
private static final Object
securitySupport
Constructors Summary
Methods Summary
java.lang.ClassLoadergetContextClassLoader()

	return null;
    
booleangetFileExists(java.io.File f)

        return f.exists();
    
java.io.FileInputStreamgetFileInputStream(java.io.File file)

        return new FileInputStream(file);
    
static com.sun.org.apache.xerces.internal.xinclude.SecuritySupportgetInstance()
Return an appropriate instance of this class, depending on whether we're on a JDK 1.1 or J2SE 1.2 (or later) system.

	SecuritySupport ss = null;
	try {
	    Class c = Class.forName("java.security.AccessController");
	    // if that worked, we're on 1.2.
	    /*
	    // don't reference the class explicitly so it doesn't
	    // get dragged in accidentally.
	    c = Class.forName("javax.mail.SecuritySupport12");
	    Constructor cons = c.getConstructor(new Class[] { });
	    ss = (SecuritySupport)cons.newInstance(new Object[] { });
	    */
	    /*
	     * Unfortunately, we can't load the class using reflection
	     * because the class is package private.  And the class has
	     * to be package private so the APIs aren't exposed to other
	     * code that could use them to circumvent security.  Thus,
	     * we accept the risk that the direct reference might fail
	     * on some JDK 1.1 JVMs, even though we would never execute
	     * this code in such a case.  Sigh...
	     */
	    ss = new SecuritySupport12();
	} catch (Exception ex) {
	    // ignore it
	} finally {
	    if (ss == null)
		ss = new SecuritySupport();
	    securitySupport = ss;
	}
    
	return (SecuritySupport)securitySupport;
    
longgetLastModified(java.io.File f)

        return f.lastModified();
    
java.lang.ClassLoadergetParentClassLoader(java.lang.ClassLoader cl)

        return null;
    
java.io.InputStreamgetResourceAsStream(java.lang.ClassLoader cl, java.lang.String name)

        InputStream ris;
        if (cl == null) {
            ris = ClassLoader.getSystemResourceAsStream(name);
        } else {
            ris = cl.getResourceAsStream(name);
        }
        return ris;
    
java.lang.ClassLoadergetSystemClassLoader()

        return null;
    
java.lang.StringgetSystemProperty(java.lang.String propName)

        return System.getProperty(propName);