[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 Norman Maurer
parent 0acbe074bf
commit 172472c0c0

View File

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