summaryrefslogtreecommitdiff
path: root/java
diff options
context:
space:
mode:
authorSven de Marothy <sven@physto.se>2006-05-22 00:19:30 +0000
committerSven de Marothy <sven@physto.se>2006-05-22 00:19:30 +0000
commitcd37793f7ca32387dfd3b12b68ac47cba85f878a (patch)
tree775a32f75348198805598e41d0d95e3efa352162 /java
parentb75b2e12499b915ab4e40ff98763b6310f8a54bf (diff)
downloadclasspath-cd37793f7ca32387dfd3b12b68ac47cba85f878a.tar.gz
2006-05-22 Sven de Marothy <sven@physto.se>
* java/nio/CharBuffer.java (wrap): Fix bounds checking.
Diffstat (limited to 'java')
-rw-r--r--java/nio/CharBuffer.java12
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++)