Search in sources :

Example 1 with Activatable

use of java.rmi.activation.Activatable in project jdk8u_jdk by JetBrains.

the class NotSerializable method main.

public static void main(String[] args) throws Exception {
    System.err.println("\nRegression test for bug 4460983\n");
    Activatable act = new FakeActivatable();
    try {
        ObjectOutputStream out = new ObjectOutputStream(new ByteArrayOutputStream());
        try {
            out.writeObject(act);
            throw new RuntimeException("TEST FAILED: " + "Activatable instance successfully serialized");
        } catch (NotSerializableException e) {
            System.err.println("NotSerializableException as expected:");
            e.printStackTrace();
        }
        // other exceptions cause test failure
        System.err.println("TEST PASSED");
    } finally {
        try {
            Activatable.unexportObject(act, true);
        } catch (NoSuchObjectException e) {
        }
    }
}
Also used : NotSerializableException(java.io.NotSerializableException) Activatable(java.rmi.activation.Activatable) NoSuchObjectException(java.rmi.NoSuchObjectException) ByteArrayOutputStream(java.io.ByteArrayOutputStream) ObjectOutputStream(java.io.ObjectOutputStream)

Aggregations

ByteArrayOutputStream (java.io.ByteArrayOutputStream)1 NotSerializableException (java.io.NotSerializableException)1 ObjectOutputStream (java.io.ObjectOutputStream)1 NoSuchObjectException (java.rmi.NoSuchObjectException)1 Activatable (java.rmi.activation.Activatable)1