From ec0fc8fc725c1575be0bfabd79c663a8a60ebbb2 Mon Sep 17 00:00:00 2001 From: Norman Maurer Date: Mon, 21 Feb 2022 12:23:27 +0100 Subject: [PATCH] Correct javadocs of HttpUtil (#12114) Motivation: We should mention that the method will throw if the number couldnt be parsed Modifications: Add some clarification to the javadocs Result: Fixes https://github.com/netty/netty/issues/12113 --- .../src/main/java/io/netty/handler/codec/http/HttpUtil.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/codec-http/src/main/java/io/netty/handler/codec/http/HttpUtil.java b/codec-http/src/main/java/io/netty/handler/codec/http/HttpUtil.java index 3cf648e612e0..3aa299e51583 100644 --- a/codec-http/src/main/java/io/netty/handler/codec/http/HttpUtil.java +++ b/codec-http/src/main/java/io/netty/handler/codec/http/HttpUtil.java @@ -196,8 +196,9 @@ public static long getContentLength(HttpMessage message, long defaultValue) { * Get an {@code int} representation of {@link #getContentLength(HttpMessage, long)}. * * @return the content length or {@code defaultValue} if this message does - * not have the {@code "Content-Length"} header or its value is not - * a number. Not to exceed the boundaries of integer. + * not have the {@code "Content-Length"} header. + * + * @throws NumberFormatException if the {@code "Content-Length"} header does not parse as an int */ public static int getContentLength(HttpMessage message, int defaultValue) { return (int) Math.min(Integer.MAX_VALUE, getContentLength(message, (long) defaultValue));