changeset 555:3c11966c3da3

7110700: Enhance exception throwing mechanism in ObjectStreamClass Reviewed-by: smarks
author dmeetry
date Thu, 29 Dec 2011 20:25:00 +0400
parents e05eb7bee1ce
children 6621fc84cbd6
files src/share/classes/java/io/ObjectStreamClass.java test/java/io/Serializable/expectedStackTrace/ExpectedStackTrace.java
diffstat 2 files changed, 8 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/src/share/classes/java/io/ObjectStreamClass.java	Thu Dec 22 09:39:24 2011 -0800
+++ b/src/share/classes/java/io/ObjectStreamClass.java	Thu Dec 29 20:25:00 2011 +0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1996, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1996, 2011, 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
@@ -730,7 +730,6 @@
             InvalidClassException ice =
                 new InvalidClassException(deserializeEx.classname,
                                           deserializeEx.getMessage());
-            ice.initCause(deserializeEx);
             throw ice;
         }
     }
@@ -745,7 +744,6 @@
             InvalidClassException ice =
                 new InvalidClassException(serializeEx.classname,
                                           serializeEx.getMessage());
-            ice.initCause(serializeEx);
             throw ice;
         }
     }
@@ -762,7 +760,6 @@
             InvalidClassException ice =
                 new InvalidClassException(defaultSerializeEx.classname,
                                           defaultSerializeEx.getMessage());
-            ice.initCause(defaultSerializeEx);
             throw ice;
         }
     }
--- a/test/java/io/Serializable/expectedStackTrace/ExpectedStackTrace.java	Thu Dec 22 09:39:24 2011 -0800
+++ b/test/java/io/Serializable/expectedStackTrace/ExpectedStackTrace.java	Thu Dec 29 20:25:00 2011 +0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2011, 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
@@ -22,7 +22,7 @@
  */
 
 /* @test
- * @bug 6317435
+ * @bug 6317435 7110700
  * @summary Verify that stack trace contains a proper cause of
  *          InvalidClassException (methods: checkSerialize,
  *          checkDeserialize or checkDefaultSerialize)
@@ -59,7 +59,7 @@
     private static final String SER_METHOD_NAME = "checkSerializable";
 
     public static final void main(String[] args) throws Exception {
-        System.err.println("\nRegression test for CR6317435");
+        System.err.println("\nRegression test for CRs 6317435, 7110700");
         checkSerializable(getObject());
     }
 
@@ -99,9 +99,12 @@
                 }
             }
             if (found) {
+                if (ex.getCause() != null) {
+                    throw new Error("\nTest for CR 7110700 FAILED");
+                }
                 System.err.println("\nTEST PASSED");
             } else {
-                throw new Error();
+		throw new Error("\nTest for CR 6317435 FAILED");
             }
         }
     }