--- 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();