/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/*
* @test
* @bug 4202914 4363318 6991528 6998871
* @summary Basic test of serialization of stack trace information
* @author Josh Bloch
*/
public class StackTraceSerialization {
}
private static void testWithSetStackTrace() {
// Verify fillInStackTrace is now a no-op.
t.fillInStackTrace();
// Verify setStackTrace is now a no-op.
// Verify null-handling
try {
t.setStackTrace(null);
throw new RuntimeException("No NPE on a null stack trace.");
} catch(NullPointerException npe) {
}
try {
throw new RuntimeException("No NPE on a null stack trace element.");
} catch(NullPointerException npe) {
}
if (!equal(t, reconstitute(t)))
throw new RuntimeException("Unequal Throwables with set stacktrace");
throw new RuntimeException("Unequal Throwables with set stacktrace");
}
boolean writableStackTrace) {
super("the medium", null,
}
}
throw new AssertionError("Nonempty stacktrace.");
}
private static void testWithFillInStackTrace() {
try {
a();
} catch(HighLevelException e) {
original = e;
}
throw new RuntimeException("Unequal Throwables with filled-in stacktrace");
}
/**
* Serialize the argument and return the deserialized result.
*/
out.writeObject(t);
try(ByteArrayInputStream bin =
}
} catch(IOException | ClassNotFoundException e) {
throw new RuntimeException(e);
}
return result;
}
/**
* Returns true if e1 and e2 have equal stack traces and their
* causes are recursively equal (by the same definition) and their
* suppressed exception information is equals. Returns false or
* throws NullPointerExeption otherwise.
*/
}
static void a() throws HighLevelException {
try {
b();
} catch(MidLevelException e) {
throw new HighLevelException(e);
}
}
static void b() throws MidLevelException {
c();
}
static void c() throws MidLevelException {
try {
d();
} catch(LowLevelException e) {
throw new MidLevelException(e);
}
}
static void d() throws LowLevelException {
e();
}
static void e() throws LowLevelException {
throw new LowLevelException();
}
throw new RuntimeException("Class: " + e);
throw new RuntimeException("Method name: " + e);
throw new RuntimeException("File name: " + e);
if (e.getLineNumber() != n)
throw new RuntimeException("Line number: " + e);
}
}
}
}
}