< prev index next >

test/java/io/Serializable/subclass/Test.java

Print this page

        

@@ -1,7 +1,7 @@
 /*
- * Copyright (c) 1998, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
  * under the terms of the GNU General Public License version 2 only, as
  * published by the Free Software Foundation.

@@ -24,24 +24,25 @@
 /*
  * @test
  * @bug 4100915
  * @summary Verify that [write/read]ObjectOverride methods get called.
  *          Test verifies that ALL methods to write an object can
- *          be overridden. Howver, the testing for reading an object
+ *          be overridden. However, the testing for reading an object
  *          is incomplete. Only test that readObjectOverride is called.
  *          An entire protocol would need to be implemented and written
  *          out before being able to test the input side of the API.
  *
  *          Also, would be appropriate that this program verify
- *          that if SerializablePermission "enableSubclassImplamentation"
+ *          that if SerializablePermission "enableSubclassImplementation"
  *          is not in the security policy and security is enabled, that
  *          a security excepiton is thrown when constructing the
  *          ObjectOutputStream subclass.
  *
  *
  * @compile AbstractObjectInputStream.java AbstractObjectOutputStream.java XObjectInputStream.java XObjectOutputStream.java Test.java
  * @run main  Test
+ * @run main/othervm/policy=Allow.policy Test -expectSecurityException
  */
 
 import java.io.*;
 
 /**

@@ -127,13 +128,14 @@
             os = new XObjectOutputStream(baos);
             if (expectSecurityException)
                 throw new Error("Assertion failure. " +
                                 "Expected a security exception on previous line.");
         } catch (SecurityException e) {
-            if (expectSecurityException)
+            if (expectSecurityException) {
+                System.err.println("Caught expected security exception.");
                 return;
-            else
+            }
                 throw e;
         }
         os.writeObject(new A());
         os.close();
         if (B.numWriteObjectCalled != 3)
< prev index next >