Java Code Examples for javax.security.auth.Destroyable#destroy()

The following examples show how to use javax.security.auth.Destroyable#destroy() . 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: KeyDestructionTest.java    From jdk8u-dev-jdk with GNU General Public License v2.0 6 votes vote down vote up
private static void testNoKeyDestruction(Destroyable key)
    throws Exception {
    String klass = key.getClass().getName();

    if (key.isDestroyed()) {
        throw new Exception("error: a " + klass +
            " key has been unexpectedly destroyed");
    }
    try {
        key.destroy();
    } catch (DestroyFailedException dfe) {
        // not an error

        if (key.isDestroyed()) {
            throw new Exception("error: a " + klass +
                " key has been unexpectedly destroyed");
        }
        System.out.println(klass + " keys are not destroyable");
        return;
    }
    throw new Exception("error: key may been unexpectedly destroyed");
}
 
Example 2
Source File: KeyDestructionTest.java    From openjdk-8 with GNU General Public License v2.0 6 votes vote down vote up
private static void destroyKey(Key key) throws Exception {
    String klass = key.getClass().getName();

    if (!(key instanceof Destroyable)) {
        throw new UnsupportedOperationException();
    }

    Destroyable dKey = (Destroyable) key;
    if (dKey.isDestroyed()) {
        throw new Exception("error: a " + klass +
            " key has already been destroyed");
    }
    dKey.destroy();
    if (!dKey.isDestroyed()) {
        throw new Exception("error: a " + klass +
            " key has NOT been destroyed");
    }
}
 
Example 3
Source File: KeyDestructionTest.java    From jdk8u-dev-jdk with GNU General Public License v2.0 6 votes vote down vote up
private static void destroyKey(Key key) throws Exception {
    String klass = key.getClass().getName();

    if (!(key instanceof Destroyable)) {
        throw new UnsupportedOperationException();
    }

    Destroyable dKey = (Destroyable) key;
    if (dKey.isDestroyed()) {
        throw new Exception("error: a " + klass +
            " key has already been destroyed");
    }
    dKey.destroy();
    if (!dKey.isDestroyed()) {
        throw new Exception("error: a " + klass +
            " key has NOT been destroyed");
    }
}
 
Example 4
Source File: KeyDestructionTest.java    From jdk8u-jdk with GNU General Public License v2.0 6 votes vote down vote up
private static void destroyKey(Key key) throws Exception {
    String klass = key.getClass().getName();

    if (!(key instanceof Destroyable)) {
        throw new UnsupportedOperationException();
    }

    Destroyable dKey = (Destroyable) key;
    if (dKey.isDestroyed()) {
        throw new Exception("error: a " + klass +
            " key has already been destroyed");
    }
    dKey.destroy();
    if (!dKey.isDestroyed()) {
        throw new Exception("error: a " + klass +
            " key has NOT been destroyed");
    }
}
 
Example 5
Source File: KeyDestructionTest.java    From jdk8u_jdk with GNU General Public License v2.0 6 votes vote down vote up
private static void testNoKeyDestruction(Destroyable key)
    throws Exception {
    String klass = key.getClass().getName();

    if (key.isDestroyed()) {
        throw new Exception("error: a " + klass +
            " key has been unexpectedly destroyed");
    }
    try {
        key.destroy();
    } catch (DestroyFailedException dfe) {
        // not an error

        if (key.isDestroyed()) {
            throw new Exception("error: a " + klass +
                " key has been unexpectedly destroyed");
        }
        System.out.println(klass + " keys are not destroyable");
        return;
    }
    throw new Exception("error: key may been unexpectedly destroyed");
}
 
Example 6
Source File: KeyDestructionTest.java    From hottub with GNU General Public License v2.0 6 votes vote down vote up
private static void destroyKey(Key key) throws Exception {
    String klass = key.getClass().getName();

    if (!(key instanceof Destroyable)) {
        throw new UnsupportedOperationException();
    }

    Destroyable dKey = (Destroyable) key;
    if (dKey.isDestroyed()) {
        throw new Exception("error: a " + klass +
            " key has already been destroyed");
    }
    dKey.destroy();
    if (!dKey.isDestroyed()) {
        throw new Exception("error: a " + klass +
            " key has NOT been destroyed");
    }
}
 
Example 7
Source File: KeyDestructionTest.java    From hottub with GNU General Public License v2.0 6 votes vote down vote up
private static void testNoKeyDestruction(Destroyable key)
    throws Exception {
    String klass = key.getClass().getName();

    if (key.isDestroyed()) {
        throw new Exception("error: a " + klass +
            " key has been unexpectedly destroyed");
    }
    try {
        key.destroy();
    } catch (DestroyFailedException dfe) {
        // not an error

        if (key.isDestroyed()) {
            throw new Exception("error: a " + klass +
                " key has been unexpectedly destroyed");
        }
        System.out.println(klass + " keys are not destroyable");
        return;
    }
    throw new Exception("error: key may been unexpectedly destroyed");
}
 
Example 8
Source File: KeyDestructionTest.java    From jdk8u-jdk with GNU General Public License v2.0 6 votes vote down vote up
private static void destroyKey(Key key) throws Exception {
    String klass = key.getClass().getName();

    if (!(key instanceof Destroyable)) {
        throw new UnsupportedOperationException();
    }

    Destroyable dKey = (Destroyable) key;
    if (dKey.isDestroyed()) {
        throw new Exception("error: a " + klass +
            " key has already been destroyed");
    }
    dKey.destroy();
    if (!dKey.isDestroyed()) {
        throw new Exception("error: a " + klass +
            " key has NOT been destroyed");
    }
}
 
Example 9
Source File: KeyDestructionTest.java    From jdk8u-jdk with GNU General Public License v2.0 6 votes vote down vote up
private static void testNoKeyDestruction(Destroyable key)
    throws Exception {
    String klass = key.getClass().getName();

    if (key.isDestroyed()) {
        throw new Exception("error: a " + klass +
            " key has been unexpectedly destroyed");
    }
    try {
        key.destroy();
    } catch (DestroyFailedException dfe) {
        // not an error

        if (key.isDestroyed()) {
            throw new Exception("error: a " + klass +
                " key has been unexpectedly destroyed");
        }
        System.out.println(klass + " keys are not destroyable");
        return;
    }
    throw new Exception("error: key may been unexpectedly destroyed");
}
 
Example 10
Source File: KeyDestructionTest.java    From jdk8u-jdk with GNU General Public License v2.0 6 votes vote down vote up
private static void testNoKeyDestruction(Destroyable key)
    throws Exception {
    String klass = key.getClass().getName();

    if (key.isDestroyed()) {
        throw new Exception("error: a " + klass +
            " key has been unexpectedly destroyed");
    }
    try {
        key.destroy();
    } catch (DestroyFailedException dfe) {
        // not an error

        if (key.isDestroyed()) {
            throw new Exception("error: a " + klass +
                " key has been unexpectedly destroyed");
        }
        System.out.println(klass + " keys are not destroyable");
        return;
    }
    throw new Exception("error: key may been unexpectedly destroyed");
}
 
Example 11
Source File: KeyDestructionTest.java    From dragonwell8_jdk with GNU General Public License v2.0 6 votes vote down vote up
private static void testNoKeyDestruction(Destroyable key)
    throws Exception {
    String klass = key.getClass().getName();

    if (key.isDestroyed()) {
        throw new Exception("error: a " + klass +
            " key has been unexpectedly destroyed");
    }
    try {
        key.destroy();
    } catch (DestroyFailedException dfe) {
        // not an error

        if (key.isDestroyed()) {
            throw new Exception("error: a " + klass +
                " key has been unexpectedly destroyed");
        }
        System.out.println(klass + " keys are not destroyable");
        return;
    }
    throw new Exception("error: key may been unexpectedly destroyed");
}
 
Example 12
Source File: KeyDestructionTest.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 6 votes vote down vote up
private static void destroyKey(Key key) throws Exception {
    String klass = key.getClass().getName();

    if (!(key instanceof Destroyable)) {
        throw new UnsupportedOperationException();
    }

    Destroyable dKey = (Destroyable) key;
    if (dKey.isDestroyed()) {
        throw new Exception("error: a " + klass +
            " key has already been destroyed");
    }
    dKey.destroy();
    if (!dKey.isDestroyed()) {
        throw new Exception("error: a " + klass +
            " key has NOT been destroyed");
    }
}
 
Example 13
Source File: KeyDestructionTest.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 6 votes vote down vote up
private static void testNoKeyDestruction(Destroyable key)
    throws Exception {
    String klass = key.getClass().getName();

    if (key.isDestroyed()) {
        throw new Exception("error: a " + klass +
            " key has been unexpectedly destroyed");
    }
    try {
        key.destroy();
    } catch (DestroyFailedException dfe) {
        // not an error

        if (key.isDestroyed()) {
            throw new Exception("error: a " + klass +
                " key has been unexpectedly destroyed");
        }
        System.out.println(klass + " keys are not destroyable");
        return;
    }
    throw new Exception("error: key may been unexpectedly destroyed");
}
 
Example 14
Source File: KeyDestructionTest.java    From jdk8u_jdk with GNU General Public License v2.0 6 votes vote down vote up
private static void destroyKey(Key key) throws Exception {
    String klass = key.getClass().getName();

    if (!(key instanceof Destroyable)) {
        throw new UnsupportedOperationException();
    }

    Destroyable dKey = (Destroyable) key;
    if (dKey.isDestroyed()) {
        throw new Exception("error: a " + klass +
            " key has already been destroyed");
    }
    dKey.destroy();
    if (!dKey.isDestroyed()) {
        throw new Exception("error: a " + klass +
            " key has NOT been destroyed");
    }
}
 
Example 15
Source File: KeyDestructionTest.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
private static void testNoKeyDestruction(Destroyable key)
    throws Exception {
    String klass = key.getClass().getName();

    if (key.isDestroyed()) {
        throw new Exception("error: a " + klass +
            " key has been unexpectedly destroyed");
    }
    try {
        key.destroy();
    } catch (DestroyFailedException dfe) {
        // not an error

        if (key.isDestroyed()) {
            throw new Exception("error: a " + klass +
                " key has been unexpectedly destroyed");
        }
        System.out.println(klass + " keys are not destroyable");
        return;
    }
    throw new Exception("error: key may been unexpectedly destroyed");
}
 
Example 16
Source File: KeyDestructionTest.java    From jdk8u60 with GNU General Public License v2.0 6 votes vote down vote up
private static void destroyKey(Key key) throws Exception {
    String klass = key.getClass().getName();

    if (!(key instanceof Destroyable)) {
        throw new UnsupportedOperationException();
    }

    Destroyable dKey = (Destroyable) key;
    if (dKey.isDestroyed()) {
        throw new Exception("error: a " + klass +
            " key has already been destroyed");
    }
    dKey.destroy();
    if (!dKey.isDestroyed()) {
        throw new Exception("error: a " + klass +
            " key has NOT been destroyed");
    }
}
 
Example 17
Source File: KeyDestructionTest.java    From jdk8u60 with GNU General Public License v2.0 6 votes vote down vote up
private static void testNoKeyDestruction(Destroyable key)
    throws Exception {
    String klass = key.getClass().getName();

    if (key.isDestroyed()) {
        throw new Exception("error: a " + klass +
            " key has been unexpectedly destroyed");
    }
    try {
        key.destroy();
    } catch (DestroyFailedException dfe) {
        // not an error

        if (key.isDestroyed()) {
            throw new Exception("error: a " + klass +
                " key has been unexpectedly destroyed");
        }
        System.out.println(klass + " keys are not destroyable");
        return;
    }
    throw new Exception("error: key may been unexpectedly destroyed");
}
 
Example 18
Source File: KeyDestructionTest.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
private static void destroyKey(Key key) throws Exception {
    String klass = key.getClass().getName();

    if (!(key instanceof Destroyable)) {
        throw new UnsupportedOperationException();
    }

    Destroyable dKey = (Destroyable) key;
    if (dKey.isDestroyed()) {
        throw new Exception("error: a " + klass +
            " key has already been destroyed");
    }
    dKey.destroy();
    if (!dKey.isDestroyed()) {
        throw new Exception("error: a " + klass +
            " key has NOT been destroyed");
    }
}
 
Example 19
Source File: KeyDestructionTest.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
private static void testNoKeyDestruction(Destroyable key)
    throws Exception {
    String klass = key.getClass().getName();

    if (key.isDestroyed()) {
        throw new Exception("error: a " + klass +
            " key has been unexpectedly destroyed");
    }
    try {
        key.destroy();
    } catch (DestroyFailedException dfe) {
        // not an error

        if (key.isDestroyed()) {
            throw new Exception("error: a " + klass +
                " key has been unexpectedly destroyed");
        }
        System.out.println(klass + " keys are not destroyable");
        return;
    }
    throw new Exception("error: key may been unexpectedly destroyed");
}
 
Example 20
Source File: KeyDestructionTest.java    From dragonwell8_jdk with GNU General Public License v2.0 6 votes vote down vote up
private static void destroyKey(Key key) throws Exception {
    String klass = key.getClass().getName();

    if (!(key instanceof Destroyable)) {
        throw new UnsupportedOperationException();
    }

    Destroyable dKey = (Destroyable) key;
    if (dKey.isDestroyed()) {
        throw new Exception("error: a " + klass +
            " key has already been destroyed");
    }
    dKey.destroy();
    if (!dKey.isDestroyed()) {
        throw new Exception("error: a " + klass +
            " key has NOT been destroyed");
    }
}