[kaffe] CVS kaffe (dalibor): Fixed a small freenet problem

Kaffe CVS cvs-commits at kaffe.org
Wed May 26 17:24:06 PDT 2004


PatchSet 4788 
Date: 2004/05/27 00:06:30
Author: dalibor
Branch: HEAD
Tag: (none) 
Log:
Fixed a small freenet problem

2004-05-27  Dalibor Topic  <robilad at kaffe.org>

        * libraries/javalib/java/nio/ByteBufferImpl.java:
        (get) Throw a BufferUnderflowException if we run out
        of bounds.

Members: 
	ChangeLog:1.2357->1.2358 
	libraries/javalib/java/nio/ByteBufferImpl.java:1.5->1.6 

Index: kaffe/ChangeLog
diff -u kaffe/ChangeLog:1.2357 kaffe/ChangeLog:1.2358
--- kaffe/ChangeLog:1.2357	Wed May 26 22:13:14 2004
+++ kaffe/ChangeLog	Thu May 27 00:06:30 2004
@@ -1,3 +1,9 @@
+2004-05-27  Dalibor Topic  <robilad at kaffe.org>
+
+	* libraries/javalib/java/nio/ByteBufferImpl.java:
+	(get) Throw a BufferUnderflowException if we run out
+	of bounds.
+
 2004-05-26  Dalibor Topic  <robilad at kaffe.org>
 
 	* kaffe/kaffevm/systems/unix-pthreads/lock-impl.h:
Index: kaffe/libraries/javalib/java/nio/ByteBufferImpl.java
diff -u kaffe/libraries/javalib/java/nio/ByteBufferImpl.java:1.5 kaffe/libraries/javalib/java/nio/ByteBufferImpl.java:1.6
--- kaffe/libraries/javalib/java/nio/ByteBufferImpl.java:1.5	Mon Apr 12 11:40:27 2004
+++ kaffe/libraries/javalib/java/nio/ByteBufferImpl.java	Thu May 27 00:06:32 2004
@@ -130,12 +130,19 @@
 
   /**
    * Relative get method. Reads the next <code>byte</code> from the buffer.
+   *
+   * @exception BufferUnderflowException If there is no next byte to read
    */
   public byte get ()
   {
-    byte result = backing_buffer [position () + array_offset];
-    position (position () + 1);
-    return result;
+    try {
+	byte result = backing_buffer [position () + array_offset];
+    	position (position () + 1);
+    	return result;
+    }
+    catch (ArrayIndexOutOfBoundsException e) {
+	throw new BufferUnderflowException();
+    }
   }
   
   /**




More information about the kaffe mailing list