From bc5246938d07820305167e581e7a8ece23ed265e Mon Sep 17 00:00:00 2001 From: Phillip Webb Date: Wed, 24 Jul 2013 16:50:27 -0700 Subject: [PATCH] Fix ResourceHttpRequestHandler empty location log Fix ResourceHttpRequestHandler to only log warning when locations is empty. Issue: SPR-10780 --- .../web/servlet/resource/ResourceHttpRequestHandler.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/spring-webmvc/src/main/java/org/springframework/web/servlet/resource/ResourceHttpRequestHandler.java b/spring-webmvc/src/main/java/org/springframework/web/servlet/resource/ResourceHttpRequestHandler.java index 0aff4060a2..f668d2a9c1 100644 --- a/spring-webmvc/src/main/java/org/springframework/web/servlet/resource/ResourceHttpRequestHandler.java +++ b/spring-webmvc/src/main/java/org/springframework/web/servlet/resource/ResourceHttpRequestHandler.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2012 the original author or authors. + * Copyright 2002-2013 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -34,6 +34,7 @@ import org.springframework.core.io.Resource; import org.springframework.http.MediaType; import org.springframework.util.Assert; import org.springframework.util.ClassUtils; +import org.springframework.util.CollectionUtils; import org.springframework.util.FileCopyUtils; import org.springframework.util.StringUtils; import org.springframework.web.HttpRequestHandler; @@ -95,7 +96,7 @@ public class ResourceHttpRequestHandler extends WebContentGenerator implements H @Override public void afterPropertiesSet() throws Exception { - if (logger.isWarnEnabled()) { + if (logger.isWarnEnabled() && CollectionUtils.isEmpty(this.locations)) { logger.warn("Locations list is empty. No resources will be served"); } }