Skip to main content

SecurityException

java.lang.SecurityException

SecurityException is described in the javadoc comments as:

Thrown by the security manager to indicate a security violation.
author: unascribed version: 1.16, 12/19/03 see: java.lang.SecurityManager since: JDK1.0

Where is this exception thrown?

Following, is a list of exception messages cross-referenced to the source code responsible for throwing them. Click on the method link to view the code and see how the exception is thrown.

How is this exception thrown?

The following sub-sections identify where this exception is thrown, and how (or why) the code is throwing the exception.

Any source code quoted in this section is subject to the Java Research License unless stated otherwise.

java.lang.SecurityManager.checkPermission(Permission, Object)

/**
     * Throws a <code>SecurityException</code> if the
     * specified security context is denied access to the resource
     * specified by the given permission.
     * The context must be a security 
     * context returned by a previous call to 
     * <code>getSecurityContext</code> and the access control
     * decision is based upon the configured security policy for
     * that security context.
     * If <code>context</code> is an instance of 
     * <code>AccessControlContext</code> then the
     * <code>AccessControlContext.checkPermission</code> method is
     * invoked with the specified permission.
     * If <code>context</code> is not an instance of 
     * <code>AccessControlContext</code> then a
     * <code>SecurityException</code> is thrown. 
     * @param      perm      the specified permission
     * @param      context   a system-dependent security context.
     * @exception  SecurityException  if the specified security context
     *             is not an instance of <code>AccessControlContext</code>
     *             (e.g., is <code>null</code>), or is denied access to the
     *             resource specified by the given permission.
     * @exception  NullPointerException if the permission argument is
     *             <code>null</code>.
     * @see        java.lang.SecurityManager#getSecurityContext()
     * @see java.security.AccessControlContext#checkPermission(java.security.Permission) 
     * @since      1.2
     */
public void checkPermission(Permission perm, Object context) {
    if (context instanceof AccessControlContext) {
        ((AccessControlContext) context).checkPermission(perm);
    } else {
        throw new SecurityException();
    }
}

Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html

java.sql.DriverManager.deregisterDriver(Driver)

/**
     * Drops a driver from the <code>DriverManager</code>'s list.  Applets can only
     * deregister drivers from their own classloaders.
     * @param driver the JDBC Driver to drop 
     * @exception SQLException if a database access error occurs
     */
public static synchronized void deregisterDriver(Driver driver) throws SQLException {
    ClassLoader callerCL = DriverManager.getCallerClassLoader();
    println('DriverManager.deregisterDriver: ' + driver);
    int i;
    DriverInfo di = null;
    for (i = 0; i < drivers.size(); i++) {
        di = (DriverInfo) drivers.elementAt(i);
        if (di.driver == driver) {
            break;
        }
    }
    if (i >= drivers.size()) {
        println('    couldn't find driver to unload');
        return;
    }
    if (getCallerClass(callerCL, di.driverClassName) != di.driverClass) {
        throw new SecurityException();
    }
    drivers.removeElementAt(i);
}

Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html

com.sun.corba.se.impl.orbutil.ObjectStreamClassUtil_1_3._computeSerialVersionUID(Class)

private static long _computeSerialVersionUID(Class cl) {
    ByteArrayOutputStream devnull = new ByteArrayOutputStream(512);
    long h = 0;
    try {
        MessageDigest md = MessageDigest.getInstance('SHA');
        DigestOutputStream mdo = new DigestOutputStream(devnull, md);
        DataOutputStream data = new DataOutputStream(mdo);
        data.writeUTF(cl.getName());
        int classaccess = cl.getModifiers();
        classaccess &= (Modifier.PUBLIC | Modifier.FINAL | Modifier.INTERFACE | Modifier.ABSTRACT);
        Method[] method = cl.getDeclaredMethods();
        if ((classaccess & Modifier.INTERFACE) != 0) {
            classaccess &= (~Modifier.ABSTRACT);
            if (method.length > 0) {
                classaccess |= Modifier.ABSTRACT;
            }
        }
        data.writeInt(classaccess);
        if (!cl.isArray()) {
            Class interfaces[] = cl.getInterfaces();
            Arrays.sort(interfaces, compareClassByName);
            for (int i = 0; i < interfaces.length; i++) {
                data.writeUTF(interfaces[i].getName());
            }
        }
        Field[] field = cl.getDeclaredFields();
        Arrays.sort(field, compareMemberByName);
        for (int i = 0; i < field.length; i++) {
            Field f = field[i];
            int m = f.getModifiers();
            if (Modifier.isPrivate(m) && (Modifier.isTransient(m) || Modifier.isStatic(m))) continue;
            data.writeUTF(f.getName());
            data.writeInt(m);
            data.writeUTF(getSignature(f.getType()));
        }
        if (hasStaticInitializer(cl)) {
            data.writeUTF('<clinit>');
            data.writeInt(Modifier.STATIC);
            data.writeUTF('()V');
        }
        MethodSignature[] constructors = MethodSignature.removePrivateAndSort(cl.getDeclaredConstructors());
        for (int i = 0; i < constructors.length; i++) {
            MethodSignature c = constructors[i];
            String mname = '<init>';
            String desc = c.signature;
            desc = desc.replace('/', '.');
            data.writeUTF(mname);
            data.writeInt(c.member.getModifiers());
            data.writeUTF(desc);
        }
        MethodSignature[] methods = MethodSignature.removePrivateAndSort(method);
        for (int i = 0; i < methods.length; i++) {
            MethodSignature m = methods[i];
            String desc = m.signature;
            desc = desc.replace('/', '.');
            data.writeUTF(m.member.getName());
            data.writeInt(m.member.getModifiers());
            data.writeUTF(desc);
        }
        data.flush();
        byte hasharray[] = md.digest();
        for (int i = 0; i < Math.min(8, hasharray.length); i++) {
            h += (long) (hasharray[i] & 255) << (i * 8);
        }
    } catch (IOException ignore) {
        h = -1;
    } catch (NoSuchAlgorithmException complain) {
        throw new SecurityException(complain.getMessage());
    }
    return h;
}

Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html

com.sun.corba.se.impl.orbutil.ObjectStreamClassUtil_1_3.computeStructuralUID(boolean, Class)

public static long computeStructuralUID(boolean hasWriteObject, Class cl) {
    ByteArrayOutputStream devnull = new ByteArrayOutputStream(512);
    long h = 0;
    try {
        if ((!java.io.Serializable.class.isAssignableFrom(cl)) || (cl.isInterface())) {
            return 0;
        }
        if (java.io.Externalizable.class.isAssignableFrom(cl)) {
            return 1;
        }
        MessageDigest md = MessageDigest.getInstance('SHA');
        DigestOutputStream mdo = new DigestOutputStream(devnull, md);
        DataOutputStream data = new DataOutputStream(mdo);
        Class parent = cl.getSuperclass();
        if ((parent != null) && (parent != java.lang.Object.class)) {
            boolean hasWriteObjectFlag = false;
            Class[] args = { java.io.ObjectOutputStream.class };
            Method hasWriteObjectMethod = ObjectStreamClassUtil_1_3.getDeclaredMethod(parent, 'writeObject', args, Modifier.PRIVATE, Modifier.STATIC);
            if (hasWriteObjectMethod != null) hasWriteObjectFlag = true;
            data.writeLong(ObjectStreamClassUtil_1_3.computeStructuralUID(hasWriteObjectFlag, parent));
        }
        if (hasWriteObject) data.writeInt(2); else data.writeInt(1);
        Field[] field = ObjectStreamClassUtil_1_3.getDeclaredFields(cl);
        Arrays.sort(field, compareMemberByName);
        for (int i = 0; i < field.length; i++) {
            Field f = field[i];
            int m = f.getModifiers();
            if (Modifier.isTransient(m) || Modifier.isStatic(m)) continue;
            data.writeUTF(f.getName());
            data.writeUTF(getSignature(f.getType()));
        }
        data.flush();
        byte hasharray[] = md.digest();
        int minimum = Math.min(8, hasharray.length);
        for (int i = minimum; i > 0; i--) {
            h += (long) (hasharray[i] & 255) << (i * 8);
        }
    } catch (IOException ignore) {
        h = -1;
    } catch (NoSuchAlgorithmException complain) {
        throw new SecurityException(complain.getMessage());
    }
    return h;
}

Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html

com.sun.corba.se.impl.orbutil.ObjectStreamClass_1_3_1.computeStructuralUID(ObjectStreamClass_1_3_1, Class)

private static long computeStructuralUID(ObjectStreamClass_1_3_1 osc, Class cl) {
    ByteArrayOutputStream devnull = new ByteArrayOutputStream(512);
    long h = 0;
    try {
        if ((!java.io.Serializable.class.isAssignableFrom(cl)) || (cl.isInterface())) {
            return 0;
        }
        if (java.io.Externalizable.class.isAssignableFrom(cl)) {
            return 1;
        }
        MessageDigest md = MessageDigest.getInstance('SHA');
        DigestOutputStream mdo = new DigestOutputStream(devnull, md);
        DataOutputStream data = new DataOutputStream(mdo);
        Class parent = cl.getSuperclass();
        if ((parent != null)) {
            data.writeLong(computeStructuralUID(lookup(parent), parent));
        }
        if (osc.hasWriteObject()) data.writeInt(2); else data.writeInt(1);
        ObjectStreamField[] fields = osc.getFields();
        int numNonNullFields = 0;
        for (int i = 0; i < fields.length; i++) if (fields[i].getField() != null) numNonNullFields++;
        Field[] field = new java.lang.reflect.Field[numNonNullFields];
        for (int i = 0, fieldNum = 0; i < fields.length; i++) {
            if (fields[i].getField() != null) {
                field[fieldNum++] = fields[i].getField();
            }
        }
        if (field.length > 1) Arrays.sort(field, compareMemberByName);
        for (int i = 0; i < field.length; i++) {
            Field f = field[i];
            int m = f.getModifiers();
            data.writeUTF(f.getName());
            data.writeUTF(getSignature(f.getType()));
        }
        data.flush();
        byte hasharray[] = md.digest();
        for (int i = 0; i < Math.min(8, hasharray.length); i++) {
            h += (long) (hasharray[i] & 255) << (i * 8);
        }
    } catch (IOException ignore) {
        h = -1;
    } catch (NoSuchAlgorithmException complain) {
        throw new SecurityException(complain.getMessage());
    }
    return h;
}

Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html

com.sun.security.auth.login.ConfigFile.refresh()

/**
     * Refresh and reload the Configuration by re-reading all of the
     * login configurations.
     * 
     * @exception SecurityException if the caller does not have permission
     *    to refresh the Configuration.
     */
public synchronized void refresh() {
    java.lang.SecurityManager sm = System.getSecurityManager();
    if (sm != null) sm.checkPermission(new AuthPermission('refreshLoginConfiguration'));
    java.security.AccessController.doPrivileged(new java.security.PrivilegedAction() {

        public Object run() {
            try {
                init();
            } catch (java.io.IOException ioe) {
                throw new SecurityException(ioe.getLocalizedMessage());
            }
            return null;
        }
    });
}

Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html

java.awt.KeyboardFocusManager.getGlobalActiveWindow()

/**
     * Returns the active Window, even if the calling thread is in a different
     * context than the active Window. Only a Frame or a Dialog can be the
     * active Window. The native windowing system may denote the active Window
     * or its children with special decorations, such as a highlighted title
     * bar. The active Window is always either the focused Window, or the first
     * Frame or Dialog that is an owner of the focused Window.
     * This method will throw a SecurityException if this KeyboardFocusManager
     * is not the current KeyboardFocusManager for the calling thread's
     * context.
     * @return the active Window
     * @see #getActiveWindow
     * @see #setGlobalActiveWindow
     * @throws SecurityException if this KeyboardFocusManager is not the
     *         current KeyboardFocusManager for the calling thread's context
     */
protected Window getGlobalActiveWindow() throws SecurityException {
    synchronized (KeyboardFocusManager.class) {
        if (this == getCurrentKeyboardFocusManager()) {
            return activeWindow;
        } else {
            if (focusLog.isLoggable(Level.FINE)) focusLog.fine('This manager is ' + this + ', current is ' + getCurrentKeyboardFocusManager());
            throw new SecurityException(notPrivileged);
        }
    }
}

Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html

java.awt.KeyboardFocusManager.getGlobalCurrentFocusCycleRoot()

/**
     * Returns the current focus cycle root, even if the calling thread is in a
     * different context than the current focus cycle root. If the focus owner
     * is itself a focus cycle root, then it may be ambiguous as to which
     * Components represent the next and previous Components to focus during
     * normal focus traversal. In that case, the current focus cycle root is
     * used to differentiate among the possibilities.
     * This method will throw a SecurityException if this KeyboardFocusManager
     * is not the current KeyboardFocusManager for the calling thread's
     * context.
     * @return the current focus cycle root, or null if the current focus cycle
     *         root is not a member of the calling thread's context
     * @see #getCurrentFocusCycleRoot
     * @see #setGlobalCurrentFocusCycleRoot
     * @throws SecurityException if this KeyboardFocusManager is not the
     *         current KeyboardFocusManager for the calling thread's context
     */
protected Container getGlobalCurrentFocusCycleRoot() throws SecurityException {
    synchronized (KeyboardFocusManager.class) {
        if (this == getCurrentKeyboardFocusManager()) {
            return currentFocusCycleRoot;
        } else {
            if (focusLog.isLoggable(Level.FINE)) focusLog.fine('This manager is ' + this + ', current is ' + getCurrentKeyboardFocusManager());
            throw new SecurityException(notPrivileged);
        }
    }
}

Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html

java.awt.KeyboardFocusManager.getGlobalFocusOwner()

/**
     * Returns the focus owner, even if the calling thread is in a different
     * context than the focus owner. The focus owner is defined as the
     * Component in an application that will typically receive all KeyEvents
     * generated by the user. KeyEvents which map to the focus owner's focus
     * traversal keys will not be delivered if focus traversal keys are enabled
     * for the focus owner. In addition, KeyEventDispatchers may retarget or
     * consume KeyEvents before they reach the focus owner.
     * This method will throw a SecurityException if this KeyboardFocusManager
     * is not the current KeyboardFocusManager for the calling thread's
     * context.
     * @return the focus owner
     * @see #getFocusOwner
     * @see #setGlobalFocusOwner
     * @throws SecurityException if this KeyboardFocusManager is not the
     *         current KeyboardFocusManager for the calling thread's context
     */
protected Component getGlobalFocusOwner() throws SecurityException {
    synchronized (KeyboardFocusManager.class) {
        if (this == getCurrentKeyboardFocusManager()) {
            return focusOwner;
        } else {
            if (focusLog.isLoggable(Level.FINE)) focusLog.fine('This manager is ' + this + ', current is ' + getCurrentKeyboardFocusManager());
            throw new SecurityException(notPrivileged);
        }
    }
}

Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html

java.awt.KeyboardFocusManager.getGlobalFocusedWindow()

/**
     * Returns the focused Window, even if the calling thread is in a different
     * context than the focused Window. The focused Window is the Window that
     * is or contains the focus owner.
     * This method will throw a SecurityException if this KeyboardFocusManager
     * is not the current KeyboardFocusManager for the calling thread's
     * context.
     * @return the focused Window
     * @see #getFocusedWindow
     * @see #setGlobalFocusedWindow
     * @throws SecurityException if this KeyboardFocusManager is not the
     *         current KeyboardFocusManager for the calling thread's context
     */
protected Window getGlobalFocusedWindow() throws SecurityException {
    synchronized (KeyboardFocusManager.class) {
        if (this == getCurrentKeyboardFocusManager()) {
            return focusedWindow;
        } else {
            if (focusLog.isLoggable(Level.FINE)) focusLog.fine('This manager is ' + this + ', current is ' + getCurrentKeyboardFocusManager());
            throw new SecurityException(notPrivileged);
        }
    }
}

Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html

java.awt.KeyboardFocusManager.getGlobalPermanentFocusOwner()

/**
     * Returns the permanent focus owner, even if the calling thread is in a
     * different context than the permanent focus owner. The permanent focus
     * owner is defined as the last Component in an application to receive a
     * permanent FOCUS_GAINED event. The focus owner and permanent focus owner
     * are equivalent unless a temporary focus change is currently in effect.
     * In such a situation, the permanent focus owner will again be the focus
     * owner when the temporary focus change ends.
     * This method will throw a SecurityException if this KeyboardFocusManager
     * is not the current KeyboardFocusManager for the calling thread's
     * context.
     * @return the permanent focus owner
     * @see #getPermanentFocusOwner
     * @see #setGlobalPermanentFocusOwner
     * @throws SecurityException if this KeyboardFocusManager is not the
     *         current KeyboardFocusManager for the calling thread's context
     */
protected Component getGlobalPermanentFocusOwner() throws SecurityException {
    synchronized (KeyboardFocusManager.class) {
        if (this == getCurrentKeyboardFocusManager()) {
            return permanentFocusOwner;
        } else {
            if (focusLog.isLoggable(Level.FINE)) focusLog.fine('This manager is ' + this + ', current is ' + getCurrentKeyboardFocusManager());
            throw new SecurityException(notPrivileged);
        }
    }
}

Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html

java.io.ObjectStreamClass.computeDefaultSUID(Class)

/**
     * Computes the default serial version UID value for the given class.
     */
private static long computeDefaultSUID(Class cl) {
    if (!Serializable.class.isAssignableFrom(cl) || Proxy.isProxyClass(cl)) {
        return 0L;
    }
    try {
        ByteArrayOutputStream bout = new ByteArrayOutputStream();
        DataOutputStream dout = new DataOutputStream(bout);
        dout.writeUTF(cl.getName());
        int classMods = cl.getModifiers() & (Modifier.PUBLIC | Modifier.FINAL | Modifier.INTERFACE | Modifier.ABSTRACT);
        Method[] methods = cl.getDeclaredMethods();
        if ((classMods & Modifier.INTERFACE) != 0) {
            classMods = (methods.length > 0) ? (classMods | Modifier.ABSTRACT) : (classMods & ~Modifier.ABSTRACT);
        }
        dout.writeInt(classMods);
        if (!cl.isArray()) {
            Class[] interfaces = cl.getInterfaces();
            String[] ifaceNames = new String[interfaces.length];
            for (int i = 0; i < interfaces.length; i++) {
                ifaceNames[i] = interfaces[i].getName();
            }
            Arrays.sort(ifaceNames);
            for (int i = 0; i < ifaceNames.length; i++) {
                dout.writeUTF(ifaceNames[i]);
            }
        }
        Field[] fields = cl.getDeclaredFields();
        MemberSignature[] fieldSigs = new MemberSignature[fields.length];
        for (int i = 0; i < fields.length; i++) {
            fieldSigs[i] = new MemberSignature(fields[i]);
        }
        Arrays.sort(fieldSigs, new Comparator() {

            public int compare(Object o1, Object o2) {
                String name1 = ((MemberSignature) o1).name;
                String name2 = ((MemberSignature) o2).name;
                return name1.compareTo(name2);
            }
        });
        for (int i = 0; i < fieldSigs.length; i++) {
            MemberSignature sig = fieldSigs[i];
            int mods = sig.member.getModifiers() & (Modifier.PUBLIC | Modifier.PRIVATE | Modifier.PROTECTED | Modifier.STATIC | Modifier.FINAL | Modifier.VOLATILE | Modifier.TRANSIENT);
            if (((mods & Modifier.PRIVATE) == 0) || ((mods & (Modifier.STATIC | Modifier.TRANSIENT)) == 0)) {
                dout.writeUTF(sig.name);
                dout.writeInt(mods);
                dout.writeUTF(sig.signature);
            }
        }
        if (hasStaticInitializer(cl)) {
            dout.writeUTF('<clinit>');
            dout.writeInt(Modifier.STATIC);
            dout.writeUTF('()V');
        }
        Constructor[] cons = cl.getDeclaredConstructors();
        MemberSignature[] consSigs = new MemberSignature[cons.length];
        for (int i = 0; i < cons.length; i++) {
            consSigs[i] = new MemberSignature(cons[i]);
        }
        Arrays.sort(consSigs, new Comparator() {

            public int compare(Object o1, Object o2) {
                String sig1 = ((MemberSignature) o1).signature;
                String sig2 = ((MemberSignature) o2).signature;
                return sig1.compareTo(sig2);
            }
        });
        for (int i = 0; i < consSigs.length; i++) {
            MemberSignature sig = consSigs[i];
            int mods = sig.member.getModifiers() & (Modifier.PUBLIC | Modifier.PRIVATE | Modifier.PROTECTED | Modifier.STATIC | Modifier.FINAL | Modifier.SYNCHRONIZED | Modifier.NATIVE | Modifier.ABSTRACT | Modifier.STRICT);
            if ((mods & Modifier.PRIVATE) == 0) {
                dout.writeUTF('<init>');
                dout.writeInt(mods);
                dout.writeUTF(sig.signature.replace('/', '.'));
            }
        }
        MemberSignature[] methSigs = new MemberSignature[methods.length];
        for (int i = 0; i < methods.length; i++) {
            methSigs[i] = new MemberSignature(methods[i]);
        }
        Arrays.sort(methSigs, new Comparator() {

            public int compare(Object o1, Object o2) {
                MemberSignature ms1 = (MemberSignature) o1;
                MemberSignature ms2 = (MemberSignature) o2;
                int comp = ms1.name.compareTo(ms2.name);
                if (comp == 0) {
                    comp = ms1.signature.compareTo(ms2.signature);
                }
                return comp;
            }
        });
        for (int i = 0; i < methSigs.length; i++) {
            MemberSignature sig = methSigs[i];
            int mods = sig.member.getModifiers() & (Modifier.PUBLIC | Modifier.PRIVATE | Modifier.PROTECTED | Modifier.STATIC | Modifier.FINAL | Modifier.SYNCHRONIZED | Modifier.NATIVE | Modifier.ABSTRACT | Modifier.STRICT);
            if ((mods & Modifier.PRIVATE) == 0) {
                dout.writeUTF(sig.name);
                dout.writeInt(mods);
                dout.writeUTF(sig.signature.replace('/', '.'));
            }
        }
        dout.flush();
        MessageDigest md = MessageDigest.getInstance('SHA');
        byte[] hashBytes = md.digest(bout.toByteArray());
        long hash = 0;
        for (int i = Math.min(hashBytes.length, 8) - 1; i >= 0; i--) {
            hash = (hash << 8) | (hashBytes[i] & 0xFF);
        }
        return hash;
    } catch (IOException ex) {
        throw new InternalError();
    } catch (NoSuchAlgorithmException ex) {
        throw new SecurityException(ex.getMessage());
    }
}

Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html

javax.management.remote.rmi.RMIConnectionImpl.doPrivilegedOperation(int, Object[], Subject)

private Object doPrivilegedOperation(final int operation, final Object[] params, final Subject delegationSubject) throws PrivilegedActionException, IOException {
    serverCommunicatorAdmin.reqIncoming();
    try {
        final AccessControlContext reqACC;
        if (delegationSubject == null) reqACC = acc; else {
            if (subject == null) {
                final String msg = 'Subject delegation cannot be enabled unless ' + 'an authenticated subject is put in place';
                throw new SecurityException(msg);
            }
            reqACC = subjectDelegator.delegatedContext(acc, delegationSubject);
        }
        PrivilegedOperation op = new PrivilegedOperation(operation, params);
        if (reqACC == null) {
            try {
                return op.run();
            } catch (Exception e) {
                if (e instanceof RuntimeException) throw (RuntimeException) e;
                throw new PrivilegedActionException(e);
            }
        } else {
            return AccessController.doPrivileged(op, reqACC);
        }
    } catch (Error e) {
        throw new JMXServerErrorException(e.toString(), e);
    } finally {
        serverCommunicatorAdmin.rspOutgoing();
    }
}

Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html

com.sun.security.auth.PolicyFile.add(Permission)

public void add(Permission permission) {
    if (isReadOnly()) throw new SecurityException(PolicyFile.rb.getString('attempt to add a Permission to a readonly PermissionCollection'));
    if (perms == null) {
        if (additionalPerms == null) additionalPerms = new Vector();
        additionalPerms.add(permission);
    } else {
        perms.add(permission);
    }
}

Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html

javax.security.auth.Policy.getPolicyNoCheck()

/**
     * Returns the installed Policy object, skipping the security check.
     * @return the installed Policy.
     */
static Policy getPolicyNoCheck() {
    if (policy == null) {
        synchronized (Policy.class) {
            if (policy == null) {
                String policy_class = null;
                policy_class = (String) java.security.AccessController.doPrivileged(new java.security.PrivilegedAction() {

                    public Object run() {
                        return java.security.Security.getProperty('auth.policy.provider');
                    }
                });
                if (policy_class == null) {
                    policy_class = 'com.sun.security.auth.PolicyFile';
                }
                try {
                    final String finalClass = policy_class;
                    policy = (Policy) java.security.AccessController.doPrivileged(new java.security.PrivilegedExceptionAction() {

                        public Object run() throws ClassNotFoundException, InstantiationException, IllegalAccessException {
                            return Class.forName(finalClass, true, contextClassLoader).newInstance();
                        }
                    });
                } catch (Exception e) {
                    throw new SecurityException(sun.security.util.ResourcesMgr.getString('unable to instantiate Subject-based policy'));
                }
            }
        }
    }
    return policy;
}

Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html

com.sun.jmx.remote.security.MBeanServerAccessController.checkClassLoader(Object)

private void checkClassLoader(Object object) {
    if (object instanceof ClassLoader) throw new SecurityException('Access denied! Creating an ' + 'MBean that is a ClassLoader ' + 'is forbidden unless a security ' + 'manager is installed.');
}

Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html

com.sun.jmx.remote.security.MBeanServerFileAccessController.checkAccessLevel(String)

private void checkAccessLevel(String accessLevel) {
    final AccessControlContext acc = AccessController.getContext();
    final Subject s = (Subject) AccessController.doPrivileged(new PrivilegedAction() {

        public Object run() {
            return Subject.getSubject(acc);
        }
    });
    if (s == null) return;
    final Set principals = s.getPrincipals();
    for (Iterator i = principals.iterator(); i.hasNext(); ) {
        final Principal p = (Principal) i.next();
        String grantedAccessLevel;
        synchronized (props) {
            grantedAccessLevel = props.getProperty(p.getName());
        }
        if (grantedAccessLevel != null) {
            if (accessLevel.equals(READONLY) && (grantedAccessLevel.equals(READONLY) || grantedAccessLevel.equals(READWRITE))) return;
            if (accessLevel.equals(READWRITE) && grantedAccessLevel.equals(READWRITE)) return;
        }
    }
    throw new SecurityException('Access denied! Invalid access level for ' + 'requested MBeanServer operation.');
}

Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html

com.sun.jmx.remote.security.MBeanServerAccessController.checkMLetMethods(ObjectName, String)

private void checkMLetMethods(ObjectName name, String operation) throws InstanceNotFoundException {
    SecurityManager sm = System.getSecurityManager();
    if (sm != null) {
        return;
    }
    if (!operation.equals('addURL') && !operation.equals('getMBeansFromURL')) {
        return;
    }
    if (!getMBeanServer().isInstanceOf(name, 'javax.management.loading.MLet')) {
        return;
    }
    if (operation.equals('addURL')) {
        throw new SecurityException('Access denied! MLet method addURL ' + 'cannot be invoked unless a security manager is installed.');
    } else {
        final String propName = 'jmx.remote.x.mlet.allow.getMBeansFromURL';
        GetPropertyAction propAction = new GetPropertyAction(propName);
        String propValue = (String) AccessController.doPrivileged(propAction);
        boolean allowGetMBeansFromURL = 'true'.equalsIgnoreCase(propValue);
        if (!allowGetMBeansFromURL) {
            throw new SecurityException('Access denied! MLet method ' + 'getMBeansFromURL cannot be invoked unless a ' + 'security manager is installed or the system property ' + '-Djmx.remote.x.mlet.allow.getMBeansFromURL=true ' + 'is specified.');
        }
    }
}

Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html

javax.management.remote.rmi.RMIIIOPServerImpl.doNewClient(Object)

@Override
RMIConnection doNewClient(final Object credentials) throws IOException {
    if (callerACC == null) {
        throw new SecurityException('AccessControlContext cannot be null');
    }
    try {
        return AccessController.doPrivileged(new PrivilegedExceptionAction<RMIConnection>() {

            public RMIConnection run() throws IOException {
                return superDoNewClient(credentials);
            }
        }, callerACC);
    } catch (PrivilegedActionException pae) {
        throw (IOException) pae.getCause();
    }
}

Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html

java.lang.reflect.AccessibleObject.setAccessible0(AccessibleObject, boolean)

private static void setAccessible0(AccessibleObject obj, boolean flag) throws SecurityException {
    if (obj instanceof Constructor && flag == true) {
        Constructor c = (Constructor) obj;
        if (c.getDeclaringClass() == Class.class) {
            throw new SecurityException('Can not make a java.lang.Class' + ' constructor accessible');
        }
    }
    obj.override = flag;
}

Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html

java.io.Win32FileSystem.resolve(File)

public String resolve(File f) {
    String path = f.getPath();
    int pl = f.getPrefixLength();
    if ((pl == 2) && (path.charAt(0) == slash)) return path;
    if (pl == 3) return path;
    if (pl == 0) return getUserPath() + slashify(path);
    if (pl == 1) {
        String up = getUserPath();
        String ud = getDrive(up);
        if (ud != null) return ud + path;
        return up + path;
    }
    if (pl == 2) {
        String up = getUserPath();
        String ud = getDrive(up);
        if ((ud != null) && path.startsWith(ud)) return up + slashify(path.substring(2));
        char drive = path.charAt(0);
        String dir = getDriveDirectory(drive);
        String np;
        if (dir != null) {
            String p = drive + (':' + dir + slashify(path.substring(2)));
            SecurityManager security = System.getSecurityManager();
            try {
                if (security != null) security.checkRead(p);
            } catch (SecurityException x) {
                throw new SecurityException('Cannot resolve path ' + path);
            }
            return p;
        }
        return drive + ':' + slashify(path.substring(2));
    }
    throw new InternalError('Unresolvable path: ' + path);
}

Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html

java.lang.ClassLoader.check()

private void check() {
    if (!initialized) {
        throw new SecurityException('ClassLoader object not initialized');
    }
}

Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html

java.security.SecureClassLoader.check()

private void check() {
    if (!initialized) {
        throw new SecurityException('ClassLoader object not initialized');
    }
}

Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html

java.util.prefs.WindowsPreferences.openKey(byte[], int, int)

/**
     * Opens Windows registry key at a given absolute path using a given
     * security mask.
     * @param windowsAbsolutePath Windows absolute path of the
     *        key as a byte-encoded string.
     * @param mask1 Preferred Windows security mask.
     * @param mask2 Alternate Windows security mask.
     * @return Windows registry key's handle.
     * @see #openKey(int)
     * @see #openKey(int, byte[],int)
     * @see #closeKey(int)        
     */
private int openKey(byte[] windowsAbsolutePath, int mask1, int mask2) {
    if (windowsAbsolutePath.length <= MAX_WINDOWS_PATH_LENGTH + 1) {
        int[] result = WindowsRegOpenKey1(rootNativeHandle(), windowsAbsolutePath, mask1);
        if (result[ERROR_CODE] == ERROR_ACCESS_DENIED && mask2 != mask1) result = WindowsRegOpenKey1(rootNativeHandle(), windowsAbsolutePath, mask2);
        if (result[ERROR_CODE] != ERROR_SUCCESS) {
            logger().warning('Could not open windows ' + 'registry node ' + byteArrayToString(windowsAbsolutePath()) + ' at root 0x' + Integer.toHexString(rootNativeHandle()) + '. Windows RegOpenKey(...) returned error code ' + result[ERROR_CODE] + '.');
            result[NATIVE_HANDLE] = NULL_NATIVE_HANDLE;
            if (result[ERROR_CODE] == ERROR_ACCESS_DENIED) {
                throw new SecurityException('Could not open windows ' + 'registry node ' + byteArrayToString(windowsAbsolutePath()) + ' at root 0x' + Integer.toHexString(rootNativeHandle()) + ': Access denied');
            }
        }
        return result[NATIVE_HANDLE];
    } else {
        return openKey(rootNativeHandle(), windowsAbsolutePath, mask1, mask2);
    }
}

Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html

com.sun.corba.se.impl.orb.ORBSingleton.connect(org.omg.CORBA.Object)

public void connect(org.omg.CORBA.Object servant) {
    throw new SecurityException('ORBSingleton: access denied');
}

Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html

com.sun.corba.se.impl.orb.ORBSingleton.destroy()

public void destroy() {
    throw new SecurityException('ORBSingleton: access denied');
}

Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html

com.sun.corba.se.impl.orb.ORBSingleton.destroyConnections()

protected void destroyConnections() {
    throw new SecurityException('ORBSingleton: access denied');
}

Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html

com.sun.corba.se.impl.orb.ORBSingleton.disconnect(org.omg.CORBA.Object)

public void disconnect(org.omg.CORBA.Object obj) {
    throw new SecurityException('ORBSingleton: access denied');
}

Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html

com.sun.corba.se.impl.orb.ORBSingleton.getAppletCodeBase()

public URL getAppletCodeBase() {
    throw new SecurityException('ORBSingleton: access denied');
}

Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html

com.sun.corba.se.impl.orb.ORBSingleton.getAppletHost()

public String getAppletHost() {
    throw new SecurityException('ORBSingleton: access denied');
}

Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html

com.sun.corba.se.impl.orb.ORBSingleton.getCorbaTransportManager()

public CorbaTransportManager getCorbaTransportManager() {
    throw new SecurityException('ORBSingleton: access denied');
}

Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html

com.sun.corba.se.impl.orb.ORBSingleton.getFVDCodeBaseIOR()

public IOR getFVDCodeBaseIOR() {
    throw new SecurityException('ORBSingleton: access denied');
}

Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html

com.sun.corba.se.impl.orb.ORBSingleton.getHighWaterMark()

public int getHighWaterMark() {
    throw new SecurityException('ORBSingleton: access denied');
}

Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html

com.sun.corba.se.impl.orb.ORBSingleton.getLegacyServerSocketManager()

public LegacyServerSocketManager getLegacyServerSocketManager() {
    throw new SecurityException('ORBSingleton: access denied');
}

Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html

com.sun.corba.se.impl.orb.ORBSingleton.getLowWaterMark()

public int getLowWaterMark() {
    throw new SecurityException('ORBSingleton: access denied');
}

Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html

com.sun.corba.se.impl.orb.ORBSingleton.getNumberToReclaim()

public int getNumberToReclaim() {
    throw new SecurityException('ORBSingleton: access denied');
}

Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html

com.sun.corba.se.impl.orb.ORBSingleton.getORBInitialHost()

/**
     * Return the bootstrap naming host specified in the ORBInitialHost param.
     */
public String getORBInitialHost() {
    throw new SecurityException('ORBSingleton: access denied');
}

Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html

com.sun.corba.se.impl.orb.ORBSingleton.getORBInitialPort()

/**
     * Return the bootstrap naming port specified in the ORBInitialPort param.
     */
public int getORBInitialPort() {
    throw new SecurityException('ORBSingleton: access denied');
}

Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html

com.sun.corba.se.impl.orb.ORBSingleton.getORBServerHost()

public String getORBServerHost() {
    throw new SecurityException('ORBSingleton: access denied');
}

Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html

com.sun.corba.se.impl.orb.ORBSingleton.getORBServerPort()

public int getORBServerPort() {
    throw new SecurityException('ORBSingleton: access denied');
}

Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html

com.sun.corba.se.impl.orb.ORBSingleton.getServiceContextRegistry()

/**
     * Return the service context registry
     */
public ServiceContextRegistry getServiceContextRegistry() {
    throw new SecurityException('ORBSingleton: access denied');
}

Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html

com.sun.corba.se.impl.orb.ORBSingleton.getTransientServerId()

/**
     * Get the transient server ID
     */
public int getTransientServerId() {
    throw new SecurityException('ORBSingleton: access denied');
}

Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html

com.sun.corba.se.impl.orb.ORBSingleton.getTransportManager()

public TransportManager getTransportManager() {
    throw new SecurityException('ORBSingleton: access denied');
}

Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html

com.sun.corba.se.impl.orb.ORBSingleton.get_next_response()

public org.omg.CORBA.Request get_next_response() {
    throw new SecurityException('ORBSingleton: access denied');
}

Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html

com.sun.corba.se.impl.orb.ORBSingleton.lookup_value_factory(String)

public org.omg.CORBA.portable.ValueFactory lookup_value_factory(String repositoryID) {
    throw new SecurityException('ORBSingleton: access denied');
}

Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html

com.sun.corba.se.impl.orb.ORBSingleton.object_to_string(org.omg.CORBA.Object)

public String object_to_string(org.omg.CORBA.Object obj) {
    throw new SecurityException('ORBSingleton: access denied');
}

Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html

com.sun.corba.se.impl.orb.ORBSingleton.perform_work()

public void perform_work() {
    throw new SecurityException('ORBSingleton: access denied');
}

Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html

com.sun.corba.se.impl.orb.ORBSingleton.poll_next_response()

public boolean poll_next_response() {
    throw new SecurityException('ORBSingleton: access denied');
}

Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html

com.sun.corba.se.impl.orb.ORBSingleton.register_value_factory(String, org.omg.CORBA.portable.ValueFactory)

public org.omg.CORBA.portable.ValueFactory register_value_factory(String repositoryID, org.omg.CORBA.portable.ValueFactory factory) {
    throw new SecurityException('ORBSingleton: access denied');
}

Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html

com.sun.corba.se.impl.orb.ORBSingleton.run()

public void run() {
    throw new SecurityException('ORBSingleton: access denied');
}

Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html

com.sun.corba.se.impl.orb.ORBSingleton.send_multiple_requests_deferred(Request[])

public void send_multiple_requests_deferred(Request[] req) {
    throw new SecurityException('ORBSingleton: access denied');
}

Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html

com.sun.corba.se.impl.orb.ORBSingleton.send_multiple_requests_oneway(Request[])

public void send_multiple_requests_oneway(Request[] req) {
    throw new SecurityException('ORBSingleton: access denied');
}

Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html

com.sun.corba.se.impl.orb.ORBSingleton.setORBVersion(ORBVersion)

public void setORBVersion(ORBVersion verObj) {
    throw new SecurityException('ORBSingleton: access denied');
}

Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html

com.sun.corba.se.impl.orb.ORBSingleton.setObjectKeyFactory(ObjectKeyFactory)

public void setObjectKeyFactory(ObjectKeyFactory factory) {
    throw new SecurityException('ORBSingleton: access denied');
}

Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html

com.sun.corba.se.impl.orb.ORBSingleton.shutdown(boolean)

public void shutdown(boolean wait_for_completion) {
    throw new SecurityException('ORBSingleton: access denied');
}

Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html

com.sun.corba.se.impl.orb.ORBSingleton.shutdownServants(boolean)

protected void shutdownServants(boolean wait_for_completion) {
    throw new SecurityException('ORBSingleton: access denied');
}

Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html

com.sun.corba.se.impl.orb.ORBSingleton.string_to_object(String)

public org.omg.CORBA.Object string_to_object(String s) {
    throw new SecurityException('ORBSingleton: access denied');
}

Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html

com.sun.corba.se.impl.orb.ORBSingleton.string_to_remote(String)

public java.rmi.Remote string_to_remote(String s) throws java.rmi.RemoteException {
    throw new SecurityException('ORBSingleton: access denied');
}

Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html

com.sun.corba.se.impl.orb.ORBSingleton.unregister_value_factory(String)

public void unregister_value_factory(String repositoryID) {
    throw new SecurityException('ORBSingleton: access denied');
}

Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html

com.sun.corba.se.impl.orb.ORBSingleton.work_pending()

public boolean work_pending() {
    throw new SecurityException('ORBSingleton: access denied');
}

Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html

java.lang.ClassLoader.preDefineClass(String, ProtectionDomain)

private ProtectionDomain preDefineClass(String name, ProtectionDomain protectionDomain) {
    if (!checkName(name)) throw new NoClassDefFoundError('IllegalName: ' + name);
    if ((name != null) && name.startsWith('java.')) {
        throw new SecurityException('Prohibited package name: ' + name.substring(0, name.lastIndexOf('.')));
    }
    if (protectionDomain == null) {
        protectionDomain = getDefaultDomain();
    }
    if (name != null) checkCerts(name, protectionDomain.getCodeSource());
    return protectionDomain;
}

Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html

javax.management.MBeanServerPermission.add(Permission)

public synchronized void add(Permission permission) {
    if (!(permission instanceof MBeanServerPermission)) {
        final String msg = 'Permission not an MBeanServerPermission: ' + permission;
        throw new IllegalArgumentException(msg);
    }
    if (isReadOnly()) throw new SecurityException('Read-only permission collection');
    MBeanServerPermission mbsp = (MBeanServerPermission) permission;
    if (collectionPermission == null) collectionPermission = mbsp; else if (!collectionPermission.implies(permission)) {
        int newmask = collectionPermission.mask | mbsp.mask;
        collectionPermission = new MBeanServerPermission(newmask);
    }
}

Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html

com.sun.org.apache.xalan.internal.client.XSLTProcessorApplet.start()

/**
   *  Automatically called when the HTML client containing the applet loads.
   *  This method starts execution of the applet thread.
   */
public void start() {
    boolean passed = false;
    try {
        java.security.AccessController.checkPermission(new java.security.AllPermission());
    } catch (SecurityException se) {
        passed = true;
    }
    if (!passed) {
        throw new SecurityException('The XSLTProcessorApplet class must be extended and its method start() overridden.');
    }
    m_trustedAgent = new TrustedAgent();
    Thread currentThread = Thread.currentThread();
    m_trustedWorker = new Thread(currentThread.getThreadGroup(), m_trustedAgent);
    m_trustedWorker.start();
    try {
        m_tfactory = TransformerFactory.newInstance();
        this.showStatus('Causing Transformer and Parser to Load and JIT...');
        StringReader xmlbuf = new StringReader('<?xml version='1.0'?><foo/>');
        StringReader xslbuf = new StringReader('<?xml version='1.0'?><xsl:stylesheet xmlns:xsl='http://www.w3.org/1999/XSL/Transform' version='1.0'><xsl:template match='foo'><out/></xsl:template></xsl:stylesheet>');
        PrintWriter pw = new PrintWriter(new StringWriter());
        synchronized (m_tfactory) {
            Templates templates = m_tfactory.newTemplates(new StreamSource(xslbuf));
            Transformer transformer = templates.newTransformer();
            transformer.transform(new StreamSource(xmlbuf), new StreamResult(pw));
        }
        System.out.println('Primed the pump!');
        this.showStatus('Ready to go!');
    } catch (Exception e) {
        this.showStatus('Could not prime the pump!');
        System.out.println('Could not prime the pump!');
        e.printStackTrace();
    }
}

Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html

java.io.File.checkAndCreate(String, SecurityManager)

private static boolean checkAndCreate(String filename, SecurityManager sm) throws IOException {
    if (sm != null) {
        try {
            sm.checkWrite(filename);
        } catch (AccessControlException x) {
            throw new SecurityException('Unable to create temporary file');
        }
    }
    return fs.createFileExclusively(filename);
}

Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html

java.io.FilePermission.add(Permission)

/**
     * Adds a permission to the FilePermissions. The key for the hash is
     * permission.path.
     * @param permission the Permission object to add.
     * @exception IllegalArgumentException - if the permission is not a
     *                                       FilePermission 
     * @exception SecurityException - if this FilePermissionCollection object
     *                                has been marked readonly
     */
public void add(Permission permission) {
    if (!(permission instanceof FilePermission)) throw new IllegalArgumentException('invalid permission: ' + permission);
    if (isReadOnly()) throw new SecurityException('attempt to add a Permission to a readonly PermissionCollection');
    synchronized (this) {
        perms.add(permission);
    }
}

Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html

java.net.SocketPermission.add(Permission)

/**
     * Adds a permission to the SocketPermissions. The key for the hash is
     * the name in the case of wildcards, or all the IP addresses.
     * @param permission the Permission object to add.
     * @exception IllegalArgumentException - if the permission is not a
     *                                       SocketPermission
     * @exception SecurityException - if this SocketPermissionCollection object
     *                                has been marked readonly
     */
public void add(Permission permission) {
    if (!(permission instanceof SocketPermission)) throw new IllegalArgumentException('invalid permission: ' + permission);
    if (isReadOnly()) throw new SecurityException('attempt to add a Permission to a readonly PermissionCollection');
    synchronized (this) {
        perms.add(0, permission);
    }
}

Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html

java.security.AllPermission.add(Permission)

/**
     * Adds a permission to the AllPermissions. The key for the hash is
     * permission.path.
     * @param permission the Permission object to add.
     * @exception IllegalArgumentException - if the permission is not a
     *                                       AllPermission
     * @exception SecurityException - if this AllPermissionCollection object
     *                                has been marked readonly
     */
public void add(Permission permission) {
    if (!(permission instanceof AllPermission)) throw new IllegalArgumentException('invalid permission: ' + permission);
    if (isReadOnly()) throw new SecurityException('attempt to add a Permission to a readonly PermissionCollection');
    all_allowed = true;
}

Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html

java.security.BasicPermission.add(Permission)

/**
     * Adds a permission to the BasicPermissions. The key for the hash is
     * permission.path.
     * @param permission the Permission object to add.
     * @exception IllegalArgumentException - if the permission is not a
     *                                       BasicPermission, or if
     *          the permission is not of the
     *          same Class as the other
     *          permissions in this collection.
     * @exception SecurityException - if this BasicPermissionCollection object
     *                                has been marked readonly
     */
public void add(Permission permission) {
    if (!(permission instanceof BasicPermission)) throw new IllegalArgumentException('invalid permission: ' + permission);
    if (isReadOnly()) throw new SecurityException('attempt to add a Permission to a readonly PermissionCollection');
    BasicPermission bp = (BasicPermission) permission;
    if (perms.size() == 0) {
        permClass = bp.getClass();
    } else {
        if (bp.getClass() != permClass) throw new IllegalArgumentException('invalid permission: ' + permission);
    }
    synchronized (this) {
        perms.put(bp.getName(), permission);
    }
    if (!all_allowed) {
        if (bp.getName().equals('*')) all_allowed = true;
    }
}

Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html

java.util.PropertyPermission.add(Permission)

/**
     * Adds a permission to the PropertyPermissions. The key for the hash is
     * the name.
     * @param permission the Permission object to add.
     * @exception IllegalArgumentException - if the permission is not a
     *                                       PropertyPermission
     * @exception SecurityException - if this PropertyPermissionCollection
     *                                object has been marked readonly
     */
public void add(Permission permission) {
    if (!(permission instanceof PropertyPermission)) throw new IllegalArgumentException('invalid permission: ' + permission);
    if (isReadOnly()) throw new SecurityException('attempt to add a Permission to a readonly PermissionCollection');
    PropertyPermission pp = (PropertyPermission) permission;
    String propName = pp.getName();
    synchronized (this) {
        PropertyPermission existing = (PropertyPermission) perms.get(propName);
        if (existing != null) {
            int oldMask = existing.getMask();
            int newMask = pp.getMask();
            if (oldMask != newMask) {
                int effective = oldMask | newMask;
                String actions = PropertyPermission.getActions(effective);
                perms.put(propName, new PropertyPermission(propName, actions));
            }
        } else {
            perms.put(propName, permission);
        }
    }
    if (!all_allowed) {
        if (propName.equals('*')) all_allowed = true;
    }
}

Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html

javax.security.auth.kerberos.DelegationPermission.add(Permission)

/**
     * Adds a permission to the DelegationPermissions. The key for
     * the hash is the name.
     * @param permission the Permission object to add.
     * @exception IllegalArgumentException - if the permission is not a
     *                                       DelegationPermission
     * @exception SecurityException - if this PermissionCollection object
     *                                has been marked readonly
     */
public void add(Permission permission) {
    if (!(permission instanceof DelegationPermission)) throw new IllegalArgumentException('invalid permission: ' + permission);
    if (isReadOnly()) throw new SecurityException('attempt to add a Permission to a readonly PermissionCollection');
    synchronized (this) {
        perms.add(0, permission);
    }
}

Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html

javax.security.auth.kerberos.ServicePermission.add(Permission)

/**
     * Adds a permission to the ServicePermissions. The key for
     * the hash is the name.
     * @param permission the Permission object to add.
     * @exception IllegalArgumentException - if the permission is not a
     *                                       ServicePermission
     * @exception SecurityException - if this PermissionCollection object
     *                                has been marked readonly
     */
public void add(Permission permission) {
    if (!(permission instanceof ServicePermission)) throw new IllegalArgumentException('invalid permission: ' + permission);
    if (isReadOnly()) throw new SecurityException('attempt to add a Permission to a readonly PermissionCollection');
    synchronized (this) {
        perms.add(0, permission);
    }
}

Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html

java.security.Permissions.add(Permission)

/**
     * Adds a permission object to the PermissionCollection for the class the
     * permission belongs to. For example, if <i>permission</i> is a
     * FilePermission, it is added to the FilePermissionCollection stored
     * in this Permissions object. 
     * This method creates
     * a new PermissionCollection object (and adds the permission to it)
     * if an appropriate collection does not yet exist. 
     * @param permission the Permission object to add.
     * @exception SecurityException if this Permissions object is
     * marked as readonly.
     * @see PermissionCollection#isReadOnly()
     */
public void add(Permission permission) {
    if (isReadOnly()) throw new SecurityException('attempt to add a Permission to a readonly Permissions object');
    PermissionCollection pc;
    synchronized (this) {
        pc = getPermissionCollection(permission, true);
        pc.add(permission);
    }
    if (permission instanceof AllPermission) {
        allPermission = pc;
    }
    if (permission instanceof UnresolvedPermission) {
        hasUnresolved = true;
    }
}

Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html

java.lang.ClassLoader.checkCerts(String, CodeSource)

private synchronized void checkCerts(String name, CodeSource cs) {
    int i = name.lastIndexOf('.');
    String pname = (i == -1) ? '' : name.substring(0, i);
    java.security.cert.Certificate[] pcerts = (java.security.cert.Certificate[]) package2certs.get(pname);
    if (pcerts == null) {
        if (cs != null) {
            pcerts = cs.getCertificates();
        }
        if (pcerts == null) {
            if (nocerts == null) nocerts = new java.security.cert.Certificate[0];
            pcerts = nocerts;
        }
        package2certs.put(pname, pcerts);
    } else {
        java.security.cert.Certificate[] certs = null;
        if (cs != null) {
            certs = cs.getCertificates();
        }
        if (!compareCerts(pcerts, certs)) {
            throw new SecurityException('class \'' + name + '\''s signer information does not match signer information of other classes in the same package');
        }
    }
}

Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html

java.net.MulticastSocket.send(DatagramPacket, byte)

/**
     * Sends a datagram packet to the destination, with a TTL (time-
     * to-live) other than the default for the socket.  This method
     * need only be used in instances where a particular TTL is desired;
     * otherwise it is preferable to set a TTL once on the socket, and
     * use that default TTL for all packets.  This method does <B>not
     * </B> alter the default TTL for the socket. Its behavior may be
     * affected by <code>setInterface</code>.
     * If there is a security manager, this method first performs some
     * security checks. First, if <code>p.getAddress().isMulticastAddress()</code>
     * is true, this method calls the
     * security manager's <code>checkMulticast</code> method
     * with <code>p.getAddress()</code> and <code>ttl</code> as its arguments.
     * If the evaluation of that expression is false,
     * this method instead calls the security manager's 
     * <code>checkConnect</code> method with arguments
     * <code>p.getAddress().getHostAddress()</code> and
     * <code>p.getPort()</code>. Each call to a security manager method
     * could result in a SecurityException if the operation is not allowed.
     * @param p is the packet to be sent. The packet should contain
     * the destination multicast ip address and the data to be sent.
     * One does not need to be the member of the group to send
     * packets to a destination multicast address.
     * @param ttl optional time to live for multicast packet.
     * default ttl is 1.
     * @exception IOException is raised if an error occurs i.e
     * error while setting ttl.
     * @exception  SecurityException  if a security manager exists and its  
     *             <code>checkMulticast</code> or <code>checkConnect</code> 
     *             method doesn't allow the send.
     * @deprecated Use the following code or its equivalent instead:
     * ......
     * int ttl = mcastSocket.getTimeToLive();
     *  mcastSocket.setTimeToLive(newttl);
     * mcastSocket.send(p);
     * mcastSocket.setTimeToLive(ttl);
     * ......
     * @see DatagramSocket#send
     * @see DatagramSocket#receive
     * @see SecurityManager#checkMulticast(java.net.InetAddress, byte)
     * @see SecurityManager#checkConnect
     */
@Deprecated
public void send(DatagramPacket p, byte ttl) throws IOException {
    if (isClosed()) throw new SocketException('Socket is closed');
    synchronized (ttlLock) {
        synchronized (p) {
            if (connectState == ST_NOT_CONNECTED) {
                SecurityManager security = System.getSecurityManager();
                if (security != null) {
                    if (p.getAddress().isMulticastAddress()) {
                        security.checkMulticast(p.getAddress(), ttl);
                    } else {
                        security.checkConnect(p.getAddress().getHostAddress(), p.getPort());
                    }
                }
            } else {
                InetAddress packetAddress = null;
                packetAddress = p.getAddress();
                if (packetAddress == null) {
                    p.setAddress(connectedAddress);
                    p.setPort(connectedPort);
                } else if ((!packetAddress.equals(connectedAddress)) || p.getPort() != connectedPort) {
                    throw new SecurityException('connected address and packet address' + ' differ');
                }
            }
            byte dttl = getTTL();
            try {
                if (ttl != dttl) {
                    getImpl().setTTL(ttl);
                }
                getImpl().send(p);
            } finally {
                if (ttl != dttl) {
                    getImpl().setTTL(dttl);
                }
            }
        }
    }
}

Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html

java.net.URLStreamHandler.setURL(URL, String, String, int, String, String, String, String, String)

/**
     * Sets the fields of the <code>URL</code> argument to the indicated values.
     * Only classes derived from URLStreamHandler are supposed to be able
     * to call the set method on a URL.
     * @param   u         the URL to modify.
     * @param   protocol  the protocol name.
     * @param   host      the remote host value for the URL.
     * @param   port      the port on the remote machine.
     * @param   authority the authority part for the URL.
     * @param   userInfo the userInfo part of the URL.
     * @param   path      the path component of the URL. 
     * @param   query     the query part for the URL.
     * @param   ref       the reference.
     * @exception SecurityException if the protocol handler of the URL is 
     *     different from this one
     * @see     java.net.URL#set(java.lang.String, java.lang.String, int, java.lang.String, java.lang.String)
     */
protected void setURL(URL u, String protocol, String host, int port, String authority, String userInfo, String path, String query, String ref) {
    if (this != u.handler) {
        throw new SecurityException('handler for url different from ' + 'this handler');
    }
    u.set(u.getProtocol(), host, port, authority, userInfo, path, query, ref);
}

Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html

java.lang.Runtime.runFinalizersOnExit(boolean)

/**
     * Enable or disable finalization on exit; doing so specifies that the
     * finalizers of all objects that have finalizers that have not yet been
     * automatically invoked are to be run before the Java runtime exits.
     * By default, finalization on exit is disabled.
     * If there is a security manager, 
     * its <code>checkExit</code> method is first called
     * with 0 as its argument to ensure the exit is allowed. 
     * This could result in a SecurityException.
     * @param value true to enable finalization on exit, false to disable
     * @deprecated  This method is inherently unsafe.  It may result in
     *      finalizers being called on live objects while other threads are
     *      concurrently manipulating those objects, resulting in erratic
     *     behavior or deadlock.
     * @throws  SecurityException
     *        if a security manager exists and its <code>checkExit</code> 
     *        method doesn't allow the exit.
     * @see     java.lang.Runtime#exit(int)
     * @see     java.lang.Runtime#gc()
     * @see     java.lang.SecurityManager#checkExit(int)
     * @since   JDK1.1
     */
@Deprecated
public static void runFinalizersOnExit(boolean value) {
    SecurityManager security = System.getSecurityManager();
    if (security != null) {
        try {
            security.checkExit(0);
        } catch (SecurityException e) {
            throw new SecurityException('runFinalizersOnExit');
        }
    }
    Shutdown.setRunFinalizersOnExit(value);
}

Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html

java.net.URLClassLoader.defineClass(String, Resource)

private Class defineClass(String name, Resource res) throws IOException {
    int i = name.lastIndexOf('.');
    URL url = res.getCodeSourceURL();
    if (i != -1) {
        String pkgname = name.substring(0, i);
        Package pkg = getPackage(pkgname);
        Manifest man = res.getManifest();
        if (pkg != null) {
            if (pkg.isSealed()) {
                if (!pkg.isSealed(url)) {
                    throw new SecurityException('sealing violation: package ' + pkgname + ' is sealed');
                }
            } else {
                if ((man != null) && isSealed(pkgname, man)) {
                    throw new SecurityException('sealing violation: can't seal package ' + pkgname + ': already loaded');
                }
            }
        } else {
            if (man != null) {
                definePackage(pkgname, man, url);
            } else {
                definePackage(pkgname, null, null, null, null, null, null, null);
            }
        }
    }
    java.nio.ByteBuffer bb = res.getByteBuffer();
    if (bb != null) {
        CodeSigner[] signers = res.getCodeSigners();
        CodeSource cs = new CodeSource(url, signers);
        return defineClass(name, bb, cs);
    } else {
        byte[] b = res.getBytes();
        CodeSigner[] signers = res.getCodeSigners();
        CodeSource cs = new CodeSource(url, signers);
        return defineClass(name, b, 0, b.length, cs);
    }
}

Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html

Comments

Popular posts from this blog

NullPointerException

java.lang.NullPointerException NullPointerException is described in the javadoc comments as: Thrown when an application attempts to use null in a case where an object is required. These include: Calling the instance method of a null object. Accessing or modifying the field of a null object. Taking the length of null as if it were an array. Accessing or modifying the slots of null as if it were an array. Throwing null as if it were a Throwable value. Applications should throw instances of this class to indicate other illegal uses of the null object. author: unascribed version: 1.19, 12/19/03 since: JDK1.0 Where is this exception thrown? Following, is a list of exception messages cross-referenced to the source code responsible for throwing them. Click on the method link to view the code and see how the exception is thrown. The message ' java.lang.NullPointerException: ' is thrown within the method: com.sun.corba.se.impl.interceptors.ClientRequestInfoImpl.get_r

Connection refused: No available router to destination

This is a simple symptom-cause-solution blog entry only. I hope these blogs will help fellow administrators. Symptom The following exception occurs in WebLogic server logs. Most likely to occur during WebLogic server start-up, but similar exceptions may occur at other times. java.net.ConnectException: t3://myserver:8000: Destination unreachable; nested exception is: java.net.ConnectException: Connection refused: connect; No available router to destination] at weblogic.jndi.internal.ExceptionTranslator.toNamingException(ExceptionTranslator.java:49) at weblogic.jndi.WLInitialContextFactoryDelegate.toNamingException(WLInitialContextFactoryDelegate.java:773) at weblogic.jndi.WLInitialContextFactoryDelegate.getInitialContext(WLInitialContextFactoryDelegate.java:363) at weblogic.jndi.Environment.getContext(Environment.java:307) at weblogic.jndi.Environment.getContext(Environment.java:277) Cause This message (Connection refused: connect; No available

SocketException

java.net.SocketException SocketException is described in the javadoc comments as: Thrown to indicate that there is an error in the underlying protocol, such as a TCP error. author: Jonathan Payne version: 1.17, 12/19/03 since: JDK1.0 Where is this exception thrown? Following, is a list of exception messages cross-referenced to the source code responsible for throwing them. Click on the method link to view the code and see how the exception is thrown. The message ' java.net.SocketException: ... ' is thrown within the method: java.net.ServerSocket.createImpl() The message ' java.net.SocketException: ... ' is thrown within the method: java.net.Socket.createImpl(boolean) The message ' java.net.SocketException: ... ' is thrown within the method: java.net.SocksSocketImpl.connect(SocketAddress, int) The message ' java.net.SocketException: ... ' is thrown within the method: java.net.SocksSocketImpl.socksBind(InetSocketAddress) The message