diff --git a/buffer-memseg/src/main/java/io/netty/buffer/api/memseg/MemSegBuffer.java b/buffer-memseg/src/main/java/io/netty/buffer/api/memseg/MemSegBuffer.java index e347dd6..c181e48 100644 --- a/buffer-memseg/src/main/java/io/netty/buffer/api/memseg/MemSegBuffer.java +++ b/buffer-memseg/src/main/java/io/netty/buffer/api/memseg/MemSegBuffer.java @@ -17,6 +17,7 @@ package io.netty.buffer.api.memseg; import io.netty.buffer.ByteBuf; import io.netty.buffer.api.BufferAllocator; +import io.netty.buffer.api.BufferReadOnlyException; import io.netty.buffer.api.adaptor.BufferIntegratable; import io.netty.buffer.api.adaptor.ByteBufAdaptor; import io.netty.buffer.api.adaptor.ByteBufAllocatorAdaptor; @@ -618,7 +619,7 @@ class MemSegBuffer extends ResourceSupport implements Buff throw attachTrace(new IllegalStateException("Buffer must be owned in order to compact.")); } if (readOnly()) { - throw new IllegalStateException("Buffer must be writable in order to compact, but was read-only."); + throw new BufferReadOnlyException("Buffer must be writable in order to compact, but was read-only."); } int distance = roff; if (distance == 0) {