diff -r 02413b195191 -r 3871c2046043 jdk/test/java/nio/Buffer/BasicLong.java --- a/jdk/test/java/nio/Buffer/BasicLong.java Tue Nov 25 10:09:26 2008 -0800 +++ b/jdk/test/java/nio/Buffer/BasicLong.java Tue Nov 25 19:26:54 2008 +0000 @@ -31,6 +31,7 @@ // -- This file was mechanically generated: Do not edit! -- // import java.nio.*; +import java.lang.reflect.Method; public class BasicLong @@ -283,13 +284,41 @@ + + + + + + + + + + + + + + + + + + + + + + + + + private static void tryCatch(Buffer b, Class ex, Runnable thunk) { boolean caught = false; try { thunk.run(); } catch (Throwable x) { - if (ex.isAssignableFrom(x.getClass())) + if (ex.isAssignableFrom(x.getClass())) { caught = true; + } else { + fail(x.getMessage() + " not expected"); + } } if (!caught) fail(ex.getName() + " not thrown", b); @@ -356,7 +385,6 @@ // Exceptions - boolean caught = false; relPut(b); b.limit(b.capacity() / 2); b.position(b.limit()); @@ -386,6 +414,14 @@ b.put(b.limit(), (long)42); }}); + tryCatch(b, InvalidMarkException.class, new Runnable() { + public void run() { + b.position(0); + b.mark(); + b.compact(); + b.reset(); + }}); + // Values b.clear();