Skip to content

Commit

Permalink
Correct javadocs of HttpUtil (netty#12114)
Browse files Browse the repository at this point in the history
Motivation:

We should mention that the method will throw if the number couldnt be parsed

Modifications:

Add some clarification to the javadocs

Result:

Fixes netty#12113
  • Loading branch information
normanmaurer authored Feb 21, 2022
1 parent 28fcf27 commit ec0fc8f
Showing 1 changed file with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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));
Expand Down

0 comments on commit ec0fc8f

Please sign in to comment.