GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Auto-port 5.0: AbstractByteBuf._internalNioBuffer() might throw excep… · netty/netty@5f9f4ae

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • buffer/src
    • main/java/io/netty/buffer
      • AbstractByteBuf.java
    • test/java/io/netty/buffer
      • AbstractByteBufTest.java
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎buffer/src/main/java/io/netty/buffer/AbstractByteBuf.java‎

Copy file name to clipboardExpand all lines: buffer/src/main/java/io/netty/buffer/AbstractByteBuf.java
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1498,6 +1498,6 @@ long _memoryAddress() {
14981498
}
14991499

15001500
ByteBuffer _internalNioBuffer() {
1501-
return internalNioBuffer(0, maxFastWritableBytes());
1501+
return internalNioBuffer(0, capacity());
15021502
}
15031503
}
Collapse file

‎buffer/src/test/java/io/netty/buffer/AbstractByteBufTest.java‎

Copy file name to clipboardExpand all lines: buffer/src/test/java/io/netty/buffer/AbstractByteBufTest.java
+19Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@
7575
import static io.netty.buffer.Unpooled.wrappedBuffer;
7676
import static io.netty.util.internal.EmptyArrays.EMPTY_BYTES;
7777
import static org.assertj.core.api.Assertions.assertThat;
78+
import static org.assertj.core.api.Assumptions.assumeThat;
7879
import static org.junit.jupiter.api.Assertions.assertArrayEquals;
7980
import static org.junit.jupiter.api.Assertions.assertEquals;
8081
import static org.junit.jupiter.api.Assertions.assertFalse;
@@ -6474,4 +6475,22 @@ public void testWriteCharSequence() {
64746475
assertNotSame(capacity, buffer.capacity());
64756476
buffer.release();
64766477
}
6478+
6479+
@Test
6480+
public void test_internalNioBuffer() {
6481+
ByteBuf buf = buffer(8, 16);
6482+
ByteBuf buffer = buf;
6483+
if (buf instanceof SimpleLeakAwareByteBuf) {
6484+
buffer = buf.unwrap();
6485+
}
6486+
assumeThat(buffer).isInstanceOf(AbstractByteBuf.class);
6487+
try {
6488+
ByteBuffer nioBuffer = ((AbstractByteBuf) buffer)._internalNioBuffer();
6489+
assertEquals(0, nioBuffer.position());
6490+
assertThat(nioBuffer.remaining()).isGreaterThanOrEqualTo(8);
6491+
} finally {
6492+
buf.release();
6493+
}
6494+
}
6495+
64776496
}

0 commit comments

Comments
0 (0)
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.