jdk/test/java/io/Serializable/expectedStackTrace/ExpectedStackTrace.java
changeset 11894 c7af6deeffd8
parent 5506 202f599c92aa
child 11895 77896d5ad69b
equal deleted inserted replaced
11893:6a3b541908ae 11894:c7af6deeffd8
    20  * or visit www.oracle.com if you need additional information or have any
    20  * or visit www.oracle.com if you need additional information or have any
    21  * questions.
    21  * questions.
    22  */
    22  */
    23 
    23 
    24 /* @test
    24 /* @test
    25  * @bug 6317435
    25  * @bug 6317435 7068148
    26  * @summary Verify that stack trace contains a proper cause of
    26  * @summary Verify that stack trace contains a proper cause of
    27  *          InvalidClassException (methods: checkSerialize,
    27  *          InvalidClassException (methods: checkSerialize,
    28  *          checkDeserialize or checkDefaultSerialize)
    28  *          checkDeserialize or checkDefaultSerialize)
    29  *
    29  *
    30  * @author Andrey Ozerov
    30  * @author Andrey Ozerov
    57 
    57 
    58 public class ExpectedStackTrace {
    58 public class ExpectedStackTrace {
    59     private static final String SER_METHOD_NAME = "checkSerializable";
    59     private static final String SER_METHOD_NAME = "checkSerializable";
    60 
    60 
    61     public static final void main(String[] args) throws Exception {
    61     public static final void main(String[] args) throws Exception {
    62         System.err.println("\nRegression test for CR6317435");
    62         System.err.println("\nRegression test for CRs 6317435, 7068148");
    63         checkSerializable(getObject());
    63         checkSerializable(getObject());
    64     }
    64     }
    65 
    65 
    66     private static Object getObject() throws Exception {
    66     private static Object getObject() throws Exception {
    67         ObjectStreamClass osc =
    67         ObjectStreamClass osc =
    97                 if (nme.equals(SER_METHOD_NAME)) {
    97                 if (nme.equals(SER_METHOD_NAME)) {
    98                     found = true;
    98                     found = true;
    99                 }
    99                 }
   100             }
   100             }
   101             if (found) {
   101             if (found) {
   102                 System.err.println("\nTEST PASSED");
   102                 if (ex.getCause() != null) {
       
   103                     throw new Error("\nTest for CR 7068148 FAILED");
       
   104                 }
   103             } else {
   105             } else {
   104                 throw new Error();
   106                 throw new Error("\nTest for CR 6317435 FAILED");
   105             }
   107             }
   106         }
   108         }
   107     }
   109     }
   108 }
   110 }