Some small improvements (#11564)

Signed-off-by: xingrufei <xingrufei@sogou-inc.com>
This commit is contained in:
skyguard1 2021-08-11 13:40:21 +02:00 committed by Chris Vest
parent b9ac4b62bf
commit 00d1dfb686
3 changed files with 3 additions and 3 deletions

View File

@ -411,7 +411,7 @@ public class DefaultHttp2LocalFlowController implements Http2LocalFlowController
window += delta;
processedWindow += delta;
lowerBound = delta < 0 ? delta : 0;
lowerBound = Math.min(delta, 0);
}
@Override

View File

@ -128,7 +128,7 @@ public class Http2ServerUpgradeCodec implements HttpServerUpgradeHandler.Upgrade
// Decode the HTTP2-Settings header and set the settings on the handler to make
// sure everything is fine with the request.
List<String> upgradeHeaders = upgradeRequest.headers().getAll(HTTP_UPGRADE_SETTINGS_HEADER);
if (upgradeHeaders.isEmpty() || upgradeHeaders.size() > 1) {
if (upgradeHeaders.size() != 1) {
throw new IllegalArgumentException("There must be 1 and only 1 "
+ HTTP_UPGRADE_SETTINGS_HEADER + " header.");
}

View File

@ -111,7 +111,7 @@ public final class HostsFileParser {
}
private static Map<String, ?> toMapWithSingleValue(Map<String, List<InetAddress>> fromMapWithListValue) {
Map<String, InetAddress> result = new HashMap<>();
Map<String, InetAddress> result = new HashMap<>(fromMapWithListValue.size());
for (Map.Entry<String, List<InetAddress>> entry : fromMapWithListValue.entrySet()) {
List<InetAddress> value = entry.getValue();
if (!value.isEmpty()) {