Skip to content

Commit 65cd253

Browse files
Oblioolegz
authored andcommitted
unify logger declarations and replace deprecated nullable annotations
Signed-off-by: Oblio <oblio.leitch@vermont.gov>
1 parent cba1fbc commit 65cd253

8 files changed

Lines changed: 27 additions & 27 deletions

File tree

spring-cloud-function-adapters/spring-cloud-function-serverless-web/src/main/java/org/springframework/cloud/function/serverless/web/FunctionClassUtils.java

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@
4242
*/
4343
public final class FunctionClassUtils {
4444

45-
private static Log logger = LogFactory.getLog(FunctionClassUtils.class);
45+
private static final Log LOGGER = LogFactory.getLog(FunctionClassUtils.class);
4646

4747
private static Class<?> MAIN_CLASS;
4848

@@ -91,20 +91,20 @@ else if (System.getProperty("MAIN_CLASS") != null) {
9191
+ "entry in META-INF/MANIFEST.MF (in that order).", ex);
9292
}
9393
}
94-
logger.info("Main class: " + mainClass);
94+
LOGGER.info("Main class: " + mainClass);
9595
return mainClass;
9696
}
9797

9898
private static Class<?> getStartClass(List<URL> list, ClassLoader classLoader) {
99-
if (logger.isTraceEnabled()) {
100-
logger.trace("Searching manifests: " + list);
99+
if (LOGGER.isTraceEnabled()) {
100+
LOGGER.trace("Searching manifests: " + list);
101101
}
102102
for (URL url : list) {
103103
try {
104104
InputStream inputStream = null;
105105
Manifest manifest = new Manifest(url.openStream());
106-
logger.info("Searching for start class in manifest: " + url);
107-
if (logger.isDebugEnabled()) {
106+
LOGGER.info("Searching for start class in manifest: " + url);
107+
if (LOGGER.isDebugEnabled()) {
108108
manifest.write(System.out);
109109
}
110110
try {
@@ -135,7 +135,7 @@ private static Class<?> getStartClass(List<URL> list, ClassLoader classLoader) {
135135
}
136136
}
137137
catch (Exception ex) {
138-
logger.debug("Failed to determine Start-Class in manifest file of " + url, ex);
138+
LOGGER.debug("Failed to determine Start-Class in manifest file of " + url, ex);
139139
}
140140
}
141141
return null;

spring-cloud-function-adapters/spring-cloud-function-serverless-web/src/main/java/org/springframework/cloud/function/serverless/web/ServerlessAsyncContext.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,8 @@
3131
import jakarta.servlet.http.HttpServletRequest;
3232
import jakarta.servlet.http.HttpServletResponse;
3333

34+
import org.jspecify.annotations.Nullable;
3435
import org.springframework.beans.BeanUtils;
35-
import org.springframework.lang.Nullable;
3636
import org.springframework.util.Assert;
3737
import org.springframework.web.util.WebUtils;
3838

spring-cloud-function-adapters/spring-cloud-function-serverless-web/src/main/java/org/springframework/cloud/function/serverless/web/ServerlessAutoConfiguration.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@
4343
@AutoConfiguration(beforeName = "org.springframework.boot.autoconfigure.web.servlet.ServletWebServerFactoryAutoConfiguration")
4444
@Configuration(proxyBeanMethods = false)
4545
public class ServerlessAutoConfiguration {
46-
private static Log logger = LogFactory.getLog(ServerlessAutoConfiguration.class);
46+
private static final Log LOGGER = LogFactory.getLog(ServerlessAutoConfiguration.class);
4747

4848
@Bean
4949
@ConditionalOnMissingBean
@@ -85,14 +85,14 @@ public void setApplicationContext(ApplicationContext applicationContext) throws
8585
@Override
8686
public void afterPropertiesSet() throws Exception {
8787
if (applicationContext instanceof ServletWebServerApplicationContext servletApplicationContext) {
88-
logger.info("Configuring Serverless Web Container");
88+
LOGGER.info("Configuring Serverless Web Container");
8989
ServerlessServletContext servletContext = new ServerlessServletContext();
9090
servletApplicationContext.setServletContext(servletContext);
9191
DispatcherServlet dispatcher = applicationContext.getBean(DispatcherServlet.class);
9292
try {
93-
logger.info("Initializing DispatcherServlet");
93+
LOGGER.info("Initializing DispatcherServlet");
9494
dispatcher.init(new ProxyServletConfig(servletApplicationContext.getServletContext()));
95-
logger.info("Initialized DispatcherServlet");
95+
LOGGER.info("Initialized DispatcherServlet");
9696
}
9797
catch (Exception e) {
9898
throw new IllegalStateException("Failed to create Spring MVC DispatcherServlet proxy", e);
@@ -102,7 +102,7 @@ public void afterPropertiesSet() throws Exception {
102102
}
103103
}
104104
else {
105-
logger.debug("Skipping Serverless configuration for " + this.applicationContext);
105+
LOGGER.debug("Skipping Serverless configuration for " + this.applicationContext);
106106
}
107107
}
108108
}

spring-cloud-function-adapters/spring-cloud-function-serverless-web/src/main/java/org/springframework/cloud/function/serverless/web/ServerlessHttpServletRequest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,8 +59,8 @@
5959
import jakarta.servlet.http.HttpUpgradeHandler;
6060
import jakarta.servlet.http.Part;
6161

62+
import org.jspecify.annotations.Nullable;
6263
import org.springframework.http.HttpHeaders;
63-
import org.springframework.lang.Nullable;
6464
import org.springframework.util.Assert;
6565
import org.springframework.util.CollectionUtils;
6666
import org.springframework.util.LinkedMultiValueMap;

spring-cloud-function-adapters/spring-cloud-function-serverless-web/src/main/java/org/springframework/cloud/function/serverless/web/ServerlessHttpServletResponse.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,8 @@
3939
import jakarta.servlet.http.Cookie;
4040
import jakarta.servlet.http.HttpServletResponse;
4141

42+
import org.jspecify.annotations.Nullable;
4243
import org.springframework.http.HttpHeaders;
43-
import org.springframework.lang.Nullable;
4444
import org.springframework.util.Assert;
4545
import org.springframework.web.util.WebUtils;
4646

spring-cloud-function-adapters/spring-cloud-function-serverless-web/src/main/java/org/springframework/cloud/function/serverless/web/ServerlessMVC.java

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -47,11 +47,11 @@
4747
import org.apache.commons.logging.Log;
4848
import org.apache.commons.logging.LogFactory;
4949

50+
import org.jspecify.annotations.Nullable;
5051
import org.springframework.boot.SpringApplication;
5152
import org.springframework.boot.web.server.servlet.context.ServletWebServerApplicationContext;
5253
import org.springframework.boot.webmvc.autoconfigure.DispatcherServletAutoConfiguration;
5354
import org.springframework.http.HttpStatus;
54-
import org.springframework.lang.Nullable;
5555
import org.springframework.util.Assert;
5656
import org.springframework.util.ObjectUtils;
5757
import org.springframework.util.StringUtils;
@@ -74,7 +74,7 @@ public final class ServerlessMVC {
7474
*/
7575
public static String INIT_TIMEOUT = "contextInitTimeout";
7676

77-
private static Log LOG = LogFactory.getLog(ServerlessMVC.class);
77+
private static final Log LOGGER = LogFactory.getLog(ServerlessMVC.class);
7878

7979
private volatile DispatcherServlet dispatcher;
8080

@@ -109,16 +109,16 @@ private ServerlessMVC() {
109109
private void initializeContextAsync(Class<?>... componentClasses) {
110110
new Thread(() -> {
111111
try {
112-
LOG.info("Starting application with the following configuration classes:");
113-
Stream.of(componentClasses).forEach(clazz -> LOG.info(clazz.getSimpleName()));
112+
LOGGER.info("Starting application with the following configuration classes:");
113+
Stream.of(componentClasses).forEach(clazz -> LOGGER.info(clazz.getSimpleName()));
114114
initContext(componentClasses);
115115
}
116116
catch (Exception e) {
117117
throw new IllegalStateException(e);
118118
}
119119
finally {
120120
contextStartupLatch.countDown();
121-
LOG.info("Application is started successfully.");
121+
LOGGER.info("Application is started successfully.");
122122
}
123123
}).start();
124124
}
@@ -230,7 +230,7 @@ private static class ProxyFilterChain implements FilterChain {
230230
filters.add(serverlessFilterRegistration.getFilter());
231231
}
232232
else {
233-
LOG.debug("Skipping unsupported filter registration type '" + registration.getClass().getName()
233+
LOGGER.debug("Skipping unsupported filter registration type '" + registration.getClass().getName()
234234
+ "' for filter '" + entry.getKey() + "'");
235235
}
236236
}
@@ -325,7 +325,7 @@ public void doFilter(ServletRequest request, ServletResponse response, FilterCha
325325
((ServerlessHttpServletRequest) request).setRequestURI("/error");
326326
}
327327

328-
LOG.error("Failed processing the request to: " + ((HttpServletRequest) request).getRequestURI(), e);
328+
LOGGER.error("Failed processing the request to: " + ((HttpServletRequest) request).getRequestURI(), e);
329329

330330
this.delegateServlet.service(request, response);
331331
}

spring-cloud-function-adapters/spring-cloud-function-serverless-web/src/main/java/org/springframework/cloud/function/serverless/web/ServerlessServletContext.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@
5858
*/
5959
public class ServerlessServletContext implements ServletContext {
6060

61-
private Log logger = LogFactory.getLog(ServerlessServletContext.class);
61+
private static final Log LOGGER = LogFactory.getLog(ServerlessServletContext.class);
6262

6363
private HashMap<String, Object> attributes = new HashMap<>();
6464

@@ -145,12 +145,12 @@ public RequestDispatcher getNamedDispatcher(String name) {
145145

146146
@Override
147147
public void log(String msg) {
148-
this.logger.info(msg);
148+
this.LOGGER.info(msg);
149149
}
150150

151151
@Override
152152
public void log(String message, Throwable throwable) {
153-
this.logger.error(message, throwable);
153+
this.LOGGER.error(message, throwable);
154154
}
155155

156156
@Override

spring-cloud-function-adapters/spring-cloud-function-serverless-web/src/main/java/org/springframework/cloud/function/serverless/web/ServerlessWebApplication.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@
7474
*/
7575
public class ServerlessWebApplication extends SpringApplication {
7676

77-
private static final Log logger = LogFactory.getLog(ServerlessWebApplication.class);
77+
private static final Log LOGGER = LogFactory.getLog(ServerlessWebApplication.class);
7878

7979
private ApplicationStartup applicationStartup = ApplicationStartup.DEFAULT;
8080

@@ -151,7 +151,7 @@ private SpringApplicationRunListeners getRunListeners(String[] args) {
151151
ArgumentResolver argumentResolver = ArgumentResolver.of(SpringApplication.class, this);
152152
argumentResolver = argumentResolver.and(String[].class, args);
153153
List<SpringApplicationRunListener> listeners = getSpringFactoriesInstances(SpringApplicationRunListener.class, argumentResolver);
154-
return new SpringApplicationRunListeners(logger, listeners, this.applicationStartup);
154+
return new SpringApplicationRunListeners(LOGGER, listeners, this.applicationStartup);
155155
}
156156

157157
private Banner printBanner(ConfigurableEnvironment environment) {

0 commit comments

Comments
 (0)