java.rmi.AccessException Java Examples

The following examples show how to use java.rmi.AccessException. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: NonLocalRegistryTest.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Check the exception chain for the expected AccessException and message.
 * @param ex the exception from the remote invocation.
 */
private static void assertIsAccessException(Throwable ex) {
    Throwable t = ex;
    while (!(t instanceof AccessException) && t.getCause() != null) {
        t = t.getCause();
    }
    if (t instanceof AccessException) {
        String msg = t.getMessage();
        int asIndex = msg.indexOf("Registry");
        int rrIndex = msg.indexOf("Registry.Registry");     // Obsolete error text
        int disallowIndex = msg.indexOf("disallowed");
        int nonLocalHostIndex = msg.indexOf("non-local host");
        if (asIndex < 0 ||
                rrIndex != -1 ||
                disallowIndex < 0 ||
                nonLocalHostIndex < 0 ) {
            throw new RuntimeException("exception message is malformed", t);
        }
        System.out.printf("Found expected AccessException: %s%n%n", t);
    } else {
        throw new RuntimeException("AccessException did not occur when expected", ex);
    }
}
 
Example #2
Source File: NonLocalActivationTest.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Check the exception chain for the expected AccessException and message.
 * @param ex the exception from the remote invocation.
 */
private static void assertIsAccessException(Exception ex, String msg1) {
    Throwable t = ex;
    System.out.println();
    while (!(t instanceof AccessException) && t.getCause() != null) {
        t = t.getCause();
    }
    if (t instanceof AccessException) {
        String msg = t.getMessage();
        int asIndex = msg.indexOf(msg1);
        int disallowIndex = msg.indexOf("disallowed");
        int nonLocalHostIndex = msg.indexOf("non-local host");
        if (asIndex < 0 ||
                disallowIndex < 0 ||
                nonLocalHostIndex < 0 ) {
            throw new RuntimeException("exception message is malformed", t);
        }
        System.out.printf("Found expected AccessException: %s%n", t);
    } else {
        throw new RuntimeException("AccessException did not occur", ex);
    }
}
 
Example #3
Source File: Activation.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Shutdown the activation system. Destroys all groups spawned by
 * the activation daemon and exits the activation daemon.
 */
public void shutdown() throws AccessException {
    // RegistryImpl.checkAccess() is done in the SameHostOnlyServerRef
    // during unmarshallCustomData and is not applicable to local access.

    Object lock = startupLock;
    if (lock != null) {
        synchronized (lock) {
            // nothing
        }
    }

    synchronized (Activation.this) {
        if (!shuttingDown) {
            shuttingDown = true;
            (new Shutdown()).start();
        }
    }
}
 
Example #4
Source File: NonLocalJMXRemoteTest.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Check the exception chain for the expected AccessException and message.
 * @param ex the exception from the remote invocation.
 */
private static void assertIsAccessException(Throwable ex) {
    Throwable t = ex;
    while (!(t instanceof AccessException) && t.getCause() != null) {
        t = t.getCause();
    }
    if (t instanceof AccessException) {
        String msg = t.getMessage();
        int asIndex = msg.indexOf("Registry");
        int disallowIndex = msg.indexOf("disallowed");
        int nonLocalHostIndex = msg.indexOf("non-local host");
        if (asIndex < 0 ||
                disallowIndex < 0 ||
                nonLocalHostIndex < 0 ) {
            System.out.println("Exception message is " + msg);
            throw new RuntimeException("exception message is malformed", t);
        }
        System.out.printf("Found expected AccessException: %s%n%n", t);
    } else {
        throw new RuntimeException("AccessException did not occur when expected", ex);
    }
}
 
Example #5
Source File: Activation.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Shutdown the activation system. Destroys all groups spawned by
 * the activation daemon and exits the activation daemon.
 */
public void shutdown() throws AccessException {
    // RegistryImpl.checkAccess() is done in the SameHostOnlyServerRef
    // during unmarshallCustomData and is not applicable to local access.

    Object lock = startupLock;
    if (lock != null) {
        synchronized (lock) {
            // nothing
        }
    }

    synchronized (Activation.this) {
        if (!shuttingDown) {
            shuttingDown = true;
            (new Shutdown()).start();
        }
    }
}
 
Example #6
Source File: NonLocalActivationTest.java    From dragonwell8_jdk with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Check the exception chain for the expected AccessException and message.
 * @param ex the exception from the remote invocation.
 */
private static void assertIsAccessException(Exception ex, String msg1) {
    Throwable t = ex;
    System.out.println();
    while (!(t instanceof AccessException) && t.getCause() != null) {
        t = t.getCause();
    }
    if (t instanceof AccessException) {
        String msg = t.getMessage();
        int asIndex = msg.indexOf(msg1);
        int disallowIndex = msg.indexOf("disallowed");
        int nonLocalHostIndex = msg.indexOf("non-local host");
        if (asIndex < 0 ||
                disallowIndex < 0 ||
                nonLocalHostIndex < 0 ) {
            throw new RuntimeException("exception message is malformed", t);
        }
        System.out.printf("Found expected AccessException: %s%n", t);
    } else {
        throw new RuntimeException("AccessException did not occur", ex);
    }
}
 
Example #7
Source File: Activation.java    From dragonwell8_jdk with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Shutdown the activation system. Destroys all groups spawned by
 * the activation daemon and exits the activation daemon.
 */
public void shutdown() throws AccessException {
    // RegistryImpl.checkAccess() is done in the SameHostOnlyServerRef
    // during unmarshallCustomData and is not applicable to local access.

    Object lock = startupLock;
    if (lock != null) {
        synchronized (lock) {
            // nothing
        }
    }

    synchronized (Activation.this) {
        if (!shuttingDown) {
            shuttingDown = true;
            (new Shutdown()).start();
        }
    }
}
 
Example #8
Source File: NonLocalRegistryTest.java    From dragonwell8_jdk with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Check the exception chain for the expected AccessException and message.
 * @param ex the exception from the remote invocation.
 */
private static void assertIsAccessException(Throwable ex) {
    Throwable t = ex;
    while (!(t instanceof AccessException) && t.getCause() != null) {
        t = t.getCause();
    }
    if (t instanceof AccessException) {
        String msg = t.getMessage();
        int asIndex = msg.indexOf("Registry");
        int rrIndex = msg.indexOf("Registry.Registry");     // Obsolete error text
        int disallowIndex = msg.indexOf("disallowed");
        int nonLocalHostIndex = msg.indexOf("non-local host");
        if (asIndex < 0 ||
                rrIndex != -1 ||
                disallowIndex < 0 ||
                nonLocalHostIndex < 0 ) {
            throw new RuntimeException("exception message is malformed", t);
        }
        System.out.printf("Found expected AccessException: %s%n%n", t);
    } else {
        throw new RuntimeException("AccessException did not occur when expected", ex);
    }
}
 
Example #9
Source File: NonLocalJMXRemoteTest.java    From dragonwell8_jdk with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Check the exception chain for the expected AccessException and message.
 * @param ex the exception from the remote invocation.
 */
private static void assertIsAccessException(Throwable ex) {
    Throwable t = ex;
    while (!(t instanceof AccessException) && t.getCause() != null) {
        t = t.getCause();
    }
    if (t instanceof AccessException) {
        String msg = t.getMessage();
        int asIndex = msg.indexOf("Registry");
        int disallowIndex = msg.indexOf("disallowed");
        int nonLocalHostIndex = msg.indexOf("non-local host");
        if (asIndex < 0 ||
                disallowIndex < 0 ||
                nonLocalHostIndex < 0 ) {
            System.out.println("Exception message is " + msg);
            throw new RuntimeException("exception message is malformed", t);
        }
        System.out.printf("Found expected AccessException: %s%n%n", t);
    } else {
        throw new RuntimeException("AccessException did not occur when expected", ex);
    }
}
 
Example #10
Source File: NonLocalJMXRemoteTest.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Check the exception chain for the expected AccessException and message.
 * @param ex the exception from the remote invocation.
 */
private static void assertIsAccessException(Throwable ex) {
    Throwable t = ex;
    while (!(t instanceof AccessException) && t.getCause() != null) {
        t = t.getCause();
    }
    if (t instanceof AccessException) {
        String msg = t.getMessage();
        int asIndex = msg.indexOf("Registry");
        int disallowIndex = msg.indexOf("disallowed");
        int nonLocalHostIndex = msg.indexOf("non-local host");
        if (asIndex < 0 ||
                disallowIndex < 0 ||
                nonLocalHostIndex < 0 ) {
            throw new RuntimeException("exception message is malformed", t);
        }
        System.out.printf("Found expected AccessException: %s%n%n", t);
    } else {
        throw new RuntimeException("AccessException did not occur when expected", ex);
    }
}
 
Example #11
Source File: NonLocalActivationTest.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Check the exception chain for the expected AccessException and message.
 * @param ex the exception from the remote invocation.
 */
private static void assertIsAccessException(Exception ex, String msg1) {
    Throwable t = ex;
    System.out.println();
    while (!(t instanceof AccessException) && t.getCause() != null) {
        t = t.getCause();
    }
    if (t instanceof AccessException) {
        String msg = t.getMessage();
        int asIndex = msg.indexOf(msg1);
        int disallowIndex = msg.indexOf("disallowed");
        int nonLocalHostIndex = msg.indexOf("non-local host");
        if (asIndex < 0 ||
                disallowIndex < 0 ||
                nonLocalHostIndex < 0 ) {
            throw new RuntimeException("exception message is malformed", t);
        }
        System.out.printf("Found expected AccessException: %s%n", t);
    } else {
        throw new RuntimeException("AccessException did not occur", ex);
    }
}
 
Example #12
Source File: Activation.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Shutdown the activation system. Destroys all groups spawned by
 * the activation daemon and exits the activation daemon.
 */
public void shutdown() throws AccessException {
    // RegistryImpl.checkAccess() is done in the SameHostOnlyServerRef
    // during unmarshallCustomData and is not applicable to local access.

    Object lock = startupLock;
    if (lock != null) {
        synchronized (lock) {
            // nothing
        }
    }

    synchronized (Activation.this) {
        if (!shuttingDown) {
            shuttingDown = true;
            (new Shutdown()).start();
        }
    }
}
 
Example #13
Source File: Activation.java    From jdk8u60 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Shutdown the activation system. Destroys all groups spawned by
 * the activation daemon and exits the activation daemon.
 */
public void shutdown() throws AccessException {
    RegistryImpl.checkAccess("ActivationSystem.shutdown");

    Object lock = startupLock;
    if (lock != null) {
        synchronized (lock) {
            // nothing
        }
    }

    synchronized (Activation.this) {
        if (!shuttingDown) {
            shuttingDown = true;
            (new Shutdown()).start();
        }
    }
}
 
Example #14
Source File: NonLocalActivationTest.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Check the exception chain for the expected AccessException and message.
 * @param ex the exception from the remote invocation.
 */
private static void assertIsAccessException(Exception ex, String msg1) {
    Throwable t = ex;
    System.out.println();
    while (!(t instanceof AccessException) && t.getCause() != null) {
        t = t.getCause();
    }
    if (t instanceof AccessException) {
        String msg = t.getMessage();
        int asIndex = msg.indexOf(msg1);
        int disallowIndex = msg.indexOf("disallowed");
        int nonLocalHostIndex = msg.indexOf("non-local host");
        if (asIndex < 0 ||
                disallowIndex < 0 ||
                nonLocalHostIndex < 0 ) {
            throw new RuntimeException("exception message is malformed", t);
        }
        System.out.printf("Found expected AccessException: %s%n", t);
    } else {
        throw new RuntimeException("AccessException did not occur", ex);
    }
}
 
Example #15
Source File: NonLocalRegistryTest.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Check the exception chain for the expected AccessException and message.
 * @param ex the exception from the remote invocation.
 */
private static void assertIsAccessException(Throwable ex) {
    Throwable t = ex;
    while (!(t instanceof AccessException) && t.getCause() != null) {
        t = t.getCause();
    }
    if (t instanceof AccessException) {
        String msg = t.getMessage();
        int asIndex = msg.indexOf("Registry");
        int rrIndex = msg.indexOf("Registry.Registry");     // Obsolete error text
        int disallowIndex = msg.indexOf("disallowed");
        int nonLocalHostIndex = msg.indexOf("non-local host");
        if (asIndex < 0 ||
                rrIndex != -1 ||
                disallowIndex < 0 ||
                nonLocalHostIndex < 0 ) {
            throw new RuntimeException("exception message is malformed", t);
        }
        System.out.printf("Found expected AccessException: %s%n%n", t);
    } else {
        throw new RuntimeException("AccessException did not occur when expected", ex);
    }
}
 
Example #16
Source File: NonLocalJMXRemoteTest.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Check the exception chain for the expected AccessException and message.
 * @param ex the exception from the remote invocation.
 */
private static void assertIsAccessException(Throwable ex) {
    Throwable t = ex;
    while (!(t instanceof AccessException) && t.getCause() != null) {
        t = t.getCause();
    }
    if (t instanceof AccessException) {
        String msg = t.getMessage();
        int asIndex = msg.indexOf("Registry");
        int disallowIndex = msg.indexOf("disallowed");
        int nonLocalHostIndex = msg.indexOf("non-local host");
        if (asIndex < 0 ||
                disallowIndex < 0 ||
                nonLocalHostIndex < 0 ) {
            System.out.println("Exception message is " + msg);
            throw new RuntimeException("exception message is malformed", t);
        }
        System.out.printf("Found expected AccessException: %s%n%n", t);
    } else {
        throw new RuntimeException("AccessException did not occur when expected", ex);
    }
}
 
Example #17
Source File: Activation.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Shutdown the activation system. Destroys all groups spawned by
 * the activation daemon and exits the activation daemon.
 */
public void shutdown() throws AccessException {
    // RegistryImpl.checkAccess() is done in the SameHostOnlyServerRef
    // during unmarshallCustomData and is not applicable to local access.

    Object lock = startupLock;
    if (lock != null) {
        synchronized (lock) {
            // nothing
        }
    }

    synchronized (Activation.this) {
        if (!shuttingDown) {
            shuttingDown = true;
            (new Shutdown()).start();
        }
    }
}
 
Example #18
Source File: Activation.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
public void bind(String name, Remote obj)
    throws RemoteException, AlreadyBoundException, AccessException
{
    if (name.equals(NAME)) {
        throw new AccessException(
            "binding ActivationSystem is disallowed");
    } else {
        super.bind(name, obj);
    }
}
 
Example #19
Source File: Activation.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
public void rebind(String name, Remote obj)
    throws RemoteException, AccessException
{
    if (name.equals(NAME)) {
        throw new AccessException(
            "binding ActivationSystem is disallowed");
    } else {
        RegistryImpl.checkAccess("ActivationSystem.rebind");
        super.rebind(name, obj);
    }
}
 
Example #20
Source File: Activation.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
public void rebind(String name, Remote obj)
    throws RemoteException, AccessException
{
    if (name.equals(NAME)) {
        throw new AccessException(
            "binding ActivationSystem is disallowed");
    } else {
        super.rebind(name, obj);
    }
}
 
Example #21
Source File: Activation.java    From dragonwell8_jdk with GNU General Public License v2.0 5 votes vote down vote up
public void unbind(String name)
    throws RemoteException, NotBoundException, AccessException
{
    if (name.equals(NAME)) {
        throw new AccessException(
            "unbinding ActivationSystem is disallowed");
    } else {
        RegistryImpl.checkAccess("ActivationSystem.unbind");
        super.unbind(name);
    }
}
 
Example #22
Source File: Activation.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
public void rebind(String name, Remote obj)
    throws RemoteException, AccessException
{
    if (name.equals(NAME)) {
        throw new AccessException(
            "binding ActivationSystem is disallowed");
    } else {
        RegistryImpl.checkAccess("ActivationSystem.rebind");
        super.rebind(name, obj);
    }
}
 
Example #23
Source File: Activation.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
public void unbind(String name)
    throws RemoteException, NotBoundException, AccessException
{
    if (name.equals(NAME)) {
        throw new AccessException(
            "unbinding ActivationSystem is disallowed");
    } else {
        super.unbind(name);
    }
}
 
Example #24
Source File: Activation.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
public void rebind(String name, Remote obj)
    throws RemoteException, AccessException
{
    if (name.equals(NAME)) {
        throw new AccessException(
            "binding ActivationSystem is disallowed");
    } else {
        super.rebind(name, obj);
    }
}
 
Example #25
Source File: Activation.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
public void rebind(String name, Remote obj)
    throws RemoteException, AccessException
{
    if (name.equals(NAME)) {
        throw new AccessException(
            "binding ActivationSystem is disallowed");
    } else {
        RegistryImpl.checkAccess("ActivationSystem.rebind");
        super.rebind(name, obj);
    }
}
 
Example #26
Source File: Activation.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
public void bind(String name, Remote obj)
    throws RemoteException, AlreadyBoundException, AccessException
{
    if (name.equals(NAME)) {
        throw new AccessException(
            "binding ActivationSystem is disallowed");
    } else {
        RegistryImpl.checkAccess("ActivationSystem.bind");
        super.bind(name, obj);
    }
}
 
Example #27
Source File: Activation.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
public void unbind(String name)
    throws RemoteException, NotBoundException, AccessException
{
    if (name.equals(NAME)) {
        throw new AccessException(
            "unbinding ActivationSystem is disallowed");
    } else {
        RegistryImpl.checkAccess("ActivationSystem.unbind");
        super.unbind(name);
    }
}
 
Example #28
Source File: Activation.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
public void bind(String name, Remote obj)
    throws RemoteException, AlreadyBoundException, AccessException
{
    if (name.equals(NAME)) {
        throw new AccessException(
            "binding ActivationSystem is disallowed");
    } else {
        RegistryImpl.checkAccess("ActivationSystem.bind");
        super.bind(name, obj);
    }
}
 
Example #29
Source File: Activation.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
public void unbind(String name)
    throws RemoteException, NotBoundException, AccessException
{
    if (name.equals(NAME)) {
        throw new AccessException(
            "unbinding ActivationSystem is disallowed");
    } else {
        RegistryImpl.checkAccess("ActivationSystem.unbind");
        super.unbind(name);
    }
}
 
Example #30
Source File: Activation.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
public void bind(String name, Remote obj)
    throws RemoteException, AlreadyBoundException, AccessException
{
    if (name.equals(NAME)) {
        throw new AccessException(
            "binding ActivationSystem is disallowed");
    } else {
        RegistryImpl.checkAccess("ActivationSystem.bind");
        super.bind(name, obj);
    }
}