Skip to content

Commit 5f5cd8a

Browse files
committed
Log resource path resolution failure at debug level (instead of warn)
Closes gh-26828
1 parent 46b7cd5 commit 5f5cd8a

File tree

2 files changed

+18
-18
lines changed

2 files changed

+18
-18
lines changed

spring-test/src/main/java/org/springframework/mock/web/MockServletContext.java

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2019 the original author or authors.
2+
* Copyright 2002-2021 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.
@@ -315,8 +315,8 @@ public Set<String> getResourcePaths(String path) {
315315
return resourcePaths;
316316
}
317317
catch (InvalidPathException | IOException ex ) {
318-
if (logger.isWarnEnabled()) {
319-
logger.warn("Could not get resource paths for " +
318+
if (logger.isDebugEnabled()) {
319+
logger.debug("Could not get resource paths for " +
320320
(resource != null ? resource : resourceLocation), ex);
321321
}
322322
return null;
@@ -339,8 +339,8 @@ public URL getResource(String path) throws MalformedURLException {
339339
throw ex;
340340
}
341341
catch (InvalidPathException | IOException ex) {
342-
if (logger.isWarnEnabled()) {
343-
logger.warn("Could not get URL for resource " +
342+
if (logger.isDebugEnabled()) {
343+
logger.debug("Could not get URL for resource " +
344344
(resource != null ? resource : resourceLocation), ex);
345345
}
346346
return null;
@@ -360,8 +360,8 @@ public InputStream getResourceAsStream(String path) {
360360
return resource.getInputStream();
361361
}
362362
catch (InvalidPathException | IOException ex) {
363-
if (logger.isWarnEnabled()) {
364-
logger.warn("Could not open InputStream for resource " +
363+
if (logger.isDebugEnabled()) {
364+
logger.debug("Could not open InputStream for resource " +
365365
(resource != null ? resource : resourceLocation), ex);
366366
}
367367
return null;
@@ -476,8 +476,8 @@ public String getRealPath(String path) {
476476
return resource.getFile().getAbsolutePath();
477477
}
478478
catch (InvalidPathException | IOException ex) {
479-
if (logger.isWarnEnabled()) {
480-
logger.warn("Could not determine real path of resource " +
479+
if (logger.isDebugEnabled()) {
480+
logger.debug("Could not determine real path of resource " +
481481
(resource != null ? resource : resourceLocation), ex);
482482
}
483483
return null;

spring-web/src/testFixtures/java/org/springframework/web/testfixture/servlet/MockServletContext.java

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2019 the original author or authors.
2+
* Copyright 2002-2021 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.
@@ -315,8 +315,8 @@ public Set<String> getResourcePaths(String path) {
315315
return resourcePaths;
316316
}
317317
catch (InvalidPathException | IOException ex ) {
318-
if (logger.isWarnEnabled()) {
319-
logger.warn("Could not get resource paths for " +
318+
if (logger.isDebugEnabled()) {
319+
logger.debug("Could not get resource paths for " +
320320
(resource != null ? resource : resourceLocation), ex);
321321
}
322322
return null;
@@ -339,8 +339,8 @@ public URL getResource(String path) throws MalformedURLException {
339339
throw ex;
340340
}
341341
catch (InvalidPathException | IOException ex) {
342-
if (logger.isWarnEnabled()) {
343-
logger.warn("Could not get URL for resource " +
342+
if (logger.isDebugEnabled()) {
343+
logger.debug("Could not get URL for resource " +
344344
(resource != null ? resource : resourceLocation), ex);
345345
}
346346
return null;
@@ -360,8 +360,8 @@ public InputStream getResourceAsStream(String path) {
360360
return resource.getInputStream();
361361
}
362362
catch (InvalidPathException | IOException ex) {
363-
if (logger.isWarnEnabled()) {
364-
logger.warn("Could not open InputStream for resource " +
363+
if (logger.isDebugEnabled()) {
364+
logger.debug("Could not open InputStream for resource " +
365365
(resource != null ? resource : resourceLocation), ex);
366366
}
367367
return null;
@@ -476,8 +476,8 @@ public String getRealPath(String path) {
476476
return resource.getFile().getAbsolutePath();
477477
}
478478
catch (InvalidPathException | IOException ex) {
479-
if (logger.isWarnEnabled()) {
480-
logger.warn("Could not determine real path of resource " +
479+
if (logger.isDebugEnabled()) {
480+
logger.debug("Could not determine real path of resource " +
481481
(resource != null ? resource : resourceLocation), ex);
482482
}
483483
return null;

0 commit comments

Comments
 (0)