Fix ResourceHttpRequestHandler empty location log

Fix ResourceHttpRequestHandler to only log warning when locations
is empty.

Issue: SPR-10780
(cherry picked from bc52469)
This commit is contained in:
Phillip Webb 2013-07-24 16:50:27 -07:00
parent 440a63a3d0
commit 8feeec4a60
1 changed files with 3 additions and 2 deletions

View File

@ -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"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with 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.http.MediaType;
import org.springframework.util.Assert; import org.springframework.util.Assert;
import org.springframework.util.ClassUtils; import org.springframework.util.ClassUtils;
import org.springframework.util.CollectionUtils;
import org.springframework.util.FileCopyUtils; import org.springframework.util.FileCopyUtils;
import org.springframework.util.StringUtils; import org.springframework.util.StringUtils;
import org.springframework.web.HttpRequestHandler; import org.springframework.web.HttpRequestHandler;
@ -94,7 +95,7 @@ public class ResourceHttpRequestHandler extends WebContentGenerator implements H
} }
public void afterPropertiesSet() throws Exception { 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"); logger.warn("Locations list is empty. No resources will be served");
} }
} }