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 GitHub
parent 773ecb81fe
commit c651baa570
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -404,8 +404,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");
}
}
}