jdk/test/java/nio/Buffer/BasicLong.java
changeset 14001 e8e8413ad49a
parent 13563 13c8e8f0302b
child 14342 8435a30053c1
--- a/jdk/test/java/nio/Buffer/BasicLong.java	Thu Sep 20 13:01:01 2012 -0700
+++ b/jdk/test/java/nio/Buffer/BasicLong.java	Fri Sep 21 15:39:10 2012 +0100
@@ -335,7 +335,7 @@
         fail(problem + String.format(": x=%s y=%s", x, y), xb, yb);
     }
 
-    private static void tryCatch(Buffer b, Class ex, Runnable thunk) {
+    private static void tryCatch(Buffer b, Class<?> ex, Runnable thunk) {
         boolean caught = false;
         try {
             thunk.run();
@@ -350,7 +350,7 @@
             fail(ex.getName() + " not thrown", b);
     }
 
-    private static void tryCatch(long [] t, Class ex, Runnable thunk) {
+    private static void tryCatch(long [] t, Class<?> ex, Runnable thunk) {
         tryCatch(LongBuffer.wrap(t), ex, thunk);
     }
 
@@ -681,6 +681,14 @@
                     bulkPutBuffer(rb);
                 }});
 
+        // put(LongBuffer) should not change source position
+        final LongBuffer src = LongBuffer.allocate(1);
+        tryCatch(b, ReadOnlyBufferException.class, new Runnable() {
+                public void run() {
+                    rb.put(src);
+                 }});
+        ck(src, src.position(), 0);
+
         tryCatch(b, ReadOnlyBufferException.class, new Runnable() {
                 public void run() {
                     rb.compact();
@@ -744,6 +752,22 @@
 
 
 
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
         if (rb.getClass().getName().startsWith("java.nio.Heap")) {
 
             tryCatch(b, ReadOnlyBufferException.class, new Runnable() {