7110700: Enhance exception throwing mechanism in ObjectStreamClass
authordmeetry
Thu Dec 29 20:25:00 2011 +0400 (16 months ago)
changeset 5553c11966c3da3
parent 554e05eb7bee1ce
child 5566621fc84cbd6
7110700: Enhance exception throwing mechanism in ObjectStreamClass
Reviewed-by: smarks
src/share/classes/java/io/ObjectStreamClass.java
test/java/io/Serializable/expectedStackTrace/ExpectedStackTrace.java
--- 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 @@ public class ObjectStreamClass implement
InvalidClassException ice =
new InvalidClassException(deserializeEx.classname,
deserializeEx.getMessage());
- ice.initCause(deserializeEx);
throw ice;
}
}
@@ -745,7 +744,6 @@ public class ObjectStreamClass implement
InvalidClassException ice =
new InvalidClassException(serializeEx.classname,
serializeEx.getMessage());
- ice.initCause(serializeEx);
throw ice;
}
}
@@ -762,7 +760,6 @@ public class ObjectStreamClass implement
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 @@ public class ExpectedStackTrace {
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 @@ public class ExpectedStackTrace {
}
}
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");
}
}
}