Skip to content

Commit 3c27e00

Browse files
authored
Some small improvements (#11564)
Signed-off-by: xingrufei <[email protected]>
1 parent 3f8dab5 commit 3c27e00

File tree

3 files changed

+3
-3
lines changed

3 files changed

+3
-3
lines changed

codec-http2/src/main/java/io/netty/handler/codec/http2/DefaultHttp2LocalFlowController.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -410,7 +410,7 @@ public void incrementFlowControlWindows(int delta) throws Http2Exception {
410410

411411
window += delta;
412412
processedWindow += delta;
413-
lowerBound = delta < 0 ? delta : 0;
413+
lowerBound = Math.min(delta, 0);
414414
}
415415

416416
@Override

codec-http2/src/main/java/io/netty/handler/codec/http2/Http2ServerUpgradeCodec.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ public boolean prepareUpgradeResponse(ChannelHandlerContext ctx, FullHttpRequest
128128
// Decode the HTTP2-Settings header and set the settings on the handler to make
129129
// sure everything is fine with the request.
130130
List<String> upgradeHeaders = upgradeRequest.headers().getAll(HTTP_UPGRADE_SETTINGS_HEADER);
131-
if (upgradeHeaders.isEmpty() || upgradeHeaders.size() > 1) {
131+
if (upgradeHeaders.size() != 1) {
132132
throw new IllegalArgumentException("There must be 1 and only 1 "
133133
+ HTTP_UPGRADE_SETTINGS_HEADER + " header.");
134134
}

resolver/src/main/java/io/netty/resolver/HostsFileParser.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ private static HostsFileEntries hostsFileEntries(HostsFileEntriesProvider provid
111111
}
112112

113113
private static Map<String, ?> toMapWithSingleValue(Map<String, List<InetAddress>> fromMapWithListValue) {
114-
Map<String, InetAddress> result = new HashMap<String, InetAddress>();
114+
Map<String, InetAddress> result = new HashMap<String, InetAddress>(fromMapWithListValue.size());
115115
for (Map.Entry<String, List<InetAddress>> entry : fromMapWithListValue.entrySet()) {
116116
List<InetAddress> value = entry.getValue();
117117
if (!value.isEmpty()) {

0 commit comments

Comments
 (0)