diff options
| author | Sven de Marothy <sven@physto.se> | 2006-05-22 00:19:30 +0000 |
|---|---|---|
| committer | Sven de Marothy <sven@physto.se> | 2006-05-22 00:19:30 +0000 |
| commit | cd37793f7ca32387dfd3b12b68ac47cba85f878a (patch) | |
| tree | 775a32f75348198805598e41d0d95e3efa352162 /java/nio | |
| parent | b75b2e12499b915ab4e40ff98763b6310f8a54bf (diff) | |
| download | classpath-cd37793f7ca32387dfd3b12b68ac47cba85f878a.tar.gz | |
2006-05-22 Sven de Marothy <sven@physto.se>
* java/nio/CharBuffer.java
(wrap): Fix bounds checking.
Diffstat (limited to 'java/nio')
| -rw-r--r-- | java/nio/CharBuffer.java | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/java/nio/CharBuffer.java b/java/nio/CharBuffer.java index 6551555e2..356a920ee 100644 --- a/java/nio/CharBuffer.java +++ b/java/nio/CharBuffer.java @@ -107,14 +107,12 @@ public abstract class CharBuffer extends Buffer { // FIXME: implement better handling of java.lang.String. // Probably share data with String via reflection. - - if ((start < 0) - || (start > seq.length()) - || (end < start) - || (end > (seq.length() - start))) - throw new IndexOutOfBoundsException(); - + int len = end - start; + + if( len < 0 ) + throw new IndexOutOfBoundsException(); + char[] buffer = new char[len]; for (int i = 0; i < len; i++) |
