ok2c commented on code in PR #617:
URL:
https://github.com/apache/httpcomponents-core/pull/617#discussion_r2807693144
##########
httpcore5-h2/src/main/java/org/apache/hc/core5/http2/impl/nio/AbstractH2StreamMultiplexer.java:
##########
@@ -1378,19 +1382,29 @@ H2Stream createStream(final H2StreamChannel channel,
final H2StreamHandler strea
return stream;
}
- private void recordPriorityFromHeaders(final int streamId, final List<?
extends Header> headers) {
+ private void recordPriorityFromHeaders(final H2Stream stream, final List<?
extends Header> headers) {
if (headers == null || headers.isEmpty()) {
return;
}
for (final Header h : headers) {
if (HttpHeaders.PRIORITY.equalsIgnoreCase(h.getName())) {
- final PriorityValue pv =
PriorityParamsParser.parse(h.getValue()).toValueWithDefaults();
- priorities.put(streamId, pv);
+ final PriorityValue pv = parsePriorityValue(h.getValue());
+ if (pv != null) {
+ stream.setPriorityValue(pv);
+ }
break;
}
}
}
+ private PriorityValue parsePriorityValue(final String field) {
+ try {
+ return PriorityParamsParser.parse(field).toValueWithDefaults();
+ } catch (final RuntimeException ignore) {
Review Comment:
@arturobernalg Why is that? Why ignoring all runtime exceptions here
indiscriminately? What specific exception do you think should be ignored here?
##########
httpcore5-h2/src/main/java/org/apache/hc/core5/http2/impl/nio/AbstractH2StreamMultiplexer.java:
##########
@@ -1378,19 +1382,29 @@ H2Stream createStream(final H2StreamChannel channel,
final H2StreamHandler strea
return stream;
}
- private void recordPriorityFromHeaders(final int streamId, final List<?
extends Header> headers) {
+ private void recordPriorityFromHeaders(final H2Stream stream, final List<?
extends Header> headers) {
if (headers == null || headers.isEmpty()) {
return;
}
for (final Header h : headers) {
if (HttpHeaders.PRIORITY.equalsIgnoreCase(h.getName())) {
- final PriorityValue pv =
PriorityParamsParser.parse(h.getValue()).toValueWithDefaults();
- priorities.put(streamId, pv);
+ final PriorityValue pv = parsePriorityValue(h.getValue());
Review Comment:
@arturobernalg Use more efficient `#parse` method that takes `Header` as a
parameter.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]