Skip to content
This repository was archived by the owner on Dec 12, 2022. It is now read-only.

Commit bf80061

Browse files
committed
Also attach traces to ownership errors from compact() and bifurcate()
1 parent 264746d commit bf80061

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/main/java/io/netty/buffer/api/memseg/MemSegBuffer.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -503,7 +503,7 @@ public void ensureWritable(int size, boolean allowCompaction) {
503503
@Override
504504
public Buffer bifurcate() {
505505
if (!isOwned()) {
506-
throw new IllegalStateException("Cannot bifurcate a buffer that is not owned.");
506+
throw attachTrace(new IllegalStateException("Cannot bifurcate a buffer that is not owned."));
507507
}
508508
var drop = unsafeGetDrop();
509509
if (seg.ownerThread() != null) {
@@ -535,7 +535,7 @@ public Buffer bifurcate() {
535535
@Override
536536
public void compact() {
537537
if (!isOwned()) {
538-
throw new IllegalStateException("Buffer must be owned in order to compact.");
538+
throw attachTrace(new IllegalStateException("Buffer must be owned in order to compact."));
539539
}
540540
if (readOnly()) {
541541
throw new IllegalStateException("Buffer must be writable in order to compact, but was read-only.");

0 commit comments

Comments
 (0)