From 172472c0c047bf99e85d43134e3aede612c3940d Mon Sep 17 00:00:00 2001 From: Bennett Lynch Date: Mon, 8 Mar 2021 23:02:26 -0800 Subject: [PATCH] [HttpObjectDecoder] Include hex-value of illegal whitespace char (#11067) Motivation: HttpObjectDecoder may throw an IllegalArgumentException if it encounters a character that Character.isWhitespace() returns true for, but is not one of the two valid OWS (optional whitespace) values. Such values may not have friendly or readable toString() values. We should include the hex value so that the illegal character can always be determined. Modifications: Add hex value as well Result: Easier to debug Co-authored-by: Bennett Lynch --- .../java/io/netty/handler/codec/http/HttpObjectDecoder.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/codec-http/src/main/java/io/netty/handler/codec/http/HttpObjectDecoder.java b/codec-http/src/main/java/io/netty/handler/codec/http/HttpObjectDecoder.java index f2cc0084b1..3482fba8cd 100644 --- a/codec-http/src/main/java/io/netty/handler/codec/http/HttpObjectDecoder.java +++ b/codec-http/src/main/java/io/netty/handler/codec/http/HttpObjectDecoder.java @@ -890,7 +890,7 @@ public abstract class HttpObjectDecoder extends ByteToMessageDecoder { } else if (validateOWS && !isOWS(c)) { // Only OWS is supported for whitespace throw new IllegalArgumentException("Invalid separator, only a single space or horizontal tab allowed," + - " but received a '" + c + "'"); + " but received a '" + c + "' (0x" + Integer.toHexString(c) + ")"); } } return sb.length();