summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNeil Fuller <nfuller@google.com>2014-05-23 08:47:31 +0000
committerAndroid Git Automerger <android-git-automerger@android.com>2014-05-23 08:47:31 +0000
commit04769b3a84567a4bd83a4c1a43dfa41882666be2 (patch)
tree61b20bcecdc594cc28edfcb56e1dbf72abfd5d02
parent641fc51b39b6cdeec68ec68ed766185f30a6c3ab (diff)
parent392ca3acf5ba48d315fc5469f286446a9cb217a1 (diff)
downloadlibcore-04769b3a84567a4bd83a4c1a43dfa41882666be2.zip
libcore-04769b3a84567a4bd83a4c1a43dfa41882666be2.tar.gz
libcore-04769b3a84567a4bd83a4c1a43dfa41882666be2.tar.bz2
am 392ca3ac: Merge "Change exception priority for ByteBuffer.put(null)"
* commit '392ca3acf5ba48d315fc5469f286446a9cb217a1': Change exception priority for ByteBuffer.put(null)
-rw-r--r--luni/src/main/java/java/nio/ByteBuffer.java7
1 files changed, 3 insertions, 4 deletions
diff --git a/luni/src/main/java/java/nio/ByteBuffer.java b/luni/src/main/java/java/nio/ByteBuffer.java
index 4c0f4a6..31bf481 100644
--- a/luni/src/main/java/java/nio/ByteBuffer.java
+++ b/luni/src/main/java/java/nio/ByteBuffer.java
@@ -766,16 +766,15 @@ 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 (!src.isAccessible() || !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");
+ }
int srcByteCount = src.remaining();
if (srcByteCount > remaining()) {
throw new BufferOverflowException();