Skip to content

Commit

Permalink
Remove explicit unboxing (#1614)
Browse files Browse the repository at this point in the history
  • Loading branch information
hyperxpro authored Jul 24, 2023
1 parent 78ea8fd commit ae7f497
Show file tree
Hide file tree
Showing 8 changed files with 13 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,13 @@ public static int gracefulCloseDelay(Channel channel)
{
ChannelConfig channelConfig = channel.attr(BaseZuulChannelInitializer.ATTR_CHANNEL_CONFIG).get();
Integer gracefulCloseDelay = channelConfig.get(CommonChannelConfigKeys.connCloseDelay);
return gracefulCloseDelay == null ? 0 : gracefulCloseDelay.intValue();
return gracefulCloseDelay == null ? 0 : gracefulCloseDelay;
}

public static boolean allowGracefulDelayed(Channel channel)
{
ChannelConfig channelConfig = channel.attr(BaseZuulChannelInitializer.ATTR_CHANNEL_CONFIG).get();
Boolean value = channelConfig.get(CommonChannelConfigKeys.http2AllowGracefulDelayed);
return value == null ? false : value.booleanValue();
return value == null ? false : value;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ public boolean get(Channel ch)
{
Attribute<Boolean> attr = ch.attr(attributeKey);
Boolean value = attr.get();
return (value == null) ? false : value.booleanValue();
return (value == null) ? false : value;
}

public boolean get(ChannelHandlerContext ctx)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,10 +77,10 @@ public void log(Channel channel, HttpRequest request, HttpResponse response, Loc
requestId = requestId != null ? requestId : "-";

// Convert duration to microseconds.
String durationStr = (durationNs != null && durationNs.longValue() > 0) ? String.valueOf(durationNs / 1000) : "-";
String durationStr = (durationNs != null && durationNs > 0) ? String.valueOf(durationNs / 1000) : "-";

String requestBodySizeStr = (requestBodySize != null && requestBodySize.intValue() > 0) ? requestBodySize.toString() : "-";
String responseBodySizeStr = (responseBodySize != null && responseBodySize.intValue() > 0) ? responseBodySize.toString() : "-";
String requestBodySizeStr = (requestBodySize != null && requestBodySize > 0) ? requestBodySize.toString() : "-";
String responseBodySizeStr = (responseBodySize != null && responseBodySize > 0) ? responseBodySize.toString() : "-";


// Build the line.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,7 @@ public boolean getBoolean(String key) {
public boolean getBoolean(String key, boolean defaultResponse) {
Boolean b = (Boolean) get(key);
if (b != null) {
return b.booleanValue();
return b;
}
return defaultResponse;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ public boolean shouldFilter(HttpResponseMessage response) {
final HttpRequestInfo request = response.getInboundRequest();
final Boolean overrideIsGzipRequested = (Boolean) response.getContext().get(CommonContextKeys.OVERRIDE_GZIP_REQUESTED);
final boolean isGzipRequested = (overrideIsGzipRequested == null) ?
HttpUtils.acceptsGzip(request.getHeaders()) : overrideIsGzipRequested.booleanValue();
HttpUtils.acceptsGzip(request.getHeaders()) : overrideIsGzipRequested;

// Check the headers to see if response is already gzipped.
final Headers respHeaders = response.getHeaders();
Expand All @@ -97,7 +97,7 @@ protected Gzipper getGzipper() {
boolean isRightSizeForGzip(HttpResponseMessage response) {
final Integer bodySize = HttpUtils.getBodySizeIfKnown(response);
//bodySize == null is chunked encoding which is eligible for gzip compression
return (bodySize == null) || (bodySize.intValue() >= MIN_BODY_SIZE_FOR_GZIP.get());
return (bodySize == null) || (bodySize >= MIN_BODY_SIZE_FOR_GZIP.get());
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ public static HttpResponseMessage getResponseFromChannel(Channel ch) {

public static boolean isLastContentReceivedForChannel(Channel ch) {
Boolean value = ch.attr(ATTR_LAST_CONTENT_RECEIVED).get();
return value == null ? false : value.booleanValue();
return value == null ? false : value;
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -431,11 +431,11 @@ public static CurrentPassport parseFromToString(String text)
String stateName = stateMatch.group(2);
if (stateName.equals("NOW")) {
long startTime = passport.history.size() > 0 ? passport.firstTime() : 0;
long now = Long.valueOf(stateMatch.group(1)) + startTime;
long now = Long.parseLong(stateMatch.group(1)) + startTime;
ticker.setNow(now);
} else {
PassportState state = PassportState.valueOf(stateName);
PassportItem item = new PassportItem(state, Long.valueOf(stateMatch.group(1)));
PassportItem item = new PassportItem(state, Long.parseLong(stateMatch.group(1)));
passport.history.add(item);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ public static String stripMaliciousHeaderChars(@Nullable String input) {
public static boolean hasNonZeroContentLengthHeader(ZuulMessage msg)
{
final Integer contentLengthVal = getContentLengthIfPresent(msg);
return (contentLengthVal != null) && (contentLengthVal.intValue() > 0);
return (contentLengthVal != null) && (contentLengthVal > 0);
}

public static Integer getContentLengthIfPresent(ZuulMessage msg)
Expand Down

0 comments on commit ae7f497

Please sign in to comment.