summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog4
-rw-r--r--java/nio/ByteBufferImpl.java10
2 files changed, 8 insertions, 6 deletions
diff --git a/ChangeLog b/ChangeLog
index 0a214d554..0bdd473d9 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2006-05-13 Tom Tromey <tromey@redhat.com>
+
+ * java/nio/ByteBufferImpl.java (compact): Always set position.
+
2006-05-11 Mark Wielaard <mark@klomp.org>
* java/util/logging/Logger.java (global): Initialize inside static
diff --git a/java/nio/ByteBufferImpl.java b/java/nio/ByteBufferImpl.java
index cbe627b06..aa51a65bd 100644
--- a/java/nio/ByteBufferImpl.java
+++ b/java/nio/ByteBufferImpl.java
@@ -115,12 +115,10 @@ final class ByteBufferImpl extends ByteBuffer
checkIfReadOnly();
mark = -1;
int pos = position();
- if (pos > 0)
- {
- int count = remaining();
- shiftDown(0, pos, count);
- position(count);
- }
+ int n = limit() - pos;
+ if (n > 0)
+ shiftDown(0, pos, n);
+ position(n);
limit(capacity());
return this;
}