jdk/src/java.base/share/classes/java/nio/X-Buffer.java.template
changeset 31873 87b015c2cd36
parent 31723 2e16a59cc5cb
child 32143 394ab6a6658d
--- a/jdk/src/java.base/share/classes/java/nio/X-Buffer.java.template	Fri Jul 24 18:57:04 2015 +0200
+++ b/jdk/src/java.base/share/classes/java/nio/X-Buffer.java.template	Fri Jul 24 11:52:30 2015 -0700
@@ -339,7 +339,7 @@
      */
     public static $Type$Buffer allocate(int capacity) {
         if (capacity < 0)
-            throw new IllegalArgumentException();
+            throw createCapacityException(capacity);
         return new Heap$Type$Buffer(capacity, capacity);
     }
 
@@ -797,7 +797,7 @@
      */
     public $Type$Buffer put($Type$Buffer src) {
         if (src == this)
-            throw new IllegalArgumentException();
+            throw createSameBufferException();
         if (isReadOnly())
             throw new ReadOnlyBufferException();
         int n = src.remaining();