Further polishing regarding JDK baseline upgrade

See gh-28440
This commit is contained in:
Sam Brannen
2022-05-10 16:58:27 +02:00
parent a892ce80c1
commit eb50a6f4a0
11 changed files with 45 additions and 51 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2021 the original author or authors.
* Copyright 2002-2022 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -423,7 +423,7 @@ public class MockHttpServletResponse implements HttpServletResponse {
buf.append("; Domain=").append(cookie.getDomain());
}
int maxAge = cookie.getMaxAge();
ZonedDateTime expires = (cookie instanceof MockCookie ? ((MockCookie) cookie).getExpires() : null);
ZonedDateTime expires = (cookie instanceof MockCookie mockCookie? mockCookie.getExpires() : null);
if (maxAge >= 0) {
buf.append("; Max-Age=").append(maxAge);
buf.append("; Expires=");
@@ -692,7 +692,7 @@ public class MockHttpServletResponse implements HttpServletResponse {
return true;
}
else if (HttpHeaders.CONTENT_LENGTH.equalsIgnoreCase(name)) {
setContentLength(value instanceof Number ? ((Number) value).intValue() :
setContentLength(value instanceof Number number ? number.intValue() :
Integer.parseInt(value.toString()));
return true;
}