Skip to content

Commit ae8f680

Browse files
committed
Polishing
1 parent bf272b0 commit ae8f680

File tree

6 files changed

+25
-12
lines changed

6 files changed

+25
-12
lines changed

spring-context/src/test/java/org/springframework/tests/mock/jndi/ExpectedLookupTemplate.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2016 the original author or authors.
2+
* Copyright 2002-2018 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -53,6 +53,7 @@ public ExpectedLookupTemplate(String name, Object object) {
5353
addObject(name, object);
5454
}
5555

56+
5657
/**
5758
* Add the given object to the list of JNDI objects that this template will expose.
5859
* @param name the name the client is expected to look up

spring-test/src/main/java/org/springframework/mock/jndi/ExpectedLookupTemplate.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2016 the original author or authors.
2+
* Copyright 2002-2018 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -53,6 +53,7 @@ public ExpectedLookupTemplate(String name, Object object) {
5353
addObject(name, object);
5454
}
5555

56+
5657
/**
5758
* Add the given object to the list of JNDI objects that this template will expose.
5859
* @param name the name the client is expected to look up

spring-web/src/main/java/org/springframework/web/server/ServerWebExchange.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -148,9 +148,9 @@ default <T> T getAttributeOrDefault(String name, T defaultValue) {
148148
/**
149149
* Return the {@link ApplicationContext} associated with the web application,
150150
* if it was initialized with one via
151-
* {@link org.springframework.web.server.adapter.WebHttpHandlerBuilder#applicationContext}.
151+
* {@link org.springframework.web.server.adapter.WebHttpHandlerBuilder#applicationContext(ApplicationContext)}.
152152
* @since 5.0.3
153-
* @see org.springframework.web.server.adapter.WebHttpHandlerBuilder#applicationContext
153+
* @see org.springframework.web.server.adapter.WebHttpHandlerBuilder#applicationContext(ApplicationContext)
154154
*/
155155
@Nullable
156156
ApplicationContext getApplicationContext();

spring-webflux/src/main/java/org/springframework/web/reactive/function/BodyInserters.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -264,8 +264,7 @@ public static <T, P extends Publisher<T>> MultipartInserter fromMultipartAsyncDa
264264
}
265265

266266
/**
267-
* Inserter to write the given
268-
* {@code Publisher<DataBuffer>} to the body.
267+
* Inserter to write the given {@code Publisher<DataBuffer>} to the body.
269268
* @param publisher the data buffer publisher to write
270269
* @param <T> the type of the publisher
271270
* @return the inserter to write directly to the body

spring-webflux/src/main/java/org/springframework/web/reactive/resource/ResourceWebHandler.java

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -494,18 +494,24 @@ private boolean isInvalidEncodedPath(String path) {
494494
*/
495495
protected boolean isInvalidPath(String path) {
496496
if (path.contains("WEB-INF") || path.contains("META-INF")) {
497-
logger.warn("Path with \"WEB-INF\" or \"META-INF\": [" + path + "]");
497+
if (logger.isWarnEnabled()) {
498+
logger.warn("Path with \"WEB-INF\" or \"META-INF\": [" + path + "]");
499+
}
498500
return true;
499501
}
500502
if (path.contains(":/")) {
501503
String relativePath = (path.charAt(0) == '/' ? path.substring(1) : path);
502504
if (ResourceUtils.isUrl(relativePath) || relativePath.startsWith("url:")) {
503-
logger.warn("Path represents URL or has \"url:\" prefix: [" + path + "]");
505+
if (logger.isWarnEnabled()) {
506+
logger.warn("Path represents URL or has \"url:\" prefix: [" + path + "]");
507+
}
504508
return true;
505509
}
506510
}
507511
if (path.contains("..") && StringUtils.cleanPath(path).contains("../")) {
508-
logger.warn("Path contains \"../\" after call to StringUtils#cleanPath: [" + path + "]");
512+
if (logger.isWarnEnabled()) {
513+
logger.warn("Path contains \"../\" after call to StringUtils#cleanPath: [" + path + "]");
514+
}
509515
return true;
510516
}
511517
return false;

spring-webmvc/src/main/java/org/springframework/web/servlet/resource/ResourceHttpRequestHandler.java

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -630,18 +630,24 @@ private boolean isInvalidEncodedPath(String path) {
630630
*/
631631
protected boolean isInvalidPath(String path) {
632632
if (path.contains("WEB-INF") || path.contains("META-INF")) {
633-
logger.warn("Path with \"WEB-INF\" or \"META-INF\": [" + path + "]");
633+
if (logger.isWarnEnabled()) {
634+
logger.warn("Path with \"WEB-INF\" or \"META-INF\": [" + path + "]");
635+
}
634636
return true;
635637
}
636638
if (path.contains(":/")) {
637639
String relativePath = (path.charAt(0) == '/' ? path.substring(1) : path);
638640
if (ResourceUtils.isUrl(relativePath) || relativePath.startsWith("url:")) {
639-
logger.warn("Path represents URL or has \"url:\" prefix: [" + path + "]");
641+
if (logger.isWarnEnabled()) {
642+
logger.warn("Path represents URL or has \"url:\" prefix: [" + path + "]");
643+
}
640644
return true;
641645
}
642646
}
643647
if (path.contains("..") && StringUtils.cleanPath(path).contains("../")) {
644-
logger.warn("Invalid Path contains \"../\" after call to StringUtils#cleanPath: [" + path + "]");
648+
if (logger.isWarnEnabled()) {
649+
logger.warn("Path contains \"../\" after call to StringUtils#cleanPath: [" + path + "]");
650+
}
645651
return true;
646652
}
647653
return false;

0 commit comments

Comments
 (0)