codec-http2: Exception as cause, not message format argument (#11084)

Motivation:

There are several overloads of streamError(), with one receiving the
Throwable to be made the cause of the new exception. However, the wrong
overload was being called and instead the IllegalArgumentException was
being passed as a message format argument which was summarily thrown
away as the message format didn't reference it.

Modifications:

Move IllegalArgumentException to proper argument position.

Result:

A useful exception, with the underlying cause available.
This commit is contained in:
Eric Anderson 2021-03-14 06:12:41 -07:00 committed by Norman Maurer
parent 8da6ed3fc0
commit 1914679b00

View File

@ -397,8 +397,8 @@ public class DefaultHttp2ConnectionDecoder implements Http2ConnectionDecoder {
stream.setProperty(contentLengthKey, new ContentLength(cLength));
}
} catch (IllegalArgumentException e) {
throw streamError(stream.id(), PROTOCOL_ERROR,
"Multiple content-length headers received", e);
throw streamError(stream.id(), PROTOCOL_ERROR, e,
"Multiple content-length headers received");
}
}
}