[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 <Bennett-Lynch@users.noreply.github.com>
This commit is contained in:
Bennett Lynch 2021-03-08 23:02:26 -08:00 committed by GitHub
parent 4f498709d4
commit bf9b90c340
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -905,7 +905,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();