/** * Perform work as a particular <code>Subject</code> after setting subject reference in current thread * * @param subject the <code>Subject</code> that the specified * <code>action</code> will run as. This parameter * may be <code>null</code>. <p> * * @param action the code to be run as the specified * <code>Subject</code>. <p> * * @return the <code>Object</code> returned by the PrivilegedAction's * <code>run</code> method. * * @exception NullPointerException if the <code>PrivilegedAction</code> * is <code>null</code>. <p> * * @exception SecurityException if the caller does not have permission * to invoke this method. */ public static Object doAs(final Subject subject1, final java.security.PrivilegedAction action) { Subject subject = subject1; if (subject == null) subject = JSSubject.getSubject(null); setSubject(subject); return Subject.doAs(subject,action); }
if (subject == null) subject = JSSubject.getSubject(null); setSubject(subject); if (subject != null) return Subject.doAs(subject,action);
if (subject == null) subject = JSSubject.getSubject(acc); setSubject(subject); if (subject != null) return Subject.doAsPrivileged(subject,action,acc);
if (s == null) s = JSSubject.getSubject(acc); setSubject(s); if (s != null) return Subject.doAsPrivileged(s,action,acc);