Polishing

This commit is contained in:
Juergen Hoeller 2022-12-23 15:14:11 +01:00
parent d5ff232246
commit 254c3725e2
4 changed files with 16 additions and 14 deletions

View File

@ -89,6 +89,7 @@ class ResourceEntityResolverTests {
}
}
private static class ConfigurableFallbackEntityResolver extends ResourceEntityResolver {
private final boolean shouldThrow;
@ -98,7 +99,6 @@ class ResourceEntityResolverTests {
boolean fallbackInvoked = false;
private ConfigurableFallbackEntityResolver(boolean shouldThrow) {
super(new NoOpResourceLoader());
this.shouldThrow = shouldThrow;
@ -111,9 +111,8 @@ class ResourceEntityResolverTests {
this.returnValue = returnValue;
}
@Nullable
@Override
@Nullable
protected InputSource resolveSchemaEntity(String publicId, String systemId) {
this.fallbackInvoked = true;
if (this.shouldThrow) {
@ -123,6 +122,8 @@ class ResourceEntityResolverTests {
}
}
@SuppressWarnings("serial")
static class ResolutionRejectedException extends RuntimeException {}
}

View File

@ -51,7 +51,7 @@ import static org.mockito.Mockito.verify;
*/
public class SQLErrorCodeSQLExceptionTranslatorTests {
private static SQLErrorCodes ERROR_CODES = new SQLErrorCodes();
private static final SQLErrorCodes ERROR_CODES = new SQLErrorCodes();
static {
ERROR_CODES.setBadSqlGrammarCodes("1", "2");
ERROR_CODES.setInvalidResultSetAccessCodes("3", "4");
@ -64,6 +64,7 @@ public class SQLErrorCodeSQLExceptionTranslatorTests {
}
@SuppressWarnings("deprecation")
@Test
public void errorCodeTranslation() {
SQLExceptionTranslator sext = new SQLErrorCodeSQLExceptionTranslator(ERROR_CODES);

View File

@ -116,9 +116,9 @@ import org.springframework.web.util.WebUtils;
* {@link org.springframework.web.servlet.view.DefaultRequestToViewNameTranslator}.
*
* <li>The dispatcher's strategy for resolving multipart requests is determined by a
* {@link org.springframework.web.multipart.MultipartResolver} implementation. An
* implementation for Servlet 3 is included. The MultipartResolver bean name is
* "multipartResolver"; default is none.
* {@link org.springframework.web.multipart.MultipartResolver} implementation.
* An implementation for standard Servlet multipart processing is included.
* The MultipartResolver bean name is "multipartResolver"; default is none.
*
* <li>Its locale resolution strategy is determined by a {@link LocaleResolver}.
* Out-of-the-box implementations work via HTTP accept header, cookie, or session.
@ -318,8 +318,8 @@ public class DispatcherServlet extends FrameworkServlet {
private LocaleResolver localeResolver;
/** ThemeResolver used by this servlet. */
@Nullable
@Deprecated
@Nullable
private ThemeResolver themeResolver;
/** List of HandlerMappings used by this servlet. */
@ -808,8 +808,8 @@ public class DispatcherServlet extends FrameworkServlet {
* @return the ThemeSource, if any
* @see #getWebApplicationContext()
*/
@Nullable
@Deprecated
@Nullable
public final org.springframework.ui.context.ThemeSource getThemeSource() {
return (getWebApplicationContext() instanceof org.springframework.ui.context.ThemeSource ?
(org.springframework.ui.context.ThemeSource) getWebApplicationContext() : null);

View File

@ -171,8 +171,8 @@ public abstract class FrameworkServlet extends HttpServletBean implements Applic
/**
* HTTP methods supported by {@link jakarta.servlet.http.HttpServlet}.
*/
private static final Set<String> HTTP_SERVLET_METHODS = Set.of("DELETE", "HEAD", "GET", "OPTIONS", "POST", "PUT",
"TRACE");
private static final Set<String> HTTP_SERVLET_METHODS =
Set.of("DELETE", "HEAD", "GET", "OPTIONS", "POST", "PUT", "TRACE");
/** ServletContext attribute to find the WebApplicationContext in. */
@ -866,7 +866,8 @@ public abstract class FrameworkServlet extends HttpServletBean implements Applic
public void destroy() {
getServletContext().log("Destroying Spring FrameworkServlet '" + getServletName() + "'");
// Only call close() on WebApplicationContext if locally managed...
if (!this.webApplicationContextInjected && this.webApplicationContext instanceof ConfigurableApplicationContext cac) {
if (!this.webApplicationContextInjected &&
this.webApplicationContext instanceof ConfigurableApplicationContext cac) {
cac.close();
}
}
@ -1131,8 +1132,7 @@ public abstract class FrameworkServlet extends HttpServletBean implements Applic
logger.debug("Exiting from \"" + dispatchType + "\" dispatch, status " + status + headers);
}
else {
HttpStatusCode httpStatus = HttpStatusCode.valueOf(status);
logger.debug("Completed " + httpStatus + headers);
logger.debug("Completed " + HttpStatusCode.valueOf(status) + headers);
}
}