diff options
author | Neil Fuller <nfuller@google.com> | 2014-06-03 08:13:02 +0000 |
---|---|---|
committer | Gerrit Code Review <noreply-gerritcodereview@google.com> | 2014-06-03 08:13:02 +0000 |
commit | 47526606b5a41fc7d345c5f4c7680ee89554864d (patch) | |
tree | 4866a6e4941010e4cd372f33b77e9aa1ac5c7d5b | |
parent | 3695691a093be11d539b85cf5c20cf91f11a3252 (diff) | |
parent | ec3a12ddb18aaf37575ceb00e158f2bda5796629 (diff) | |
download | libcore-47526606b5a41fc7d345c5f4c7680ee89554864d.zip libcore-47526606b5a41fc7d345c5f4c7680ee89554864d.tar.gz libcore-47526606b5a41fc7d345c5f4c7680ee89554864d.tar.bz2 |
Merge "Fix BufferTest.testAccess"
-rw-r--r-- | luni/src/main/java/java/nio/ByteBuffer.java | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/luni/src/main/java/java/nio/ByteBuffer.java b/luni/src/main/java/java/nio/ByteBuffer.java index 31bf481..5873590 100644 --- a/luni/src/main/java/java/nio/ByteBuffer.java +++ b/luni/src/main/java/java/nio/ByteBuffer.java @@ -766,14 +766,17 @@ public abstract class ByteBuffer extends Buffer implements Comparable<ByteBuffer * if no changes may be made to the contents of this buffer. */ public ByteBuffer put(ByteBuffer src) { + if (!isAccessible()) { + throw new IllegalStateException("buffer is inaccessible"); + } if (isReadOnly()) { throw new ReadOnlyBufferException(); } if (src == this) { throw new IllegalArgumentException("src == this"); } - if (!src.isAccessible() || !isAccessible()) { - throw new IllegalStateException("buffer is inaccessible"); + if (!src.isAccessible()) { + throw new IllegalStateException("src buffer is inaccessible"); } int srcByteCount = src.remaining(); if (srcByteCount > remaining()) { |