jdk/src/share/classes/java/nio/X-Buffer.java.template
changeset 13563 13c8e8f0302b
parent 10137 d92637d3d673
child 14001 e8e8413ad49a
--- a/jdk/src/share/classes/java/nio/X-Buffer.java.template	Sun Aug 12 22:56:45 2012 +0100
+++ b/jdk/src/share/classes/java/nio/X-Buffer.java.template	Mon Aug 13 19:51:48 2012 +0800
@@ -888,6 +888,8 @@
      */
     public $Type$Buffer put(String src, int start, int end) {
         checkBounds(start, end - start, src.length());
+        if (end - start > remaining())
+            throw new BufferOverflowException();
         for (int i = start; i < end; i++)
             this.put(src.charAt(i));
         return this;