Some small improvements (#11564)

Signed-off-by: xingrufei <xingrufei@sogou-inc.com>
This commit is contained in:
skyguard1 2021-08-11 19:40:21 +08:00 committed by GitHub
parent 3f8dab5ad0
commit 3c27e008b6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 3 additions and 3 deletions

View File

@ -410,7 +410,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<String, InetAddress>();
Map<String, InetAddress> result = new HashMap<String, InetAddress>(fromMapWithListValue.size());
for (Map.Entry<String, List<InetAddress>> entry : fromMapWithListValue.entrySet()) {
List<InetAddress> value = entry.getValue();
if (!value.isEmpty()) {