提交 695bf296 编写于 作者: J Juergen Hoeller

Consistent trace logging in PathResourceResolver

Issue: SPR-16616
上级 53d01392
......@@ -118,10 +118,10 @@ public class PathResourceResolver extends AbstractResourceResolver {
}
else if (logger.isTraceEnabled()) {
Resource[] allowedLocations = getAllowedLocations();
logger.trace("Resource path=\"" + resourcePath + "\" was successfully resolved " +
"but resource=\"" + resource.getURL() + "\" is neither under the " +
"current location=\"" + location.getURL() + "\" nor under any of the " +
"allowed locations=" + (allowedLocations != null ? Arrays.asList(allowedLocations) : "[]"));
logger.trace("Resource path \"" + resourcePath + "\" was successfully resolved " +
"but resource \"" + resource.getURL() + "\" is neither under the " +
"current location \"" + location.getURL() + "\" nor under any of the " +
"allowed locations " + (allowedLocations != null ? Arrays.asList(allowedLocations) : "[]"));
}
}
else if (logger.isTraceEnabled()) {
......@@ -195,7 +195,7 @@ public class PathResourceResolver extends AbstractResourceResolver {
String decodedPath = URLDecoder.decode(resourcePath, "UTF-8");
if (decodedPath.contains("../") || decodedPath.contains("..\\")) {
if (logger.isTraceEnabled()) {
logger.trace("Ignoring invalid resource path with escape sequences [" + resourcePath + "]");
logger.trace("Resolved resource path contains encoded \"../\" or \"..\\\": " + resourcePath);
}
return true;
}
......
......@@ -189,10 +189,10 @@ public class PathResourceResolver extends AbstractResourceResolver {
}
else if (logger.isTraceEnabled()) {
Resource[] allowedLocations = getAllowedLocations();
logger.trace("Resource path=\"" + resourcePath + "\" was successfully resolved " +
"but resource=\"" + resource.getURL() + "\" is neither under the " +
"current location=\"" + location.getURL() + "\" nor under any of the " +
"allowed locations=" + (allowedLocations != null ? Arrays.asList(allowedLocations) : "[]"));
logger.trace("Resource path \"" + resourcePath + "\" was successfully resolved " +
"but resource \"" + resource.getURL() + "\" is neither under the " +
"current location \"" + location.getURL() + "\" nor under any of the " +
"allowed locations " + (allowedLocations != null ? Arrays.asList(allowedLocations) : "[]"));
}
}
return null;
......@@ -286,7 +286,7 @@ public class PathResourceResolver extends AbstractResourceResolver {
String decodedPath = URLDecoder.decode(resourcePath, "UTF-8");
if (decodedPath.contains("../") || decodedPath.contains("..\\")) {
if (logger.isTraceEnabled()) {
logger.trace("Ignoring invalid resource path with escape sequences [" + resourcePath + "]");
logger.trace("Resolved resource path contains encoded \"../\" or \"..\\\": " + resourcePath);
}
return true;
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册