Skip to content

Commit fe46b13

Browse files
committed
Fix revapi gate and guard a test header parse
Scope-ignore the java.annotation.removed diff for Http2Handler.userEventTriggered: Netty's internal @ChannelHandlerMask.Skip no-op marker is correctly dropped once the handler overrides the method to process RST_STREAM. Http2Handler is public final and internal-package, so there is no consumer-facing API change, and the ignore is scoped to this method so any real future change is still flagged. Also wrap Long.parseLong in Http2StreamingBodyFlowControlTest.assertEchoed so a missing/non-numeric header fails cleanly instead of throwing NumberFormatException.
1 parent 80b6c45 commit fe46b13

2 files changed

Lines changed: 18 additions & 2 deletions

File tree

client/src/test/java/org/asynchttpclient/Http2StreamingBodyFlowControlTest.java

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -300,12 +300,21 @@ private AsyncHttpClient http2Client() {
300300

301301
private void assertEchoed(Response response, byte[] expected) {
302302
assertEquals(200, response.getStatusCode(), "request should have completed");
303-
assertEquals(expected.length, Long.parseLong(response.getHeader("x-received-length")),
303+
assertEquals(expected.length, parseLongHeader(response, "x-received-length"),
304304
"server must receive every uploaded byte");
305-
assertEquals(crc32(expected), Long.parseLong(response.getHeader("x-received-crc")),
305+
assertEquals(crc32(expected), parseLongHeader(response, "x-received-crc"),
306306
"uploaded bytes must arrive intact and in order");
307307
}
308308

309+
private static long parseLongHeader(Response response, String name) {
310+
String value = response.getHeader(name);
311+
try {
312+
return Long.parseLong(value);
313+
} catch (NumberFormatException e) {
314+
return fail("response header '" + name + "' was not a parseable long: " + value, e);
315+
}
316+
}
317+
309318
// =========================================================================
310319
// NettyInputStreamBody — large streaming upload via InputStreamBodyGenerator
311320
// =========================================================================

pom.xml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -465,6 +465,13 @@
465465
{
466466
"code": "java.class.nonPublicPartOfAPI",
467467
"justification": "Internal classes exposed via public methods are intentional"
468+
},
469+
{
470+
"code": "java.annotation.removed",
471+
"old": "method void io.netty.channel.ChannelInboundHandlerAdapter::userEventTriggered(io.netty.channel.ChannelHandlerContext, java.lang.Object) throws java.lang.Exception @ org.asynchttpclient.netty.handler.Http2Handler",
472+
"new": "method void org.asynchttpclient.netty.handler.Http2Handler::userEventTriggered(io.netty.channel.ChannelHandlerContext, java.lang.Object) throws java.lang.Exception",
473+
"annotationType": "io.netty.channel.ChannelHandlerMask.Skip",
474+
"justification": "Http2Handler overrides userEventTriggered to handle RST_STREAM (Http2ResetFrame); Netty's internal @ChannelHandlerMask.Skip no-op marker is correctly dropped because the method now does real work. Http2Handler is public final and internal-package, so there is no binary, source, or behavioral change for consumers. Scoped to this exact method so any real future change to it is still flagged."
468475
}
469476
]
470477
}

0 commit comments

Comments
 (0)