From 8123716d522880690ad1a64c363108933018a441 Mon Sep 17 00:00:00 2001 From: jvoisin Date: Wed, 24 Apr 2019 20:51:56 +0200 Subject: [PATCH 1/2] Remove unused loggers --- .../main/java/org/airsonic/player/ajax/MultiService.java | 6 +----- .../main/java/org/airsonic/player/ajax/StarService.java | 6 +----- .../main/java/org/airsonic/player/cache/CacheFactory.java | 4 ---- .../airsonic/player/controller/AccessDeniedController.java | 2 +- .../player/controller/ExportPlayListController.java | 5 ----- .../org/airsonic/player/controller/IndexController.java | 7 ------- .../org/airsonic/player/controller/LoginController.java | 6 ------ .../org/airsonic/player/controller/NotFoundController.java | 7 ------- .../src/main/java/org/airsonic/player/dao/ArtistDao.java | 4 ---- .../java/org/airsonic/player/dao/GenericDaoHelper.java | 4 ---- .../src/main/java/org/airsonic/player/dao/PlaylistDao.java | 4 ---- .../player/service/playlist/XspfPlaylistImportHandler.java | 4 ---- 12 files changed, 3 insertions(+), 56 deletions(-) diff --git a/airsonic-main/src/main/java/org/airsonic/player/ajax/MultiService.java b/airsonic-main/src/main/java/org/airsonic/player/ajax/MultiService.java index 2545d1f1..0addf13d 100644 --- a/airsonic-main/src/main/java/org/airsonic/player/ajax/MultiService.java +++ b/airsonic-main/src/main/java/org/airsonic/player/ajax/MultiService.java @@ -29,8 +29,6 @@ import org.airsonic.player.service.MediaFileService; import org.airsonic.player.service.SecurityService; import org.airsonic.player.service.SettingsService; import org.directwebremoting.WebContextFactory; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; @@ -51,8 +49,6 @@ import java.util.List; @Service("ajaxMultiService") public class MultiService { - private static final Logger LOG = LoggerFactory.getLogger(MultiService.class); - @Autowired private MediaFileService mediaFileService; @Autowired @@ -129,4 +125,4 @@ public class MultiService { public void setSettingsService(SettingsService settingsService) { this.settingsService = settingsService; } -} \ No newline at end of file +} diff --git a/airsonic-main/src/main/java/org/airsonic/player/ajax/StarService.java b/airsonic-main/src/main/java/org/airsonic/player/ajax/StarService.java index bb6658ad..014dbaa6 100644 --- a/airsonic-main/src/main/java/org/airsonic/player/ajax/StarService.java +++ b/airsonic-main/src/main/java/org/airsonic/player/ajax/StarService.java @@ -24,8 +24,6 @@ import org.airsonic.player.domain.User; import org.airsonic.player.service.SecurityService; import org.directwebremoting.WebContext; import org.directwebremoting.WebContextFactory; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; @@ -39,8 +37,6 @@ import org.springframework.stereotype.Service; @Service("ajaxStarService") public class StarService { - private static final Logger LOG = LoggerFactory.getLogger(StarService.class); - @Autowired private SecurityService securityService; @Autowired @@ -67,4 +63,4 @@ public class StarService { public void setMediaFileDao(MediaFileDao mediaFileDao) { this.mediaFileDao = mediaFileDao; } -} \ No newline at end of file +} diff --git a/airsonic-main/src/main/java/org/airsonic/player/cache/CacheFactory.java b/airsonic-main/src/main/java/org/airsonic/player/cache/CacheFactory.java index 825a35b7..e968474e 100644 --- a/airsonic-main/src/main/java/org/airsonic/player/cache/CacheFactory.java +++ b/airsonic-main/src/main/java/org/airsonic/player/cache/CacheFactory.java @@ -24,8 +24,6 @@ import net.sf.ehcache.Ehcache; import net.sf.ehcache.config.Configuration; import net.sf.ehcache.config.ConfigurationFactory; import org.airsonic.player.service.SettingsService; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; import org.springframework.beans.factory.InitializingBean; import java.io.File; @@ -37,8 +35,6 @@ import java.io.File; * @version $Id$ */ public class CacheFactory implements InitializingBean { - - private static final Logger LOG = LoggerFactory.getLogger(CacheFactory.class); private CacheManager cacheManager; public void afterPropertiesSet() throws Exception { diff --git a/airsonic-main/src/main/java/org/airsonic/player/controller/AccessDeniedController.java b/airsonic-main/src/main/java/org/airsonic/player/controller/AccessDeniedController.java index 844776f0..6fc7c29b 100644 --- a/airsonic-main/src/main/java/org/airsonic/player/controller/AccessDeniedController.java +++ b/airsonic-main/src/main/java/org/airsonic/player/controller/AccessDeniedController.java @@ -17,11 +17,11 @@ import javax.servlet.http.HttpServletResponse; @RequestMapping("/accessDenied") public class AccessDeniedController { - private static final Logger LOG = LoggerFactory.getLogger(AccessDeniedController.class); @RequestMapping(method = {RequestMethod.GET}) public ModelAndView accessDenied(HttpServletRequest request, HttpServletResponse response) { + LOG.info("The IP {0} tried to access the forbidden url {1}.", request.getRemoteAddr(), request.getRequestURL()) return new ModelAndView("accessDenied"); } diff --git a/airsonic-main/src/main/java/org/airsonic/player/controller/ExportPlayListController.java b/airsonic-main/src/main/java/org/airsonic/player/controller/ExportPlayListController.java index 5f33aa21..78f79ef7 100644 --- a/airsonic-main/src/main/java/org/airsonic/player/controller/ExportPlayListController.java +++ b/airsonic-main/src/main/java/org/airsonic/player/controller/ExportPlayListController.java @@ -4,8 +4,6 @@ import org.airsonic.player.domain.Playlist; import org.airsonic.player.service.PlaylistService; import org.airsonic.player.service.SecurityService; import org.airsonic.player.util.StringUtil; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.web.bind.ServletRequestUtils; @@ -23,9 +21,6 @@ import javax.servlet.http.HttpServletResponse; @RequestMapping("/exportPlaylist") public class ExportPlayListController { - - private static final Logger LOG = LoggerFactory.getLogger(ExportPlayListController.class); - @Autowired private PlaylistService playlistService; @Autowired diff --git a/airsonic-main/src/main/java/org/airsonic/player/controller/IndexController.java b/airsonic-main/src/main/java/org/airsonic/player/controller/IndexController.java index 0a6a4b1d..b384e966 100644 --- a/airsonic-main/src/main/java/org/airsonic/player/controller/IndexController.java +++ b/airsonic-main/src/main/java/org/airsonic/player/controller/IndexController.java @@ -3,8 +3,6 @@ package org.airsonic.player.controller; import org.airsonic.player.domain.UserSettings; import org.airsonic.player.service.SecurityService; import org.airsonic.player.service.SettingsService; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; @@ -20,9 +18,6 @@ import java.util.Map; @RequestMapping("/index") public class IndexController { - - private static final Logger LOG = LoggerFactory.getLogger(IndexController.class); - @Autowired private SecurityService securityService; @Autowired @@ -41,6 +36,4 @@ public class IndexController { map.put("brand", settingsService.getBrand()); return new ModelAndView("index", "model", map); } - - } diff --git a/airsonic-main/src/main/java/org/airsonic/player/controller/LoginController.java b/airsonic-main/src/main/java/org/airsonic/player/controller/LoginController.java index e1404495..d9029cf1 100644 --- a/airsonic-main/src/main/java/org/airsonic/player/controller/LoginController.java +++ b/airsonic-main/src/main/java/org/airsonic/player/controller/LoginController.java @@ -4,8 +4,6 @@ import org.airsonic.player.domain.User; import org.airsonic.player.service.SecurityService; import org.airsonic.player.service.SettingsService; import org.airsonic.player.util.StringUtil; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.security.web.authentication.UsernamePasswordAuthenticationFilter; import org.springframework.stereotype.Controller; @@ -26,9 +24,6 @@ import java.util.Map; @Controller public class LoginController { - - private static final Logger LOG = LoggerFactory.getLogger(LoginController.class); - @Autowired private SecurityService securityService; @Autowired @@ -62,5 +57,4 @@ public class LoginController { return new ModelAndView("login", "model", map); } - } diff --git a/airsonic-main/src/main/java/org/airsonic/player/controller/NotFoundController.java b/airsonic-main/src/main/java/org/airsonic/player/controller/NotFoundController.java index 67aded4c..784f0471 100644 --- a/airsonic-main/src/main/java/org/airsonic/player/controller/NotFoundController.java +++ b/airsonic-main/src/main/java/org/airsonic/player/controller/NotFoundController.java @@ -1,7 +1,5 @@ package org.airsonic.player.controller; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; @@ -17,13 +15,8 @@ import javax.servlet.http.HttpServletResponse; @RequestMapping("/notFound") public class NotFoundController { - - private static final Logger LOG = LoggerFactory.getLogger(NotFoundController.class); - @RequestMapping(method = {RequestMethod.GET}) public ModelAndView notFound(HttpServletRequest request, HttpServletResponse response) { return new ModelAndView("notFound"); } - - } diff --git a/airsonic-main/src/main/java/org/airsonic/player/dao/ArtistDao.java b/airsonic-main/src/main/java/org/airsonic/player/dao/ArtistDao.java index dd051711..8d3f94ae 100644 --- a/airsonic-main/src/main/java/org/airsonic/player/dao/ArtistDao.java +++ b/airsonic-main/src/main/java/org/airsonic/player/dao/ArtistDao.java @@ -21,8 +21,6 @@ package org.airsonic.player.dao; import org.airsonic.player.domain.Artist; import org.airsonic.player.domain.MusicFolder; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; import org.springframework.jdbc.core.RowMapper; import org.springframework.stereotype.Repository; import org.springframework.transaction.annotation.Transactional; @@ -38,8 +36,6 @@ import java.util.*; */ @Repository public class ArtistDao extends AbstractDao { - - private static final Logger LOG = LoggerFactory.getLogger(ArtistDao.class); private static final String INSERT_COLUMNS = "name, cover_art_path, album_count, last_scanned, present, folder_id"; private static final String QUERY_COLUMNS = "id, " + INSERT_COLUMNS; diff --git a/airsonic-main/src/main/java/org/airsonic/player/dao/GenericDaoHelper.java b/airsonic-main/src/main/java/org/airsonic/player/dao/GenericDaoHelper.java index 32528607..792df5e0 100644 --- a/airsonic-main/src/main/java/org/airsonic/player/dao/GenericDaoHelper.java +++ b/airsonic-main/src/main/java/org/airsonic/player/dao/GenericDaoHelper.java @@ -1,7 +1,5 @@ package org.airsonic.player.dao; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; import org.springframework.jdbc.core.JdbcTemplate; import org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate; @@ -9,8 +7,6 @@ import javax.sql.DataSource; public class GenericDaoHelper implements DaoHelper { - private static final Logger LOG = LoggerFactory.getLogger(GenericDaoHelper.class); - final JdbcTemplate jdbcTemplate; final NamedParameterJdbcTemplate namedParameterJdbcTemplate; diff --git a/airsonic-main/src/main/java/org/airsonic/player/dao/PlaylistDao.java b/airsonic-main/src/main/java/org/airsonic/player/dao/PlaylistDao.java index e6b20573..30fe2f60 100644 --- a/airsonic-main/src/main/java/org/airsonic/player/dao/PlaylistDao.java +++ b/airsonic-main/src/main/java/org/airsonic/player/dao/PlaylistDao.java @@ -21,8 +21,6 @@ package org.airsonic.player.dao; import org.airsonic.player.domain.MediaFile; import org.airsonic.player.domain.Playlist; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; import org.springframework.jdbc.core.RowMapper; import org.springframework.stereotype.Repository; import org.springframework.transaction.annotation.Transactional; @@ -38,8 +36,6 @@ import java.util.*; */ @Repository public class PlaylistDao extends AbstractDao { - - private static final Logger LOG = LoggerFactory.getLogger(PlaylistDao.class); private static final String INSERT_COLUMNS = "username, is_public, name, comment, file_count, duration_seconds, " + "created, changed, imported_from"; private static final String QUERY_COLUMNS = "id, " + INSERT_COLUMNS; diff --git a/airsonic-main/src/main/java/org/airsonic/player/service/playlist/XspfPlaylistImportHandler.java b/airsonic-main/src/main/java/org/airsonic/player/service/playlist/XspfPlaylistImportHandler.java index fff8bdc9..51f29a2c 100644 --- a/airsonic-main/src/main/java/org/airsonic/player/service/playlist/XspfPlaylistImportHandler.java +++ b/airsonic-main/src/main/java/org/airsonic/player/service/playlist/XspfPlaylistImportHandler.java @@ -7,8 +7,6 @@ import chameleon.playlist.xspf.StringContainer; import org.airsonic.player.domain.MediaFile; import org.airsonic.player.service.MediaFileService; import org.airsonic.player.util.Pair; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; @@ -21,8 +19,6 @@ import java.util.stream.Collectors; @Component public class XspfPlaylistImportHandler implements PlaylistImportHandler { - private static final Logger LOG = LoggerFactory.getLogger(XspfPlaylistImportHandler.class); - @Autowired MediaFileService mediaFileService; From 8f608485cbad143cbd9b4d30505604fd4e1e7ca8 Mon Sep 17 00:00:00 2001 From: jvoisin Date: Wed, 24 Apr 2019 20:56:18 +0200 Subject: [PATCH 2/2] Fix a typo --- .../org/airsonic/player/controller/AccessDeniedController.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/airsonic-main/src/main/java/org/airsonic/player/controller/AccessDeniedController.java b/airsonic-main/src/main/java/org/airsonic/player/controller/AccessDeniedController.java index 6fc7c29b..c6156282 100644 --- a/airsonic-main/src/main/java/org/airsonic/player/controller/AccessDeniedController.java +++ b/airsonic-main/src/main/java/org/airsonic/player/controller/AccessDeniedController.java @@ -21,7 +21,7 @@ public class AccessDeniedController { @RequestMapping(method = {RequestMethod.GET}) public ModelAndView accessDenied(HttpServletRequest request, HttpServletResponse response) { - LOG.info("The IP {0} tried to access the forbidden url {1}.", request.getRemoteAddr(), request.getRequestURL()) + LOG.info("The IP {0} tried to access the forbidden url {1}.", request.getRemoteAddr(), request.getRequestURL()); return new ModelAndView("accessDenied"); }