From d6d53ef2f6b205eafbeee94e8e11ad802b733258 Mon Sep 17 00:00:00 2001 From: Andrew DeMaria Date: Fri, 13 Jan 2017 19:41:28 -0700 Subject: [PATCH 1/3] Standardize import order and add maven plugin to check Signed-off-by: Andrew DeMaria --- checkstyle.xml | 25 ++++++ libresonic-main/pom.xml | 4 + .../src/main/java/org/json/JSONObject.java | 10 +-- .../src/main/java/org/json/JSONTokener.java | 7 +- .../java/org/libresonic/player/Logger.java | 22 +++-- .../libresonic/player/ajax/ArtistInfo.java | 4 +- .../libresonic/player/ajax/ChatService.java | 13 ++- .../player/ajax/CoverArtService.java | 13 ++- .../libresonic/player/ajax/LyricsService.java | 9 +-- .../libresonic/player/ajax/MultiService.java | 21 ++--- .../player/ajax/NowPlayingService.java | 20 ++--- .../libresonic/player/ajax/PlayQueueInfo.java | 4 +- .../player/ajax/PlayQueueService.java | 43 +++------- .../libresonic/player/ajax/PlaylistInfo.java | 5 +- .../player/ajax/PlaylistService.java | 10 +-- .../libresonic/player/ajax/StarService.java | 4 +- .../libresonic/player/ajax/TagService.java | 1 - .../player/ajax/TransferService.java | 8 +- .../libresonic/player/cache/CacheFactory.java | 9 +-- .../command/MusicFolderSettingsCommand.java | 8 +- .../command/PasswordSettingsCommand.java | 2 +- .../command/PersonalSettingsCommand.java | 10 +-- .../player/command/PlayerSettingsCommand.java | 6 +- .../player/command/SearchCommand.java | 8 +- .../controller/AbstractChartController.java | 10 +-- .../AdvancedSettingsController.java | 2 - .../player/controller/AllmusicController.java | 4 +- .../player/controller/AutoCoverDemo.java | 13 +-- .../player/controller/AvatarController.java | 13 ++- .../controller/AvatarUploadController.java | 12 +-- .../controller/ChangeCoverArtController.java | 1 + .../player/controller/CoverArtController.java | 1 + .../player/controller/DBController.java | 1 + .../controller/DLNASettingsController.java | 15 ++-- .../player/controller/DownloadController.java | 51 ++++-------- .../player/controller/EditTagsController.java | 1 + .../controller/ExternalPlayerController.java | 1 + .../controller/GettingStartedController.java | 6 +- .../player/controller/HLSController.java | 33 ++++---- .../player/controller/HelpController.java | 20 +++-- .../player/controller/HomeController.java | 1 + .../controller/ImportPlaylistController.java | 20 +++-- .../player/controller/IndexController.java | 6 +- .../InternetRadioSettingsController.java | 7 +- .../player/controller/JAXBWriter.java | 27 +++---- .../player/controller/LeftController.java | 1 + .../player/controller/LoginController.java | 4 +- .../player/controller/LyricsController.java | 4 +- .../player/controller/M3UController.java | 1 + .../player/controller/MainController.java | 1 + .../player/controller/MoreController.java | 1 + .../controller/NowPlayingController.java | 1 + .../PersonalSettingsController.java | 2 +- .../controller/PlayQueueController.java | 1 + .../controller/PlayerSettingsController.java | 2 +- .../player/controller/PlaylistController.java | 2 +- .../controller/PlaylistsController.java | 28 +++---- .../controller/PodcastChannelController.java | 1 + .../controller/PodcastChannelsController.java | 1 + .../player/controller/PodcastController.java | 1 + .../player/controller/ProxyController.java | 1 + .../player/controller/RESTController.java | 1 + .../controller/RandomPlayQueueController.java | 15 ++-- .../player/controller/RecoverController.java | 1 + .../player/controller/RightController.java | 1 + .../player/controller/SearchController.java | 1 + .../player/controller/SettingsController.java | 3 - .../controller/ShareManagementController.java | 1 + .../controller/ShareSettingsController.java | 10 +-- .../controller/SonosSettingsController.java | 3 +- .../player/controller/StarredController.java | 1 + .../controller/StatusChartController.java | 26 +++--- .../player/controller/StatusController.java | 1 + .../player/controller/StreamController.java | 52 +++++------- .../player/controller/TopController.java | 2 +- .../TranscodingSettingsController.java | 8 +- .../player/controller/UploadController.java | 1 + .../controller/UserChartController.java | 17 ++-- .../controller/UserSettingsController.java | 7 +- .../controller/VideoPlayerController.java | 1 + .../libresonic/player/dao/AbstractDao.java | 18 ++--- .../org/libresonic/player/dao/ArtistDao.java | 7 +- .../org/libresonic/player/dao/DaoHelper.java | 3 +- .../player/dao/GenericDaoHelper.java | 3 +- .../player/dao/InternetRadioDao.java | 5 +- .../libresonic/player/dao/MediaFileDao.java | 5 +- .../libresonic/player/dao/PlaylistDao.java | 6 +- .../org/libresonic/player/dao/RatingDao.java | 10 +-- .../libresonic/player/domain/MediaFile.java | 12 ++- .../libresonic/player/domain/MusicFolder.java | 8 +- .../libresonic/player/domain/PlayQueue.java | 10 +-- .../player/domain/PodcastEpisode.java | 2 - .../player/domain/SearchResult.java | 5 +- .../player/domain/TransferStatus.java | 4 +- .../filter/BootstrapVerificationFilter.java | 8 +- .../filter/ParameterDecodingFilter.java | 1 + .../libresonic/player/filter/RESTFilter.java | 20 ++--- .../player/filter/RequestEncodingFilter.java | 5 +- .../player/filter/ResponseHeaderFilter.java | 7 +- .../player/i18n/LibresonicLocaleResolver.java | 18 +++-- .../player/io/InputStreamReaderThread.java | 9 ++- .../player/io/PlayQueueInputStream.java | 14 ++-- .../player/io/ShoutCastOutputStream.java | 2 +- .../player/io/TranscodeInputStream.java | 10 ++- .../security/CsrfSecurityRequestMatcher.java | 1 + .../RESTRequestParameterProcessingFilter.java | 1 + .../ApacheCommonsConfigurationService.java | 8 +- .../player/service/AudioScrobblerService.java | 13 +-- .../player/service/ITunesParser.java | 27 +++---- .../player/service/JukeboxService.java | 13 +-- .../player/service/LastFmCache.java | 16 ++-- .../service/LastFmExpirationPolicy.java | 4 +- .../player/service/LastFmService.java | 28 ++----- .../player/service/MediaFileService.java | 23 ++---- .../player/service/MediaScannerService.java | 19 +---- .../player/service/MusicIndexService.java | 23 ++---- .../player/service/NetworkService.java | 19 +++-- .../player/service/PlayerService.java | 17 ++-- .../player/service/PlaylistService.java | 26 ++---- .../player/service/PodcastService.java | 30 +++---- .../player/service/RatingService.java | 8 +- .../player/service/SearchService.java | 44 +++------- .../player/service/SecurityService.java | 1 + .../player/service/SettingsService.java | 10 +-- .../player/service/ShareService.java | 15 ++-- .../player/service/SonosService.java | 81 +++++-------------- .../player/service/StatusService.java | 11 +-- .../player/service/TranscodingService.java | 24 +++--- .../player/service/UPnPService.java | 19 ++--- .../player/service/VersionService.java | 19 ++--- .../player/service/jukebox/AudioPlayer.java | 13 ++- .../player/service/jukebox/PlayerTest.java | 1 + .../player/service/metadata/FFmpegParser.java | 2 +- .../service/metadata/JaudiotaggerParser.java | 4 +- .../service/metadata/MetaDataParser.java | 4 +- .../player/service/sonos/AlbumList.java | 4 +- .../service/sonos/SonosFaultInterceptor.java | 5 +- .../player/service/sonos/SonosHelper.java | 54 +++---------- .../sonos/SonosServiceRegistration.java | 9 +-- .../upnp/ApacheUpnpServiceConfiguration.java | 4 +- .../player/service/upnp/ClingRouter.java | 13 ++- .../upnp/FolderBasedContentDirectory.java | 25 ++---- .../upnp/LibresonicContentDirectory.java | 3 +- .../spring/LoggingExceptionResolver.java | 5 +- .../player/taglib/EscapeJavaScriptTag.java | 1 + .../player/taglib/FormatBytesTag.java | 16 ++-- .../libresonic/player/taglib/ParamTag.java | 4 +- .../org/libresonic/player/taglib/UrlTag.java | 5 +- .../org/libresonic/player/taglib/WikiTag.java | 18 +++-- .../player/theme/LibresonicThemeResolver.java | 15 ++-- .../player/theme/LibresonicThemeSource.java | 7 +- .../player/upload/MonitoredDiskFileItem.java | 2 +- .../player/upload/MonitoredOutputStream.java | 2 +- .../libresonic/player/util/BoundedList.java | 2 +- .../org/libresonic/player/util/FileUtil.java | 4 +- .../org/libresonic/player/util/HttpRange.java | 4 +- .../java/org/libresonic/player/util/Pair.java | 4 +- .../libresonic/player/util/StringUtil.java | 24 ++---- .../java/org/libresonic/player/util/Util.java | 17 ++-- .../validator/PasswordSettingsValidator.java | 7 +- .../validator/UserSettingsValidator.java | 2 +- .../controller/HLSControllerTestCase.java | 4 +- .../controller/StreamControllerTestCase.java | 4 +- .../player/dao/DaoTestCaseBase.java | 4 +- .../player/domain/PlayQueueTestCase.java | 8 +- .../player/domain/SortableArtistTestCase.java | 4 +- .../domain/TranscodeSchemeTestCase.java | 1 + .../player/domain/VersionTestCase.java | 2 +- .../player/io/RangeOutputStreamTestCase.java | 6 +- .../service/SecurityServiceTestCase.java | 2 +- .../service/SettingsServiceTestCase.java | 7 +- .../metadata/MetaDataParserTestCase.java | 4 +- .../org/libresonic/player/util/FileUtils.java | 8 +- .../player/util/StringUtilTestCase.java | 6 +- pom.xml | 27 +++++++ 175 files changed, 717 insertions(+), 1057 deletions(-) create mode 100644 checkstyle.xml diff --git a/checkstyle.xml b/checkstyle.xml new file mode 100644 index 00000000..2681c480 --- /dev/null +++ b/checkstyle.xml @@ -0,0 +1,25 @@ + + + + + + + + + + + + + + + + + + + + + + diff --git a/libresonic-main/pom.xml b/libresonic-main/pom.xml index 9bc72bed..23325441 100644 --- a/libresonic-main/pom.xml +++ b/libresonic-main/pom.xml @@ -394,6 +394,10 @@ libresonic + + org.apache.maven.plugins + maven-checkstyle-plugin + org.springframework.boot spring-boot-maven-plugin diff --git a/libresonic-main/src/main/java/org/json/JSONObject.java b/libresonic-main/src/main/java/org/json/JSONObject.java index f8ee3590..68bb5e9b 100644 --- a/libresonic-main/src/main/java/org/json/JSONObject.java +++ b/libresonic-main/src/main/java/org/json/JSONObject.java @@ -27,15 +27,9 @@ SOFTWARE. import java.io.IOException; import java.io.Writer; import java.lang.reflect.Field; -import java.lang.reflect.Modifier; import java.lang.reflect.Method; -import java.util.Collection; -import java.util.Enumeration; -import java.util.HashMap; -import java.util.Iterator; -import java.util.Locale; -import java.util.Map; -import java.util.ResourceBundle; +import java.lang.reflect.Modifier; +import java.util.*; /** * A JSONObject is an unordered collection of name/value pairs. Its diff --git a/libresonic-main/src/main/java/org/json/JSONTokener.java b/libresonic-main/src/main/java/org/json/JSONTokener.java index f323f6e6..ec860c13 100644 --- a/libresonic-main/src/main/java/org/json/JSONTokener.java +++ b/libresonic-main/src/main/java/org/json/JSONTokener.java @@ -1,11 +1,6 @@ package org.json; -import java.io.BufferedReader; -import java.io.IOException; -import java.io.InputStream; -import java.io.InputStreamReader; -import java.io.Reader; -import java.io.StringReader; +import java.io.*; /* Copyright (c) 2002 JSON.org diff --git a/libresonic-main/src/main/java/org/libresonic/player/Logger.java b/libresonic-main/src/main/java/org/libresonic/player/Logger.java index d764bf5d..d1ea567a 100644 --- a/libresonic-main/src/main/java/org/libresonic/player/Logger.java +++ b/libresonic-main/src/main/java/org/libresonic/player/Logger.java @@ -19,14 +19,22 @@ */ package org.libresonic.player; +import org.apache.commons.lang.exception.ExceptionUtils; import org.libresonic.player.domain.Version; -import org.libresonic.player.service.*; -import org.libresonic.player.util.*; -import org.apache.commons.lang.exception.*; - -import java.io.*; -import java.text.*; -import java.util.*; +import org.libresonic.player.service.ServiceLocator; +import org.libresonic.player.service.SettingsService; +import org.libresonic.player.service.VersionService; +import org.libresonic.player.util.BoundedList; + +import java.io.File; +import java.io.FileWriter; +import java.io.IOException; +import java.io.PrintWriter; +import java.text.DateFormat; +import java.text.SimpleDateFormat; +import java.util.Collections; +import java.util.Date; +import java.util.List; /** * Logger implementation which logs to LIBRESONIC_HOME/libresonic.log. diff --git a/libresonic-main/src/main/java/org/libresonic/player/ajax/ArtistInfo.java b/libresonic-main/src/main/java/org/libresonic/player/ajax/ArtistInfo.java index c2828fd9..52477581 100644 --- a/libresonic-main/src/main/java/org/libresonic/player/ajax/ArtistInfo.java +++ b/libresonic-main/src/main/java/org/libresonic/player/ajax/ArtistInfo.java @@ -19,10 +19,10 @@ package org.libresonic.player.ajax; -import java.util.List; - import org.libresonic.player.domain.ArtistBio; +import java.util.List; + /** * @author Sindre Mehus * @version $Id$ diff --git a/libresonic-main/src/main/java/org/libresonic/player/ajax/ChatService.java b/libresonic-main/src/main/java/org/libresonic/player/ajax/ChatService.java index d5c0858e..9fad46f1 100644 --- a/libresonic-main/src/main/java/org/libresonic/player/ajax/ChatService.java +++ b/libresonic-main/src/main/java/org/libresonic/player/ajax/ChatService.java @@ -19,20 +19,17 @@ */ package org.libresonic.player.ajax; -import org.libresonic.player.Logger; -import org.libresonic.player.service.SecurityService; -import org.libresonic.player.util.BoundedList; import org.apache.commons.lang.StringUtils; import org.directwebremoting.WebContext; import org.directwebremoting.WebContextFactory; +import org.libresonic.player.Logger; +import org.libresonic.player.service.SecurityService; +import org.libresonic.player.util.BoundedList; import javax.servlet.http.HttpServletRequest; + import java.io.Serializable; -import java.util.ArrayList; -import java.util.Date; -import java.util.Iterator; -import java.util.LinkedList; -import java.util.List; +import java.util.*; import java.util.concurrent.Executors; import java.util.concurrent.ScheduledExecutorService; import java.util.concurrent.TimeUnit; diff --git a/libresonic-main/src/main/java/org/libresonic/player/ajax/CoverArtService.java b/libresonic-main/src/main/java/org/libresonic/player/ajax/CoverArtService.java index c626250b..41dcf9f7 100644 --- a/libresonic-main/src/main/java/org/libresonic/player/ajax/CoverArtService.java +++ b/libresonic-main/src/main/java/org/libresonic/player/ajax/CoverArtService.java @@ -19,19 +19,12 @@ */ package org.libresonic.player.ajax; -import java.io.File; -import java.io.FileOutputStream; -import java.io.InputStream; -import java.io.OutputStream; -import java.util.List; - import org.apache.commons.io.IOUtils; import org.apache.http.client.config.RequestConfig; import org.apache.http.client.methods.CloseableHttpResponse; import org.apache.http.client.methods.HttpGet; import org.apache.http.impl.client.CloseableHttpClient; import org.apache.http.impl.client.HttpClients; - import org.libresonic.player.Logger; import org.libresonic.player.domain.LastFmCoverArt; import org.libresonic.player.domain.MediaFile; @@ -40,6 +33,12 @@ import org.libresonic.player.service.MediaFileService; import org.libresonic.player.service.SecurityService; import org.libresonic.player.util.StringUtil; +import java.io.File; +import java.io.FileOutputStream; +import java.io.InputStream; +import java.io.OutputStream; +import java.util.List; + /** * Provides AJAX-enabled services for changing cover art images. *

diff --git a/libresonic-main/src/main/java/org/libresonic/player/ajax/LyricsService.java b/libresonic-main/src/main/java/org/libresonic/player/ajax/LyricsService.java index f2578614..34984500 100644 --- a/libresonic-main/src/main/java/org/libresonic/player/ajax/LyricsService.java +++ b/libresonic-main/src/main/java/org/libresonic/player/ajax/LyricsService.java @@ -19,10 +19,6 @@ */ package org.libresonic.player.ajax; -import java.io.IOException; -import java.io.StringReader; -import java.net.SocketException; - import org.apache.commons.lang.StringUtils; import org.apache.http.client.ResponseHandler; import org.apache.http.client.config.RequestConfig; @@ -34,10 +30,13 @@ import org.jdom.Document; import org.jdom.Element; import org.jdom.Namespace; import org.jdom.input.SAXBuilder; - import org.libresonic.player.Logger; import org.libresonic.player.util.StringUtil; +import java.io.IOException; +import java.io.StringReader; +import java.net.SocketException; + /** * Provides AJAX-enabled services for retrieving song lyrics from chartlyrics.com. *

diff --git a/libresonic-main/src/main/java/org/libresonic/player/ajax/MultiService.java b/libresonic-main/src/main/java/org/libresonic/player/ajax/MultiService.java index 4351994d..d2d83e21 100644 --- a/libresonic-main/src/main/java/org/libresonic/player/ajax/MultiService.java +++ b/libresonic-main/src/main/java/org/libresonic/player/ajax/MultiService.java @@ -19,25 +19,20 @@ */ package org.libresonic.player.ajax; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Date; -import java.util.List; - -import javax.servlet.http.HttpServletRequest; - import org.directwebremoting.WebContextFactory; - import org.libresonic.player.Logger; import org.libresonic.player.domain.ArtistBio; import org.libresonic.player.domain.MediaFile; import org.libresonic.player.domain.MusicFolder; import org.libresonic.player.domain.UserSettings; -import org.libresonic.player.service.LastFmService; -import org.libresonic.player.service.MediaFileService; -import org.libresonic.player.service.NetworkService; -import org.libresonic.player.service.SecurityService; -import org.libresonic.player.service.SettingsService; +import org.libresonic.player.service.*; + +import javax.servlet.http.HttpServletRequest; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Date; +import java.util.List; /** * Provides miscellaneous AJAX-enabled services. diff --git a/libresonic-main/src/main/java/org/libresonic/player/ajax/NowPlayingService.java b/libresonic-main/src/main/java/org/libresonic/player/ajax/NowPlayingService.java index dcbe68e4..9c0b1024 100644 --- a/libresonic-main/src/main/java/org/libresonic/player/ajax/NowPlayingService.java +++ b/libresonic-main/src/main/java/org/libresonic/player/ajax/NowPlayingService.java @@ -19,29 +19,23 @@ */ package org.libresonic.player.ajax; -import java.io.File; -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; - -import javax.servlet.http.HttpServletRequest; - import org.apache.commons.lang.StringUtils; import org.directwebremoting.WebContext; import org.directwebremoting.WebContextFactory; - import org.libresonic.player.Logger; -import org.libresonic.player.domain.AvatarScheme; -import org.libresonic.player.domain.MediaFile; -import org.libresonic.player.domain.PlayStatus; -import org.libresonic.player.domain.Player; -import org.libresonic.player.domain.UserSettings; +import org.libresonic.player.domain.*; import org.libresonic.player.service.MediaScannerService; import org.libresonic.player.service.PlayerService; import org.libresonic.player.service.SettingsService; import org.libresonic.player.service.StatusService; import org.libresonic.player.util.StringUtil; +import javax.servlet.http.HttpServletRequest; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; + /** * Provides AJAX-enabled services for retrieving the currently playing file and directory. * This class is used by the DWR framework (http://getahead.ltd.uk/dwr/). diff --git a/libresonic-main/src/main/java/org/libresonic/player/ajax/PlayQueueInfo.java b/libresonic-main/src/main/java/org/libresonic/player/ajax/PlayQueueInfo.java index 0cb5f541..2cd10dde 100644 --- a/libresonic-main/src/main/java/org/libresonic/player/ajax/PlayQueueInfo.java +++ b/libresonic-main/src/main/java/org/libresonic/player/ajax/PlayQueueInfo.java @@ -19,10 +19,10 @@ */ package org.libresonic.player.ajax; -import java.util.List; - import org.libresonic.player.util.StringUtil; +import java.util.List; + /** * The playlist of a player. * diff --git a/libresonic-main/src/main/java/org/libresonic/player/ajax/PlayQueueService.java b/libresonic-main/src/main/java/org/libresonic/player/ajax/PlayQueueService.java index 2076870c..f942608d 100644 --- a/libresonic-main/src/main/java/org/libresonic/player/ajax/PlayQueueService.java +++ b/libresonic-main/src/main/java/org/libresonic/player/ajax/PlayQueueService.java @@ -19,46 +19,21 @@ */ package org.libresonic.player.ajax; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collections; -import java.util.Date; -import java.util.Iterator; -import java.util.List; -import java.util.Locale; - -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -import org.directwebremoting.WebContextFactory; -import org.springframework.web.servlet.support.RequestContextUtils; - import com.google.common.base.Function; import com.google.common.collect.Lists; - +import org.directwebremoting.WebContextFactory; import org.libresonic.player.dao.MediaFileDao; import org.libresonic.player.dao.PlayQueueDao; -import org.libresonic.player.domain.MediaFile; -import org.libresonic.player.domain.MusicFolder; -import org.libresonic.player.domain.PlayQueue; -import org.libresonic.player.domain.Player; -import org.libresonic.player.domain.PodcastEpisode; -import org.libresonic.player.domain.PodcastStatus; -import org.libresonic.player.domain.SavedPlayQueue; -import org.libresonic.player.domain.UrlRedirectType; -import org.libresonic.player.domain.UserSettings; -import org.libresonic.player.service.JukeboxService; -import org.libresonic.player.service.LastFmService; -import org.libresonic.player.service.MediaFileService; -import org.libresonic.player.service.PlayerService; +import org.libresonic.player.domain.*; +import org.libresonic.player.service.*; import org.libresonic.player.service.PlaylistService; -import org.libresonic.player.service.PodcastService; -import org.libresonic.player.service.RatingService; -import org.libresonic.player.service.SearchService; -import org.libresonic.player.service.SecurityService; -import org.libresonic.player.service.SettingsService; -import org.libresonic.player.service.TranscodingService; import org.libresonic.player.util.StringUtil; +import org.springframework.web.servlet.support.RequestContextUtils; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +import java.util.*; /** * Provides AJAX-enabled services for manipulating the play queue of a player. diff --git a/libresonic-main/src/main/java/org/libresonic/player/ajax/PlaylistInfo.java b/libresonic-main/src/main/java/org/libresonic/player/ajax/PlaylistInfo.java index 1aad3371..7c80f95c 100644 --- a/libresonic-main/src/main/java/org/libresonic/player/ajax/PlaylistInfo.java +++ b/libresonic-main/src/main/java/org/libresonic/player/ajax/PlaylistInfo.java @@ -19,11 +19,10 @@ */ package org.libresonic.player.ajax; -import java.util.List; - -import org.libresonic.player.domain.MediaFile; import org.libresonic.player.domain.Playlist; +import java.util.List; + /** * The playlist of a player. * diff --git a/libresonic-main/src/main/java/org/libresonic/player/ajax/PlaylistService.java b/libresonic-main/src/main/java/org/libresonic/player/ajax/PlaylistService.java index 4acea50b..4365817c 100644 --- a/libresonic-main/src/main/java/org/libresonic/player/ajax/PlaylistService.java +++ b/libresonic-main/src/main/java/org/libresonic/player/ajax/PlaylistService.java @@ -19,6 +19,7 @@ */ package org.libresonic.player.ajax; +import org.directwebremoting.WebContextFactory; import org.libresonic.player.dao.MediaFileDao; import org.libresonic.player.domain.MediaFile; import org.libresonic.player.domain.MusicFolder; @@ -29,17 +30,12 @@ import org.libresonic.player.service.MediaFileService; import org.libresonic.player.service.PlayerService; import org.libresonic.player.service.SecurityService; import org.libresonic.player.service.SettingsService; -import org.directwebremoting.WebContextFactory; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; + import java.text.DateFormat; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Date; -import java.util.List; -import java.util.Locale; -import java.util.ResourceBundle; +import java.util.*; /** * Provides AJAX-enabled services for manipulating playlists. diff --git a/libresonic-main/src/main/java/org/libresonic/player/ajax/StarService.java b/libresonic-main/src/main/java/org/libresonic/player/ajax/StarService.java index 56f462a6..df323cda 100644 --- a/libresonic-main/src/main/java/org/libresonic/player/ajax/StarService.java +++ b/libresonic-main/src/main/java/org/libresonic/player/ajax/StarService.java @@ -19,12 +19,12 @@ */ package org.libresonic.player.ajax; +import org.directwebremoting.WebContext; +import org.directwebremoting.WebContextFactory; import org.libresonic.player.Logger; import org.libresonic.player.dao.MediaFileDao; import org.libresonic.player.domain.User; import org.libresonic.player.service.SecurityService; -import org.directwebremoting.WebContext; -import org.directwebremoting.WebContextFactory; /** * Provides AJAX-enabled services for starring. diff --git a/libresonic-main/src/main/java/org/libresonic/player/ajax/TagService.java b/libresonic-main/src/main/java/org/libresonic/player/ajax/TagService.java index a43a0d0f..afca6234 100644 --- a/libresonic-main/src/main/java/org/libresonic/player/ajax/TagService.java +++ b/libresonic-main/src/main/java/org/libresonic/player/ajax/TagService.java @@ -22,7 +22,6 @@ package org.libresonic.player.ajax; import org.apache.commons.io.FilenameUtils; import org.apache.commons.lang.ObjectUtils; import org.apache.commons.lang.StringUtils; - import org.libresonic.player.Logger; import org.libresonic.player.domain.MediaFile; import org.libresonic.player.service.MediaFileService; diff --git a/libresonic-main/src/main/java/org/libresonic/player/ajax/TransferService.java b/libresonic-main/src/main/java/org/libresonic/player/ajax/TransferService.java index 171414b4..64fa8a88 100644 --- a/libresonic-main/src/main/java/org/libresonic/player/ajax/TransferService.java +++ b/libresonic-main/src/main/java/org/libresonic/player/ajax/TransferService.java @@ -19,11 +19,11 @@ */ package org.libresonic.player.ajax; -import org.libresonic.player.domain.*; -import org.libresonic.player.controller.*; -import org.directwebremoting.*; +import org.directwebremoting.WebContextFactory; +import org.libresonic.player.controller.UploadController; +import org.libresonic.player.domain.TransferStatus; -import javax.servlet.http.*; +import javax.servlet.http.HttpSession; /** * Provides AJAX-enabled services for retrieving the status of ongoing transfers. diff --git a/libresonic-main/src/main/java/org/libresonic/player/cache/CacheFactory.java b/libresonic-main/src/main/java/org/libresonic/player/cache/CacheFactory.java index d8606281..4faf432c 100644 --- a/libresonic-main/src/main/java/org/libresonic/player/cache/CacheFactory.java +++ b/libresonic-main/src/main/java/org/libresonic/player/cache/CacheFactory.java @@ -19,18 +19,15 @@ */ package org.libresonic.player.cache; - -import java.io.File; - -import org.springframework.beans.factory.InitializingBean; - -import net.sf.ehcache.Cache; import net.sf.ehcache.CacheManager; import net.sf.ehcache.Ehcache; import net.sf.ehcache.config.Configuration; import net.sf.ehcache.config.ConfigurationFactory; import org.libresonic.player.Logger; import org.libresonic.player.service.SettingsService; +import org.springframework.beans.factory.InitializingBean; + +import java.io.File; /** * Initializes Ehcache and creates caches. diff --git a/libresonic-main/src/main/java/org/libresonic/player/command/MusicFolderSettingsCommand.java b/libresonic-main/src/main/java/org/libresonic/player/command/MusicFolderSettingsCommand.java index 1bb0b546..2bec6950 100644 --- a/libresonic-main/src/main/java/org/libresonic/player/command/MusicFolderSettingsCommand.java +++ b/libresonic-main/src/main/java/org/libresonic/player/command/MusicFolderSettingsCommand.java @@ -19,14 +19,14 @@ */ package org.libresonic.player.command; +import org.apache.commons.lang.StringUtils; +import org.libresonic.player.controller.MusicFolderSettingsController; +import org.libresonic.player.domain.MusicFolder; + import java.io.File; import java.util.Date; import java.util.List; -import org.libresonic.player.controller.MusicFolderSettingsController; -import org.libresonic.player.domain.MusicFolder; -import org.apache.commons.lang.StringUtils; - /** * Command used in {@link MusicFolderSettingsController}. * diff --git a/libresonic-main/src/main/java/org/libresonic/player/command/PasswordSettingsCommand.java b/libresonic-main/src/main/java/org/libresonic/player/command/PasswordSettingsCommand.java index fe9664b5..d102329d 100644 --- a/libresonic-main/src/main/java/org/libresonic/player/command/PasswordSettingsCommand.java +++ b/libresonic-main/src/main/java/org/libresonic/player/command/PasswordSettingsCommand.java @@ -19,7 +19,7 @@ */ package org.libresonic.player.command; -import org.libresonic.player.controller.*; +import org.libresonic.player.controller.PasswordSettingsController; /** * Command used in {@link PasswordSettingsController}. diff --git a/libresonic-main/src/main/java/org/libresonic/player/command/PersonalSettingsCommand.java b/libresonic-main/src/main/java/org/libresonic/player/command/PersonalSettingsCommand.java index 57e3c4ff..684b5167 100644 --- a/libresonic-main/src/main/java/org/libresonic/player/command/PersonalSettingsCommand.java +++ b/libresonic-main/src/main/java/org/libresonic/player/command/PersonalSettingsCommand.java @@ -19,14 +19,10 @@ */ package org.libresonic.player.command; -import java.util.List; - import org.libresonic.player.controller.PersonalSettingsController; -import org.libresonic.player.domain.AlbumListType; -import org.libresonic.player.domain.Avatar; -import org.libresonic.player.domain.Theme; -import org.libresonic.player.domain.User; -import org.libresonic.player.domain.UserSettings; +import org.libresonic.player.domain.*; + +import java.util.List; /** * Command used in {@link PersonalSettingsController}. diff --git a/libresonic-main/src/main/java/org/libresonic/player/command/PlayerSettingsCommand.java b/libresonic-main/src/main/java/org/libresonic/player/command/PlayerSettingsCommand.java index 3377e44a..cb5dcd4a 100644 --- a/libresonic-main/src/main/java/org/libresonic/player/command/PlayerSettingsCommand.java +++ b/libresonic-main/src/main/java/org/libresonic/player/command/PlayerSettingsCommand.java @@ -19,15 +19,15 @@ */ package org.libresonic.player.command; -import java.util.Date; -import java.util.List; - import org.libresonic.player.controller.PlayerSettingsController; import org.libresonic.player.domain.Player; import org.libresonic.player.domain.PlayerTechnology; import org.libresonic.player.domain.TranscodeScheme; import org.libresonic.player.domain.Transcoding; +import java.util.Date; +import java.util.List; + /** * Command used in {@link PlayerSettingsController}. * diff --git a/libresonic-main/src/main/java/org/libresonic/player/command/SearchCommand.java b/libresonic-main/src/main/java/org/libresonic/player/command/SearchCommand.java index 109dbee8..0df9f030 100644 --- a/libresonic-main/src/main/java/org/libresonic/player/command/SearchCommand.java +++ b/libresonic-main/src/main/java/org/libresonic/player/command/SearchCommand.java @@ -19,10 +19,12 @@ */ package org.libresonic.player.command; -import org.libresonic.player.domain.*; -import org.libresonic.player.controller.*; +import org.libresonic.player.controller.SearchController; +import org.libresonic.player.domain.MediaFile; +import org.libresonic.player.domain.Player; +import org.libresonic.player.domain.User; -import java.util.*; +import java.util.List; /** * Command used in {@link SearchController}. diff --git a/libresonic-main/src/main/java/org/libresonic/player/controller/AbstractChartController.java b/libresonic-main/src/main/java/org/libresonic/player/controller/AbstractChartController.java index 28fa58cc..fe27ddf3 100644 --- a/libresonic-main/src/main/java/org/libresonic/player/controller/AbstractChartController.java +++ b/libresonic-main/src/main/java/org/libresonic/player/controller/AbstractChartController.java @@ -19,13 +19,13 @@ */ package org.libresonic.player.controller; -import org.springframework.web.servlet.support.*; -import org.springframework.web.servlet.mvc.*; -import org.springframework.ui.context.*; +import org.springframework.ui.context.Theme; +import org.springframework.web.servlet.support.RequestContextUtils; + +import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.*; import java.awt.*; -import java.util.*; +import java.util.Locale; /** * Abstract super class for controllers which generate charts. diff --git a/libresonic-main/src/main/java/org/libresonic/player/controller/AdvancedSettingsController.java b/libresonic-main/src/main/java/org/libresonic/player/controller/AdvancedSettingsController.java index b86667e9..774e7632 100644 --- a/libresonic-main/src/main/java/org/libresonic/player/controller/AdvancedSettingsController.java +++ b/libresonic-main/src/main/java/org/libresonic/player/controller/AdvancedSettingsController.java @@ -25,11 +25,9 @@ import org.libresonic.player.service.SettingsService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.ui.Model; -import org.springframework.validation.BindingResult; import org.springframework.web.bind.annotation.ModelAttribute; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; -import org.springframework.web.servlet.ModelAndView; import org.springframework.web.servlet.mvc.support.RedirectAttributes; /** diff --git a/libresonic-main/src/main/java/org/libresonic/player/controller/AllmusicController.java b/libresonic-main/src/main/java/org/libresonic/player/controller/AllmusicController.java index d259a612..c4330069 100644 --- a/libresonic-main/src/main/java/org/libresonic/player/controller/AllmusicController.java +++ b/libresonic-main/src/main/java/org/libresonic/player/controller/AllmusicController.java @@ -19,13 +19,13 @@ */ package org.libresonic.player.controller; - import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.servlet.ModelAndView; -import javax.servlet.http.*; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; /** * Controller for the page which forwards to allmusic.com. diff --git a/libresonic-main/src/main/java/org/libresonic/player/controller/AutoCoverDemo.java b/libresonic-main/src/main/java/org/libresonic/player/controller/AutoCoverDemo.java index 0992634b..a5716e80 100644 --- a/libresonic-main/src/main/java/org/libresonic/player/controller/AutoCoverDemo.java +++ b/libresonic-main/src/main/java/org/libresonic/player/controller/AutoCoverDemo.java @@ -19,17 +19,12 @@ */ package org.libresonic.player.controller; -import java.awt.Color; -import java.awt.Dimension; -import java.awt.Graphics; -import java.awt.Graphics2D; -import java.io.IOException; +import org.apache.commons.lang.RandomStringUtils; -import javax.swing.JComponent; -import javax.swing.JFrame; -import javax.swing.JPanel; +import javax.swing.*; -import org.apache.commons.lang.RandomStringUtils; +import java.awt.*; +import java.io.IOException; /** * @author Sindre Mehus diff --git a/libresonic-main/src/main/java/org/libresonic/player/controller/AvatarController.java b/libresonic-main/src/main/java/org/libresonic/player/controller/AvatarController.java index 18ba9f3f..1fd97827 100644 --- a/libresonic-main/src/main/java/org/libresonic/player/controller/AvatarController.java +++ b/libresonic-main/src/main/java/org/libresonic/player/controller/AvatarController.java @@ -19,9 +19,10 @@ */ package org.libresonic.player.controller; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - +import org.libresonic.player.domain.Avatar; +import org.libresonic.player.domain.AvatarScheme; +import org.libresonic.player.domain.UserSettings; +import org.libresonic.player.service.SettingsService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.web.bind.ServletRequestUtils; @@ -30,10 +31,8 @@ import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.servlet.ModelAndView; import org.springframework.web.servlet.mvc.LastModified; -import org.libresonic.player.domain.Avatar; -import org.libresonic.player.domain.AvatarScheme; -import org.libresonic.player.domain.UserSettings; -import org.libresonic.player.service.SettingsService; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; /** * Controller which produces avatar images. diff --git a/libresonic-main/src/main/java/org/libresonic/player/controller/AvatarUploadController.java b/libresonic-main/src/main/java/org/libresonic/player/controller/AvatarUploadController.java index b20d469c..1ab390c6 100644 --- a/libresonic-main/src/main/java/org/libresonic/player/controller/AvatarUploadController.java +++ b/libresonic-main/src/main/java/org/libresonic/player/controller/AvatarUploadController.java @@ -19,27 +19,27 @@ */ package org.libresonic.player.controller; -import org.libresonic.player.Logger; -import org.libresonic.player.domain.Avatar; -import org.libresonic.player.service.SecurityService; -import org.libresonic.player.service.SettingsService; -import org.libresonic.player.util.StringUtil; import org.apache.commons.fileupload.FileItem; import org.apache.commons.fileupload.FileItemFactory; import org.apache.commons.fileupload.disk.DiskFileItemFactory; import org.apache.commons.fileupload.servlet.ServletFileUpload; import org.apache.commons.io.FilenameUtils; import org.apache.commons.lang.StringUtils; +import org.libresonic.player.Logger; +import org.libresonic.player.domain.Avatar; +import org.libresonic.player.service.SecurityService; +import org.libresonic.player.service.SettingsService; +import org.libresonic.player.util.StringUtil; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.servlet.ModelAndView; -import org.springframework.web.servlet.mvc.ParameterizableViewController; import javax.imageio.ImageIO; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; + import java.awt.image.BufferedImage; import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; diff --git a/libresonic-main/src/main/java/org/libresonic/player/controller/ChangeCoverArtController.java b/libresonic-main/src/main/java/org/libresonic/player/controller/ChangeCoverArtController.java index 7206e5d1..abbc2419 100644 --- a/libresonic-main/src/main/java/org/libresonic/player/controller/ChangeCoverArtController.java +++ b/libresonic-main/src/main/java/org/libresonic/player/controller/ChangeCoverArtController.java @@ -31,6 +31,7 @@ import org.springframework.web.servlet.ModelAndView; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; + import java.util.HashMap; import java.util.Map; diff --git a/libresonic-main/src/main/java/org/libresonic/player/controller/CoverArtController.java b/libresonic-main/src/main/java/org/libresonic/player/controller/CoverArtController.java index 7e8d59ab..da75d00a 100644 --- a/libresonic-main/src/main/java/org/libresonic/player/controller/CoverArtController.java +++ b/libresonic-main/src/main/java/org/libresonic/player/controller/CoverArtController.java @@ -41,6 +41,7 @@ import javax.annotation.PostConstruct; import javax.imageio.ImageIO; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; + import java.awt.*; import java.awt.image.BufferedImage; import java.io.*; diff --git a/libresonic-main/src/main/java/org/libresonic/player/controller/DBController.java b/libresonic-main/src/main/java/org/libresonic/player/controller/DBController.java index ae508e5c..1094a7f0 100644 --- a/libresonic-main/src/main/java/org/libresonic/player/controller/DBController.java +++ b/libresonic-main/src/main/java/org/libresonic/player/controller/DBController.java @@ -31,6 +31,7 @@ import org.springframework.web.servlet.ModelAndView; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; + import java.util.HashMap; import java.util.List; import java.util.Map; diff --git a/libresonic-main/src/main/java/org/libresonic/player/controller/DLNASettingsController.java b/libresonic-main/src/main/java/org/libresonic/player/controller/DLNASettingsController.java index 60eda464..e76b6907 100644 --- a/libresonic-main/src/main/java/org/libresonic/player/controller/DLNASettingsController.java +++ b/libresonic-main/src/main/java/org/libresonic/player/controller/DLNASettingsController.java @@ -18,23 +18,22 @@ */ package org.libresonic.player.controller; -import java.util.HashMap; -import java.util.Map; - -import javax.servlet.http.HttpServletRequest; - import org.apache.commons.lang.StringUtils; +import org.libresonic.player.service.SettingsService; +import org.libresonic.player.service.UPnPService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.ui.Model; import org.springframework.web.bind.ServletRequestUtils; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; - -import org.libresonic.player.service.SettingsService; -import org.libresonic.player.service.UPnPService; import org.springframework.web.servlet.mvc.support.RedirectAttributes; +import javax.servlet.http.HttpServletRequest; + +import java.util.HashMap; +import java.util.Map; + /** * Controller for the page used to administrate the UPnP/DLNA server settings. * diff --git a/libresonic-main/src/main/java/org/libresonic/player/controller/DownloadController.java b/libresonic-main/src/main/java/org/libresonic/player/controller/DownloadController.java index 9dc0a11e..c25c95a4 100644 --- a/libresonic-main/src/main/java/org/libresonic/player/controller/DownloadController.java +++ b/libresonic-main/src/main/java/org/libresonic/player/controller/DownloadController.java @@ -19,25 +19,15 @@ */ package org.libresonic.player.controller; -import java.io.BufferedInputStream; -import java.io.File; -import java.io.FileInputStream; -import java.io.IOException; -import java.io.InputStream; -import java.io.OutputStream; -import java.io.UnsupportedEncodingException; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; -import java.util.zip.CRC32; -import java.util.zip.ZipEntry; -import java.util.zip.ZipOutputStream; - -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - import org.apache.commons.io.FilenameUtils; import org.apache.commons.io.IOUtils; +import org.libresonic.player.Logger; +import org.libresonic.player.domain.*; +import org.libresonic.player.io.RangeOutputStream; +import org.libresonic.player.service.*; +import org.libresonic.player.util.FileUtil; +import org.libresonic.player.util.HttpRange; +import org.libresonic.player.util.Util; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.web.bind.ServletRequestBindingException; @@ -47,23 +37,16 @@ import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.servlet.ModelAndView; import org.springframework.web.servlet.mvc.LastModified; -import org.libresonic.player.Logger; -import org.libresonic.player.domain.MediaFile; -import org.libresonic.player.domain.PlayQueue; -import org.libresonic.player.domain.Player; -import org.libresonic.player.domain.Playlist; -import org.libresonic.player.domain.TransferStatus; -import org.libresonic.player.domain.User; -import org.libresonic.player.io.RangeOutputStream; -import org.libresonic.player.service.MediaFileService; -import org.libresonic.player.service.PlayerService; -import org.libresonic.player.service.PlaylistService; -import org.libresonic.player.service.SecurityService; -import org.libresonic.player.service.SettingsService; -import org.libresonic.player.service.StatusService; -import org.libresonic.player.util.FileUtil; -import org.libresonic.player.util.HttpRange; -import org.libresonic.player.util.Util; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +import java.io.*; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import java.util.zip.CRC32; +import java.util.zip.ZipEntry; +import java.util.zip.ZipOutputStream; /** * A controller used for downloading files to a remote client. If the requested path refers to a file, the diff --git a/libresonic-main/src/main/java/org/libresonic/player/controller/EditTagsController.java b/libresonic-main/src/main/java/org/libresonic/player/controller/EditTagsController.java index 1edacc7c..936fd7f6 100644 --- a/libresonic-main/src/main/java/org/libresonic/player/controller/EditTagsController.java +++ b/libresonic-main/src/main/java/org/libresonic/player/controller/EditTagsController.java @@ -34,6 +34,7 @@ import org.springframework.web.servlet.ModelAndView; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; + import java.util.ArrayList; import java.util.HashMap; import java.util.List; diff --git a/libresonic-main/src/main/java/org/libresonic/player/controller/ExternalPlayerController.java b/libresonic-main/src/main/java/org/libresonic/player/controller/ExternalPlayerController.java index 71389a95..554239e4 100644 --- a/libresonic-main/src/main/java/org/libresonic/player/controller/ExternalPlayerController.java +++ b/libresonic-main/src/main/java/org/libresonic/player/controller/ExternalPlayerController.java @@ -35,6 +35,7 @@ import org.springframework.web.servlet.ModelAndView; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; + import java.io.IOException; import java.util.*; diff --git a/libresonic-main/src/main/java/org/libresonic/player/controller/GettingStartedController.java b/libresonic-main/src/main/java/org/libresonic/player/controller/GettingStartedController.java index 673966c7..4b4809f9 100644 --- a/libresonic-main/src/main/java/org/libresonic/player/controller/GettingStartedController.java +++ b/libresonic-main/src/main/java/org/libresonic/player/controller/GettingStartedController.java @@ -19,10 +19,6 @@ */ package org.libresonic.player.controller; -import org.libresonic.player.domain.AvatarScheme; -import org.libresonic.player.domain.User; -import org.libresonic.player.domain.UserSettings; -import org.libresonic.player.service.SecurityService; import org.libresonic.player.service.SettingsService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; @@ -32,7 +28,7 @@ import org.springframework.web.servlet.ModelAndView; import org.springframework.web.servlet.view.RedirectView; import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; + import java.util.HashMap; import java.util.Map; diff --git a/libresonic-main/src/main/java/org/libresonic/player/controller/HLSController.java b/libresonic-main/src/main/java/org/libresonic/player/controller/HLSController.java index c34d447a..a3ce786e 100644 --- a/libresonic-main/src/main/java/org/libresonic/player/controller/HLSController.java +++ b/libresonic-main/src/main/java/org/libresonic/player/controller/HLSController.java @@ -19,24 +19,7 @@ */ package org.libresonic.player.controller; -import java.awt.Dimension; -import java.io.PrintWriter; -import java.util.ArrayList; -import java.util.List; -import java.util.regex.Matcher; -import java.util.regex.Pattern; - -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - import org.apache.commons.lang.StringUtils; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Controller; -import org.springframework.web.bind.ServletRequestUtils; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RequestMethod; -import org.springframework.web.servlet.ModelAndView; - import org.libresonic.player.domain.MediaFile; import org.libresonic.player.domain.Player; import org.libresonic.player.service.MediaFileService; @@ -44,6 +27,22 @@ import org.libresonic.player.service.PlayerService; import org.libresonic.player.service.SecurityService; import org.libresonic.player.util.Pair; import org.libresonic.player.util.StringUtil; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Controller; +import org.springframework.web.bind.ServletRequestUtils; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestMethod; +import org.springframework.web.servlet.ModelAndView; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +import java.awt.*; +import java.io.PrintWriter; +import java.util.ArrayList; +import java.util.List; +import java.util.regex.Matcher; +import java.util.regex.Pattern; /** * Controller which produces the HLS (Http Live Streaming) playlist. diff --git a/libresonic-main/src/main/java/org/libresonic/player/controller/HelpController.java b/libresonic-main/src/main/java/org/libresonic/player/controller/HelpController.java index 67613f4e..bf9343c5 100644 --- a/libresonic-main/src/main/java/org/libresonic/player/controller/HelpController.java +++ b/libresonic-main/src/main/java/org/libresonic/player/controller/HelpController.java @@ -19,23 +19,21 @@ */ package org.libresonic.player.controller; -import java.util.HashMap; -import java.util.Map; - -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - +import org.libresonic.player.Logger; +import org.libresonic.player.service.SecurityService; +import org.libresonic.player.service.SettingsService; +import org.libresonic.player.service.VersionService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.servlet.ModelAndView; -import org.springframework.web.servlet.mvc.ParameterizableViewController; -import org.libresonic.player.Logger; -import org.libresonic.player.service.SecurityService; -import org.libresonic.player.service.SettingsService; -import org.libresonic.player.service.VersionService; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +import java.util.HashMap; +import java.util.Map; /** * Controller for the help page. diff --git a/libresonic-main/src/main/java/org/libresonic/player/controller/HomeController.java b/libresonic-main/src/main/java/org/libresonic/player/controller/HomeController.java index 61967d87..d95bbaab 100644 --- a/libresonic-main/src/main/java/org/libresonic/player/controller/HomeController.java +++ b/libresonic-main/src/main/java/org/libresonic/player/controller/HomeController.java @@ -29,6 +29,7 @@ import org.springframework.web.servlet.ModelAndView; import org.springframework.web.servlet.view.RedirectView; import javax.servlet.http.HttpServletRequest; + import java.io.IOException; import java.util.*; diff --git a/libresonic-main/src/main/java/org/libresonic/player/controller/ImportPlaylistController.java b/libresonic-main/src/main/java/org/libresonic/player/controller/ImportPlaylistController.java index b379e081..95b7480b 100644 --- a/libresonic-main/src/main/java/org/libresonic/player/controller/ImportPlaylistController.java +++ b/libresonic-main/src/main/java/org/libresonic/player/controller/ImportPlaylistController.java @@ -19,29 +19,27 @@ */ package org.libresonic.player.controller; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - import org.apache.commons.fileupload.FileItem; import org.apache.commons.fileupload.FileItemFactory; import org.apache.commons.fileupload.disk.DiskFileItemFactory; import org.apache.commons.fileupload.servlet.ServletFileUpload; import org.apache.commons.io.FilenameUtils; import org.apache.commons.lang.StringUtils; +import org.libresonic.player.domain.Playlist; +import org.libresonic.player.service.PlaylistService; +import org.libresonic.player.service.SecurityService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.servlet.ModelAndView; -import org.springframework.web.servlet.mvc.ParameterizableViewController; -import org.libresonic.player.domain.Playlist; -import org.libresonic.player.service.PlaylistService; -import org.libresonic.player.service.SecurityService; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +import java.util.HashMap; +import java.util.List; +import java.util.Map; /** * @author Sindre Mehus diff --git a/libresonic-main/src/main/java/org/libresonic/player/controller/IndexController.java b/libresonic-main/src/main/java/org/libresonic/player/controller/IndexController.java index 003b364f..fec8ca4a 100644 --- a/libresonic-main/src/main/java/org/libresonic/player/controller/IndexController.java +++ b/libresonic-main/src/main/java/org/libresonic/player/controller/IndexController.java @@ -1,21 +1,17 @@ package org.libresonic.player.controller; import org.libresonic.player.Logger; -import org.libresonic.player.domain.User; import org.libresonic.player.domain.UserSettings; import org.libresonic.player.service.SecurityService; import org.libresonic.player.service.SettingsService; -import org.libresonic.player.util.StringUtil; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.security.web.authentication.UsernamePasswordAuthenticationFilter; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.servlet.ModelAndView; -import org.springframework.web.servlet.view.RedirectView; import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; + import java.util.HashMap; import java.util.Map; diff --git a/libresonic-main/src/main/java/org/libresonic/player/controller/InternetRadioSettingsController.java b/libresonic-main/src/main/java/org/libresonic/player/controller/InternetRadioSettingsController.java index c57ac9f5..d689821c 100644 --- a/libresonic-main/src/main/java/org/libresonic/player/controller/InternetRadioSettingsController.java +++ b/libresonic-main/src/main/java/org/libresonic/player/controller/InternetRadioSettingsController.java @@ -19,20 +19,17 @@ */ package org.libresonic.player.controller; +import org.apache.commons.lang.StringUtils; import org.libresonic.player.domain.InternetRadio; import org.libresonic.player.service.SettingsService; -import org.apache.commons.lang.StringUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.ui.Model; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; -import org.springframework.web.servlet.ModelAndView; -import org.springframework.web.servlet.mvc.ParameterizableViewController; +import org.springframework.web.servlet.mvc.support.RedirectAttributes; import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; -import org.springframework.web.servlet.mvc.support.RedirectAttributes; import java.util.Date; import java.util.HashMap; diff --git a/libresonic-main/src/main/java/org/libresonic/player/controller/JAXBWriter.java b/libresonic-main/src/main/java/org/libresonic/player/controller/JAXBWriter.java index 7a6c8579..5152547d 100644 --- a/libresonic-main/src/main/java/org/libresonic/player/controller/JAXBWriter.java +++ b/libresonic-main/src/main/java/org/libresonic/player/controller/JAXBWriter.java @@ -19,31 +19,30 @@ */ package org.libresonic.player.controller; -import java.io.InputStream; -import java.io.StringWriter; -import java.util.Date; -import java.util.GregorianCalendar; - -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; -import javax.xml.bind.JAXBException; -import javax.xml.bind.Marshaller; -import javax.xml.datatype.DatatypeFactory; -import javax.xml.datatype.XMLGregorianCalendar; - import org.apache.commons.io.IOUtils; import org.eclipse.persistence.jaxb.JAXBContext; import org.eclipse.persistence.jaxb.MarshallerProperties; import org.jdom.Attribute; import org.jdom.Document; import org.jdom.input.SAXBuilder; +import org.libresonic.player.Logger; +import org.libresonic.player.util.StringUtil; import org.libresonic.restapi.Error; import org.libresonic.restapi.ObjectFactory; import org.libresonic.restapi.Response; import org.libresonic.restapi.ResponseStatus; -import org.libresonic.player.Logger; -import org.libresonic.player.util.StringUtil; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import javax.xml.bind.JAXBException; +import javax.xml.bind.Marshaller; +import javax.xml.datatype.DatatypeFactory; +import javax.xml.datatype.XMLGregorianCalendar; + +import java.io.InputStream; +import java.io.StringWriter; +import java.util.Date; +import java.util.GregorianCalendar; import static org.springframework.web.bind.ServletRequestUtils.getStringParameter; diff --git a/libresonic-main/src/main/java/org/libresonic/player/controller/LeftController.java b/libresonic-main/src/main/java/org/libresonic/player/controller/LeftController.java index 8542fe44..98676363 100644 --- a/libresonic-main/src/main/java/org/libresonic/player/controller/LeftController.java +++ b/libresonic-main/src/main/java/org/libresonic/player/controller/LeftController.java @@ -33,6 +33,7 @@ import org.springframework.web.servlet.support.RequestContextUtils; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; + import java.io.File; import java.util.*; diff --git a/libresonic-main/src/main/java/org/libresonic/player/controller/LoginController.java b/libresonic-main/src/main/java/org/libresonic/player/controller/LoginController.java index 3159a803..d5a5f44b 100644 --- a/libresonic-main/src/main/java/org/libresonic/player/controller/LoginController.java +++ b/libresonic-main/src/main/java/org/libresonic/player/controller/LoginController.java @@ -6,10 +6,7 @@ import org.libresonic.player.service.SecurityService; import org.libresonic.player.service.SettingsService; import org.libresonic.player.util.StringUtil; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.security.core.Authentication; -import org.springframework.security.core.context.SecurityContextHolder; import org.springframework.security.web.authentication.UsernamePasswordAuthenticationFilter; -import org.springframework.security.web.authentication.logout.SecurityContextLogoutHandler; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; @@ -18,6 +15,7 @@ import org.springframework.web.servlet.view.RedirectView; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; + import java.util.HashMap; import java.util.Map; diff --git a/libresonic-main/src/main/java/org/libresonic/player/controller/LyricsController.java b/libresonic-main/src/main/java/org/libresonic/player/controller/LyricsController.java index 2a3c5698..da5fd500 100644 --- a/libresonic-main/src/main/java/org/libresonic/player/controller/LyricsController.java +++ b/libresonic-main/src/main/java/org/libresonic/player/controller/LyricsController.java @@ -22,13 +22,13 @@ package org.libresonic.player.controller; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; -import org.springframework.web.servlet.mvc.ParameterizableViewController; import org.springframework.web.servlet.ModelAndView; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; -import java.util.Map; + import java.util.HashMap; +import java.util.Map; /** * Controller for the lyrics popup. diff --git a/libresonic-main/src/main/java/org/libresonic/player/controller/M3UController.java b/libresonic-main/src/main/java/org/libresonic/player/controller/M3UController.java index b11cc354..126618e8 100644 --- a/libresonic-main/src/main/java/org/libresonic/player/controller/M3UController.java +++ b/libresonic-main/src/main/java/org/libresonic/player/controller/M3UController.java @@ -34,6 +34,7 @@ import org.springframework.web.servlet.ModelAndView; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; + import java.io.IOException; import java.io.PrintWriter; import java.util.List; diff --git a/libresonic-main/src/main/java/org/libresonic/player/controller/MainController.java b/libresonic-main/src/main/java/org/libresonic/player/controller/MainController.java index b9fc3004..e815576d 100644 --- a/libresonic-main/src/main/java/org/libresonic/player/controller/MainController.java +++ b/libresonic-main/src/main/java/org/libresonic/player/controller/MainController.java @@ -31,6 +31,7 @@ import org.springframework.web.servlet.view.RedirectView; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; + import java.io.IOException; import java.util.*; import java.util.stream.Collectors; diff --git a/libresonic-main/src/main/java/org/libresonic/player/controller/MoreController.java b/libresonic-main/src/main/java/org/libresonic/player/controller/MoreController.java index cae21dff..6638d870 100644 --- a/libresonic-main/src/main/java/org/libresonic/player/controller/MoreController.java +++ b/libresonic-main/src/main/java/org/libresonic/player/controller/MoreController.java @@ -35,6 +35,7 @@ import org.springframework.web.servlet.ModelAndView; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; + import java.io.File; import java.util.Calendar; import java.util.HashMap; diff --git a/libresonic-main/src/main/java/org/libresonic/player/controller/NowPlayingController.java b/libresonic-main/src/main/java/org/libresonic/player/controller/NowPlayingController.java index f3c6a01e..42fa949c 100644 --- a/libresonic-main/src/main/java/org/libresonic/player/controller/NowPlayingController.java +++ b/libresonic-main/src/main/java/org/libresonic/player/controller/NowPlayingController.java @@ -34,6 +34,7 @@ import org.springframework.web.servlet.view.RedirectView; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; + import java.util.List; /** diff --git a/libresonic-main/src/main/java/org/libresonic/player/controller/PersonalSettingsController.java b/libresonic-main/src/main/java/org/libresonic/player/controller/PersonalSettingsController.java index 0a1bd2a9..dfcc422a 100644 --- a/libresonic-main/src/main/java/org/libresonic/player/controller/PersonalSettingsController.java +++ b/libresonic-main/src/main/java/org/libresonic/player/controller/PersonalSettingsController.java @@ -30,9 +30,9 @@ import org.springframework.ui.Model; import org.springframework.web.bind.annotation.ModelAttribute; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; +import org.springframework.web.servlet.mvc.support.RedirectAttributes; import javax.servlet.http.HttpServletRequest; -import org.springframework.web.servlet.mvc.support.RedirectAttributes; import java.util.Date; import java.util.Locale; diff --git a/libresonic-main/src/main/java/org/libresonic/player/controller/PlayQueueController.java b/libresonic-main/src/main/java/org/libresonic/player/controller/PlayQueueController.java index 11a9d085..53b2b647 100644 --- a/libresonic-main/src/main/java/org/libresonic/player/controller/PlayQueueController.java +++ b/libresonic-main/src/main/java/org/libresonic/player/controller/PlayQueueController.java @@ -33,6 +33,7 @@ import org.springframework.web.servlet.ModelAndView; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; + import java.util.HashMap; import java.util.Map; diff --git a/libresonic-main/src/main/java/org/libresonic/player/controller/PlayerSettingsController.java b/libresonic-main/src/main/java/org/libresonic/player/controller/PlayerSettingsController.java index 0d88f127..4f6bcd24 100644 --- a/libresonic-main/src/main/java/org/libresonic/player/controller/PlayerSettingsController.java +++ b/libresonic-main/src/main/java/org/libresonic/player/controller/PlayerSettingsController.java @@ -31,9 +31,9 @@ import org.springframework.ui.Model; import org.springframework.web.bind.annotation.ModelAttribute; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; +import org.springframework.web.servlet.mvc.support.RedirectAttributes; import javax.servlet.http.HttpServletRequest; -import org.springframework.web.servlet.mvc.support.RedirectAttributes; import java.util.ArrayList; import java.util.List; diff --git a/libresonic-main/src/main/java/org/libresonic/player/controller/PlaylistController.java b/libresonic-main/src/main/java/org/libresonic/player/controller/PlaylistController.java index 386b36df..7dbf146c 100644 --- a/libresonic-main/src/main/java/org/libresonic/player/controller/PlaylistController.java +++ b/libresonic-main/src/main/java/org/libresonic/player/controller/PlaylistController.java @@ -33,11 +33,11 @@ import org.springframework.web.bind.ServletRequestUtils; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.servlet.ModelAndView; -import org.springframework.web.servlet.mvc.ParameterizableViewController; import org.springframework.web.servlet.view.RedirectView; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; + import java.util.HashMap; import java.util.Map; diff --git a/libresonic-main/src/main/java/org/libresonic/player/controller/PlaylistsController.java b/libresonic-main/src/main/java/org/libresonic/player/controller/PlaylistsController.java index 9e3abe61..d6e99b64 100644 --- a/libresonic-main/src/main/java/org/libresonic/player/controller/PlaylistsController.java +++ b/libresonic-main/src/main/java/org/libresonic/player/controller/PlaylistsController.java @@ -18,31 +18,21 @@ */ package org.libresonic.player.controller; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - +import org.libresonic.player.domain.Playlist; +import org.libresonic.player.domain.User; +import org.libresonic.player.service.PlaylistService; +import org.libresonic.player.service.SecurityService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.ui.Model; -import org.springframework.web.bind.ServletRequestUtils; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; -import org.springframework.web.servlet.ModelAndView; -import org.springframework.web.servlet.mvc.ParameterizableViewController; -import org.springframework.web.servlet.view.RedirectView; -import org.libresonic.player.domain.Player; -import org.libresonic.player.domain.Playlist; -import org.libresonic.player.domain.User; -import org.libresonic.player.domain.UserSettings; -import org.libresonic.player.service.PlayerService; -import org.libresonic.player.service.PlaylistService; -import org.libresonic.player.service.SecurityService; -import org.libresonic.player.service.SettingsService; +import javax.servlet.http.HttpServletRequest; + +import java.util.HashMap; +import java.util.List; +import java.util.Map; /** * Controller for the playlists page. diff --git a/libresonic-main/src/main/java/org/libresonic/player/controller/PodcastChannelController.java b/libresonic-main/src/main/java/org/libresonic/player/controller/PodcastChannelController.java index 4bd8c089..323a1948 100644 --- a/libresonic-main/src/main/java/org/libresonic/player/controller/PodcastChannelController.java +++ b/libresonic-main/src/main/java/org/libresonic/player/controller/PodcastChannelController.java @@ -30,6 +30,7 @@ import org.springframework.web.servlet.ModelAndView; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; + import java.util.HashMap; import java.util.Map; diff --git a/libresonic-main/src/main/java/org/libresonic/player/controller/PodcastChannelsController.java b/libresonic-main/src/main/java/org/libresonic/player/controller/PodcastChannelsController.java index a01155e1..c20fb376 100644 --- a/libresonic-main/src/main/java/org/libresonic/player/controller/PodcastChannelsController.java +++ b/libresonic-main/src/main/java/org/libresonic/player/controller/PodcastChannelsController.java @@ -31,6 +31,7 @@ import org.springframework.web.servlet.ModelAndView; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; + import java.util.HashMap; import java.util.LinkedHashMap; import java.util.List; diff --git a/libresonic-main/src/main/java/org/libresonic/player/controller/PodcastController.java b/libresonic-main/src/main/java/org/libresonic/player/controller/PodcastController.java index 4c0abe8f..1646ccd6 100644 --- a/libresonic-main/src/main/java/org/libresonic/player/controller/PodcastController.java +++ b/libresonic-main/src/main/java/org/libresonic/player/controller/PodcastController.java @@ -33,6 +33,7 @@ import org.springframework.web.servlet.ModelAndView; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; + import java.text.DateFormat; import java.text.SimpleDateFormat; import java.util.*; diff --git a/libresonic-main/src/main/java/org/libresonic/player/controller/ProxyController.java b/libresonic-main/src/main/java/org/libresonic/player/controller/ProxyController.java index 4ced7605..5a21ed0f 100644 --- a/libresonic-main/src/main/java/org/libresonic/player/controller/ProxyController.java +++ b/libresonic-main/src/main/java/org/libresonic/player/controller/ProxyController.java @@ -34,6 +34,7 @@ import org.springframework.web.servlet.ModelAndView; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; + import java.io.InputStream; /** diff --git a/libresonic-main/src/main/java/org/libresonic/player/controller/RESTController.java b/libresonic-main/src/main/java/org/libresonic/player/controller/RESTController.java index 6b917ac0..600410e2 100644 --- a/libresonic-main/src/main/java/org/libresonic/player/controller/RESTController.java +++ b/libresonic-main/src/main/java/org/libresonic/player/controller/RESTController.java @@ -57,6 +57,7 @@ import javax.annotation.PostConstruct; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequestWrapper; import javax.servlet.http.HttpServletResponse; + import java.util.*; import java.util.concurrent.ConcurrentHashMap; diff --git a/libresonic-main/src/main/java/org/libresonic/player/controller/RandomPlayQueueController.java b/libresonic-main/src/main/java/org/libresonic/player/controller/RandomPlayQueueController.java index 67664be3..29dba657 100644 --- a/libresonic-main/src/main/java/org/libresonic/player/controller/RandomPlayQueueController.java +++ b/libresonic-main/src/main/java/org/libresonic/player/controller/RandomPlayQueueController.java @@ -19,14 +19,12 @@ */ package org.libresonic.player.controller; -import java.util.*; - -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - import org.apache.commons.lang.StringUtils; import org.libresonic.player.domain.*; -import org.libresonic.player.service.*; +import org.libresonic.player.service.MediaFileService; +import org.libresonic.player.service.PlayerService; +import org.libresonic.player.service.SecurityService; +import org.libresonic.player.service.SettingsService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.ui.ModelMap; @@ -36,6 +34,11 @@ import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RequestParam; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +import java.util.*; + /** * Controller for the creating a random play queue. * diff --git a/libresonic-main/src/main/java/org/libresonic/player/controller/RecoverController.java b/libresonic-main/src/main/java/org/libresonic/player/controller/RecoverController.java index 26abeae7..79231ba9 100644 --- a/libresonic-main/src/main/java/org/libresonic/player/controller/RecoverController.java +++ b/libresonic-main/src/main/java/org/libresonic/player/controller/RecoverController.java @@ -22,6 +22,7 @@ import javax.mail.internet.InternetAddress; import javax.mail.internet.MimeMessage; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; + import java.util.Date; import java.util.HashMap; import java.util.Map; diff --git a/libresonic-main/src/main/java/org/libresonic/player/controller/RightController.java b/libresonic-main/src/main/java/org/libresonic/player/controller/RightController.java index 42ecb68b..00c60785 100644 --- a/libresonic-main/src/main/java/org/libresonic/player/controller/RightController.java +++ b/libresonic-main/src/main/java/org/libresonic/player/controller/RightController.java @@ -30,6 +30,7 @@ import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.servlet.ModelAndView; import javax.servlet.http.HttpServletRequest; + import java.util.HashMap; import java.util.Map; diff --git a/libresonic-main/src/main/java/org/libresonic/player/controller/SearchController.java b/libresonic-main/src/main/java/org/libresonic/player/controller/SearchController.java index 197d96b8..7ce122f7 100644 --- a/libresonic-main/src/main/java/org/libresonic/player/controller/SearchController.java +++ b/libresonic-main/src/main/java/org/libresonic/player/controller/SearchController.java @@ -35,6 +35,7 @@ import org.springframework.web.bind.annotation.RequestMethod; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; + import java.util.List; /** diff --git a/libresonic-main/src/main/java/org/libresonic/player/controller/SettingsController.java b/libresonic-main/src/main/java/org/libresonic/player/controller/SettingsController.java index 647d3145..80a024d6 100644 --- a/libresonic-main/src/main/java/org/libresonic/player/controller/SettingsController.java +++ b/libresonic-main/src/main/java/org/libresonic/player/controller/SettingsController.java @@ -23,15 +23,12 @@ import org.libresonic.player.domain.User; import org.libresonic.player.service.SecurityService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; -import org.springframework.web.bind.annotation.RequestAttribute; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.servlet.ModelAndView; -import org.springframework.web.servlet.mvc.AbstractController; import org.springframework.web.servlet.view.RedirectView; import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; /** * Controller for the main settings page. diff --git a/libresonic-main/src/main/java/org/libresonic/player/controller/ShareManagementController.java b/libresonic-main/src/main/java/org/libresonic/player/controller/ShareManagementController.java index 4305906d..a852c128 100644 --- a/libresonic-main/src/main/java/org/libresonic/player/controller/ShareManagementController.java +++ b/libresonic-main/src/main/java/org/libresonic/player/controller/ShareManagementController.java @@ -34,6 +34,7 @@ import org.springframework.web.servlet.ModelAndView; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; + import java.util.*; /** diff --git a/libresonic-main/src/main/java/org/libresonic/player/controller/ShareSettingsController.java b/libresonic-main/src/main/java/org/libresonic/player/controller/ShareSettingsController.java index 1f3de435..5adf2b51 100644 --- a/libresonic-main/src/main/java/org/libresonic/player/controller/ShareSettingsController.java +++ b/libresonic-main/src/main/java/org/libresonic/player/controller/ShareSettingsController.java @@ -19,7 +19,6 @@ */ package org.libresonic.player.controller; -import javax.servlet.http.HttpServletRequest; import org.apache.commons.lang.StringUtils; import org.libresonic.player.domain.MediaFile; import org.libresonic.player.domain.MusicFolder; @@ -37,12 +36,9 @@ import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.servlet.mvc.support.RedirectAttributes; -import java.util.ArrayList; -import java.util.Calendar; -import java.util.Date; -import java.util.HashMap; -import java.util.List; -import java.util.Map; +import javax.servlet.http.HttpServletRequest; + +import java.util.*; /** * Controller for the page used to administrate the set of shared media. diff --git a/libresonic-main/src/main/java/org/libresonic/player/controller/SonosSettingsController.java b/libresonic-main/src/main/java/org/libresonic/player/controller/SonosSettingsController.java index ab740ad4..a83bbc12 100644 --- a/libresonic-main/src/main/java/org/libresonic/player/controller/SonosSettingsController.java +++ b/libresonic-main/src/main/java/org/libresonic/player/controller/SonosSettingsController.java @@ -18,7 +18,6 @@ */ package org.libresonic.player.controller; -import javax.servlet.http.HttpServletRequest; import org.apache.commons.lang.StringUtils; import org.libresonic.player.service.SettingsService; import org.libresonic.player.service.SonosService; @@ -30,6 +29,8 @@ import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.servlet.mvc.support.RedirectAttributes; +import javax.servlet.http.HttpServletRequest; + import java.util.HashMap; import java.util.Map; diff --git a/libresonic-main/src/main/java/org/libresonic/player/controller/StarredController.java b/libresonic-main/src/main/java/org/libresonic/player/controller/StarredController.java index 147cd3b5..40f3d296 100644 --- a/libresonic-main/src/main/java/org/libresonic/player/controller/StarredController.java +++ b/libresonic-main/src/main/java/org/libresonic/player/controller/StarredController.java @@ -33,6 +33,7 @@ import org.springframework.web.servlet.ModelAndView; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; + import java.util.ArrayList; import java.util.HashMap; import java.util.List; diff --git a/libresonic-main/src/main/java/org/libresonic/player/controller/StatusChartController.java b/libresonic-main/src/main/java/org/libresonic/player/controller/StatusChartController.java index be555e63..e862eb83 100644 --- a/libresonic-main/src/main/java/org/libresonic/player/controller/StatusChartController.java +++ b/libresonic-main/src/main/java/org/libresonic/player/controller/StatusChartController.java @@ -19,23 +19,29 @@ */ package org.libresonic.player.controller; -import org.libresonic.player.domain.*; -import org.libresonic.player.service.*; -import org.jfree.chart.*; -import org.jfree.chart.axis.*; -import org.jfree.chart.plot.*; -import org.jfree.chart.renderer.xy.*; -import org.jfree.data.*; +import org.jfree.chart.ChartFactory; +import org.jfree.chart.ChartUtilities; +import org.jfree.chart.JFreeChart; +import org.jfree.chart.axis.AxisLocation; +import org.jfree.chart.axis.ValueAxis; +import org.jfree.chart.plot.XYPlot; +import org.jfree.chart.renderer.xy.XYItemRenderer; +import org.jfree.data.Range; import org.jfree.data.time.*; +import org.libresonic.player.domain.TransferStatus; +import org.libresonic.player.service.StatusService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; -import org.springframework.web.servlet.*; +import org.springframework.web.servlet.ModelAndView; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; -import javax.servlet.http.*; import java.awt.*; -import java.util.*; +import java.util.Collections; +import java.util.Date; import java.util.List; /** diff --git a/libresonic-main/src/main/java/org/libresonic/player/controller/StatusController.java b/libresonic-main/src/main/java/org/libresonic/player/controller/StatusController.java index a0eff1c9..de3a8002 100644 --- a/libresonic-main/src/main/java/org/libresonic/player/controller/StatusController.java +++ b/libresonic-main/src/main/java/org/libresonic/player/controller/StatusController.java @@ -33,6 +33,7 @@ import org.springframework.web.servlet.support.RequestContextUtils; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; + import java.util.*; /** diff --git a/libresonic-main/src/main/java/org/libresonic/player/controller/StreamController.java b/libresonic-main/src/main/java/org/libresonic/player/controller/StreamController.java index da518ad8..b6d84098 100644 --- a/libresonic-main/src/main/java/org/libresonic/player/controller/StreamController.java +++ b/libresonic-main/src/main/java/org/libresonic/player/controller/StreamController.java @@ -19,48 +19,34 @@ */ package org.libresonic.player.controller; -import java.awt.Dimension; -import java.io.IOException; -import java.io.OutputStream; -import java.util.Arrays; -import java.util.regex.Matcher; -import java.util.regex.Pattern; - -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - import org.apache.commons.io.IOUtils; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Controller; -import org.springframework.web.bind.ServletRequestBindingException; -import org.springframework.web.bind.ServletRequestUtils; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RequestMethod; -import org.springframework.web.servlet.ModelAndView; - import org.libresonic.player.Logger; -import org.libresonic.player.domain.MediaFile; -import org.libresonic.player.domain.PlayQueue; -import org.libresonic.player.domain.Player; -import org.libresonic.player.domain.TransferStatus; -import org.libresonic.player.domain.User; -import org.libresonic.player.domain.VideoTranscodingSettings; +import org.libresonic.player.domain.*; import org.libresonic.player.io.PlayQueueInputStream; import org.libresonic.player.io.RangeOutputStream; import org.libresonic.player.io.ShoutCastOutputStream; -import org.libresonic.player.service.AudioScrobblerService; -import org.libresonic.player.service.MediaFileService; -import org.libresonic.player.service.PlayerService; -import org.libresonic.player.service.PlaylistService; -import org.libresonic.player.service.SearchService; -import org.libresonic.player.service.SecurityService; -import org.libresonic.player.service.SettingsService; -import org.libresonic.player.service.StatusService; -import org.libresonic.player.service.TranscodingService; +import org.libresonic.player.service.*; import org.libresonic.player.service.sonos.SonosHelper; import org.libresonic.player.util.HttpRange; import org.libresonic.player.util.StringUtil; import org.libresonic.player.util.Util; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Controller; +import org.springframework.web.bind.ServletRequestBindingException; +import org.springframework.web.bind.ServletRequestUtils; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestMethod; +import org.springframework.web.servlet.ModelAndView; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +import java.awt.*; +import java.io.IOException; +import java.io.OutputStream; +import java.util.Arrays; +import java.util.regex.Matcher; +import java.util.regex.Pattern; /** * A controller which streams the content of a {@link org.libresonic.player.domain.PlayQueue} to a remote diff --git a/libresonic-main/src/main/java/org/libresonic/player/controller/TopController.java b/libresonic-main/src/main/java/org/libresonic/player/controller/TopController.java index 0aabaa6b..4806ffa9 100644 --- a/libresonic-main/src/main/java/org/libresonic/player/controller/TopController.java +++ b/libresonic-main/src/main/java/org/libresonic/player/controller/TopController.java @@ -31,7 +31,7 @@ import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.servlet.ModelAndView; import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; + import java.util.HashMap; import java.util.Map; diff --git a/libresonic-main/src/main/java/org/libresonic/player/controller/TranscodingSettingsController.java b/libresonic-main/src/main/java/org/libresonic/player/controller/TranscodingSettingsController.java index b857ffda..299c1a23 100644 --- a/libresonic-main/src/main/java/org/libresonic/player/controller/TranscodingSettingsController.java +++ b/libresonic-main/src/main/java/org/libresonic/player/controller/TranscodingSettingsController.java @@ -19,20 +19,18 @@ */ package org.libresonic.player.controller; +import org.apache.commons.lang.StringUtils; import org.libresonic.player.domain.Transcoding; -import org.libresonic.player.service.TranscodingService; import org.libresonic.player.service.SettingsService; -import org.apache.commons.lang.StringUtils; +import org.libresonic.player.service.TranscodingService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.ui.Model; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; -import org.springframework.web.servlet.ModelAndView; +import org.springframework.web.servlet.mvc.support.RedirectAttributes; import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; -import org.springframework.web.servlet.mvc.support.RedirectAttributes; import java.util.HashMap; import java.util.Map; diff --git a/libresonic-main/src/main/java/org/libresonic/player/controller/UploadController.java b/libresonic-main/src/main/java/org/libresonic/player/controller/UploadController.java index 921d9076..924c7ad9 100644 --- a/libresonic-main/src/main/java/org/libresonic/player/controller/UploadController.java +++ b/libresonic-main/src/main/java/org/libresonic/player/controller/UploadController.java @@ -42,6 +42,7 @@ import org.springframework.web.servlet.ModelAndView; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; + import java.io.File; import java.io.FileOutputStream; import java.io.InputStream; diff --git a/libresonic-main/src/main/java/org/libresonic/player/controller/UserChartController.java b/libresonic-main/src/main/java/org/libresonic/player/controller/UserChartController.java index 812ae823..53868515 100644 --- a/libresonic-main/src/main/java/org/libresonic/player/controller/UserChartController.java +++ b/libresonic-main/src/main/java/org/libresonic/player/controller/UserChartController.java @@ -19,14 +19,6 @@ */ package org.libresonic.player.controller; -import java.awt.Color; -import java.awt.GradientPaint; -import java.awt.Paint; -import java.util.List; - -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - import org.jfree.chart.ChartFactory; import org.jfree.chart.ChartUtilities; import org.jfree.chart.JFreeChart; @@ -39,14 +31,19 @@ import org.jfree.chart.plot.PlotOrientation; import org.jfree.chart.renderer.category.BarRenderer; import org.jfree.data.category.CategoryDataset; import org.jfree.data.category.DefaultCategoryDataset; +import org.libresonic.player.domain.User; +import org.libresonic.player.service.SecurityService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.servlet.ModelAndView; -import org.libresonic.player.domain.User; -import org.libresonic.player.service.SecurityService; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +import java.awt.*; +import java.util.List; /** * Controller for generating a chart showing bitrate vs time. diff --git a/libresonic-main/src/main/java/org/libresonic/player/controller/UserSettingsController.java b/libresonic-main/src/main/java/org/libresonic/player/controller/UserSettingsController.java index 6aa3bac8..1741550d 100644 --- a/libresonic-main/src/main/java/org/libresonic/player/controller/UserSettingsController.java +++ b/libresonic-main/src/main/java/org/libresonic/player/controller/UserSettingsController.java @@ -38,10 +38,13 @@ import org.springframework.validation.annotation.Validated; import org.springframework.web.bind.ServletRequestBindingException; import org.springframework.web.bind.ServletRequestUtils; import org.springframework.web.bind.WebDataBinder; -import org.springframework.web.bind.annotation.*; +import org.springframework.web.bind.annotation.InitBinder; +import org.springframework.web.bind.annotation.ModelAttribute; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestMethod; +import org.springframework.web.servlet.mvc.support.RedirectAttributes; import javax.servlet.http.HttpServletRequest; -import org.springframework.web.servlet.mvc.support.RedirectAttributes; import java.util.ArrayList; import java.util.Date; diff --git a/libresonic-main/src/main/java/org/libresonic/player/controller/VideoPlayerController.java b/libresonic-main/src/main/java/org/libresonic/player/controller/VideoPlayerController.java index 47f48a06..74e82179 100644 --- a/libresonic-main/src/main/java/org/libresonic/player/controller/VideoPlayerController.java +++ b/libresonic-main/src/main/java/org/libresonic/player/controller/VideoPlayerController.java @@ -35,6 +35,7 @@ import org.springframework.web.servlet.ModelAndView; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; + import java.util.HashMap; import java.util.LinkedHashMap; import java.util.Map; diff --git a/libresonic-main/src/main/java/org/libresonic/player/dao/AbstractDao.java b/libresonic-main/src/main/java/org/libresonic/player/dao/AbstractDao.java index d7c7b8e4..3c703991 100644 --- a/libresonic-main/src/main/java/org/libresonic/player/dao/AbstractDao.java +++ b/libresonic-main/src/main/java/org/libresonic/player/dao/AbstractDao.java @@ -19,24 +19,16 @@ */ package org.libresonic.player.dao; -import java.sql.Connection; -import java.sql.PreparedStatement; -import java.sql.ResultSet; -import java.sql.SQLException; +import org.libresonic.player.Logger; +import org.springframework.jdbc.core.JdbcTemplate; +import org.springframework.jdbc.core.RowMapper; +import org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate; + import java.util.Date; import java.util.List; import java.util.Map; import java.util.concurrent.TimeUnit; -import org.springframework.dao.DataAccessException; -import org.springframework.jdbc.core.*; -import org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate; - -import org.libresonic.player.Logger; -import org.springframework.jdbc.support.JdbcUtils; -import org.springframework.jdbc.support.KeyHolder; -import org.springframework.util.Assert; - /** * Abstract superclass for all DAO's. * diff --git a/libresonic-main/src/main/java/org/libresonic/player/dao/ArtistDao.java b/libresonic-main/src/main/java/org/libresonic/player/dao/ArtistDao.java index 91658b28..91ae0b89 100644 --- a/libresonic-main/src/main/java/org/libresonic/player/dao/ArtistDao.java +++ b/libresonic-main/src/main/java/org/libresonic/player/dao/ArtistDao.java @@ -22,17 +22,12 @@ package org.libresonic.player.dao; import org.libresonic.player.Logger; import org.libresonic.player.domain.Artist; import org.libresonic.player.domain.MusicFolder; - import org.springframework.jdbc.core.RowMapper; import org.springframework.transaction.annotation.Transactional; import java.sql.ResultSet; import java.sql.SQLException; -import java.util.Collections; -import java.util.Date; -import java.util.HashMap; -import java.util.List; -import java.util.Map; +import java.util.*; /** * Provides database services for artists. diff --git a/libresonic-main/src/main/java/org/libresonic/player/dao/DaoHelper.java b/libresonic-main/src/main/java/org/libresonic/player/dao/DaoHelper.java index e423e2d8..a9015b48 100644 --- a/libresonic-main/src/main/java/org/libresonic/player/dao/DaoHelper.java +++ b/libresonic-main/src/main/java/org/libresonic/player/dao/DaoHelper.java @@ -19,10 +19,11 @@ */ package org.libresonic.player.dao; -import javax.sql.DataSource; import org.springframework.jdbc.core.JdbcTemplate; import org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate; +import javax.sql.DataSource; + /** * DAO helper class which creates the data source, and updates the database schema. * diff --git a/libresonic-main/src/main/java/org/libresonic/player/dao/GenericDaoHelper.java b/libresonic-main/src/main/java/org/libresonic/player/dao/GenericDaoHelper.java index b860b18e..ad7903d5 100644 --- a/libresonic-main/src/main/java/org/libresonic/player/dao/GenericDaoHelper.java +++ b/libresonic-main/src/main/java/org/libresonic/player/dao/GenericDaoHelper.java @@ -1,9 +1,10 @@ package org.libresonic.player.dao; -import javax.sql.DataSource; import org.springframework.jdbc.core.JdbcTemplate; import org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate; +import javax.sql.DataSource; + public class GenericDaoHelper implements DaoHelper { final JdbcTemplate jdbcTemplate; diff --git a/libresonic-main/src/main/java/org/libresonic/player/dao/InternetRadioDao.java b/libresonic-main/src/main/java/org/libresonic/player/dao/InternetRadioDao.java index 791436e1..6ffbba3f 100644 --- a/libresonic-main/src/main/java/org/libresonic/player/dao/InternetRadioDao.java +++ b/libresonic-main/src/main/java/org/libresonic/player/dao/InternetRadioDao.java @@ -19,15 +19,14 @@ */ package org.libresonic.player.dao; +import org.libresonic.player.Logger; +import org.libresonic.player.domain.InternetRadio; import org.springframework.jdbc.core.RowMapper; import java.sql.ResultSet; import java.sql.SQLException; import java.util.List; -import org.libresonic.player.Logger; -import org.libresonic.player.domain.InternetRadio; - /** * Provides database services for internet radio. * diff --git a/libresonic-main/src/main/java/org/libresonic/player/dao/MediaFileDao.java b/libresonic-main/src/main/java/org/libresonic/player/dao/MediaFileDao.java index 550153da..97e41bca 100644 --- a/libresonic-main/src/main/java/org/libresonic/player/dao/MediaFileDao.java +++ b/libresonic-main/src/main/java/org/libresonic/player/dao/MediaFileDao.java @@ -20,12 +20,11 @@ package org.libresonic.player.dao; import org.apache.commons.lang.StringUtils; -import org.libresonic.player.domain.RandomSearchCriteria; -import org.springframework.jdbc.core.RowMapper; - import org.libresonic.player.domain.Genre; import org.libresonic.player.domain.MediaFile; import org.libresonic.player.domain.MusicFolder; +import org.libresonic.player.domain.RandomSearchCriteria; +import org.springframework.jdbc.core.RowMapper; import org.springframework.transaction.annotation.Transactional; import java.sql.ResultSet; diff --git a/libresonic-main/src/main/java/org/libresonic/player/dao/PlaylistDao.java b/libresonic-main/src/main/java/org/libresonic/player/dao/PlaylistDao.java index 319760b2..68b7a085 100644 --- a/libresonic-main/src/main/java/org/libresonic/player/dao/PlaylistDao.java +++ b/libresonic-main/src/main/java/org/libresonic/player/dao/PlaylistDao.java @@ -27,11 +27,7 @@ import org.springframework.transaction.annotation.Transactional; import java.sql.ResultSet; import java.sql.SQLException; -import java.util.ArrayList; -import java.util.Date; -import java.util.List; -import java.util.SortedMap; -import java.util.TreeMap; +import java.util.*; /** * Provides database services for playlists. diff --git a/libresonic-main/src/main/java/org/libresonic/player/dao/RatingDao.java b/libresonic-main/src/main/java/org/libresonic/player/dao/RatingDao.java index 2dec6169..d8f5d225 100644 --- a/libresonic-main/src/main/java/org/libresonic/player/dao/RatingDao.java +++ b/libresonic-main/src/main/java/org/libresonic/player/dao/RatingDao.java @@ -19,17 +19,15 @@ */ package org.libresonic.player.dao; -import java.util.ArrayList; +import org.libresonic.player.domain.MediaFile; +import org.libresonic.player.domain.MusicFolder; +import org.springframework.dao.EmptyResultDataAccessException; + import java.util.Collections; import java.util.HashMap; import java.util.List; import java.util.Map; -import org.springframework.dao.EmptyResultDataAccessException; - -import org.libresonic.player.domain.MediaFile; -import org.libresonic.player.domain.MusicFolder; - import static org.libresonic.player.domain.MediaFile.MediaType.ALBUM; /** diff --git a/libresonic-main/src/main/java/org/libresonic/player/domain/MediaFile.java b/libresonic-main/src/main/java/org/libresonic/player/domain/MediaFile.java index 98590c20..eb74cd0f 100644 --- a/libresonic-main/src/main/java/org/libresonic/player/domain/MediaFile.java +++ b/libresonic-main/src/main/java/org/libresonic/player/domain/MediaFile.java @@ -19,17 +19,15 @@ */ package org.libresonic.player.domain; -import java.io.File; -import java.util.Date; -import java.util.List; - -import org.apache.commons.io.FilenameUtils; - import com.google.common.base.Function; import com.google.common.collect.Lists; - +import org.apache.commons.io.FilenameUtils; import org.libresonic.player.util.FileUtil; +import java.io.File; +import java.util.Date; +import java.util.List; + /** * A media file (audio, video or directory) with an assortment of its meta data. * diff --git a/libresonic-main/src/main/java/org/libresonic/player/domain/MusicFolder.java b/libresonic-main/src/main/java/org/libresonic/player/domain/MusicFolder.java index b08e5fb8..1d7df092 100644 --- a/libresonic-main/src/main/java/org/libresonic/player/domain/MusicFolder.java +++ b/libresonic-main/src/main/java/org/libresonic/player/domain/MusicFolder.java @@ -19,15 +19,15 @@ */ package org.libresonic.player.domain; +import com.google.common.base.Function; +import com.google.common.base.Objects; +import com.google.common.collect.Lists; + import java.io.File; import java.io.Serializable; import java.util.Date; import java.util.List; -import com.google.common.base.Function; -import com.google.common.base.Objects; -import com.google.common.collect.Lists; - /** * Represents a top level directory in which music or other media is stored. * diff --git a/libresonic-main/src/main/java/org/libresonic/player/domain/PlayQueue.java b/libresonic-main/src/main/java/org/libresonic/player/domain/PlayQueue.java index ef665d19..be680775 100644 --- a/libresonic-main/src/main/java/org/libresonic/player/domain/PlayQueue.java +++ b/libresonic-main/src/main/java/org/libresonic/player/domain/PlayQueue.java @@ -19,15 +19,11 @@ */ package org.libresonic.player.domain; -import java.io.IOException; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collections; -import java.util.Comparator; -import java.util.List; - import org.apache.commons.lang.StringUtils; +import java.io.IOException; +import java.util.*; + /** * A play queue is a list of music files that are associated to a remote player. * diff --git a/libresonic-main/src/main/java/org/libresonic/player/domain/PodcastEpisode.java b/libresonic-main/src/main/java/org/libresonic/player/domain/PodcastEpisode.java index d0e28040..869e75c3 100644 --- a/libresonic-main/src/main/java/org/libresonic/player/domain/PodcastEpisode.java +++ b/libresonic-main/src/main/java/org/libresonic/player/domain/PodcastEpisode.java @@ -21,8 +21,6 @@ package org.libresonic.player.domain; import java.util.Date; -import org.libresonic.player.util.StringUtil; - /** * A Podcast episode belonging to a channel. * diff --git a/libresonic-main/src/main/java/org/libresonic/player/domain/SearchResult.java b/libresonic-main/src/main/java/org/libresonic/player/domain/SearchResult.java index a104a291..1689599f 100644 --- a/libresonic-main/src/main/java/org/libresonic/player/domain/SearchResult.java +++ b/libresonic-main/src/main/java/org/libresonic/player/domain/SearchResult.java @@ -19,12 +19,11 @@ */ package org.libresonic.player.domain; +import org.libresonic.player.service.SearchService; + import java.util.ArrayList; import java.util.List; -import org.libresonic.player.service.MediaScannerService; -import org.libresonic.player.service.SearchService; - /** * The outcome of a search. * diff --git a/libresonic-main/src/main/java/org/libresonic/player/domain/TransferStatus.java b/libresonic-main/src/main/java/org/libresonic/player/domain/TransferStatus.java index d9269e50..b4c78a1e 100644 --- a/libresonic-main/src/main/java/org/libresonic/player/domain/TransferStatus.java +++ b/libresonic-main/src/main/java/org/libresonic/player/domain/TransferStatus.java @@ -19,10 +19,10 @@ */ package org.libresonic.player.domain; -import java.io.File; - import org.libresonic.player.util.BoundedList; +import java.io.File; + /** * Status for a single transfer (stream, download or upload). * diff --git a/libresonic-main/src/main/java/org/libresonic/player/filter/BootstrapVerificationFilter.java b/libresonic-main/src/main/java/org/libresonic/player/filter/BootstrapVerificationFilter.java index a0f1a0d3..9c6fc652 100644 --- a/libresonic-main/src/main/java/org/libresonic/player/filter/BootstrapVerificationFilter.java +++ b/libresonic-main/src/main/java/org/libresonic/player/filter/BootstrapVerificationFilter.java @@ -22,13 +22,7 @@ package org.libresonic.player.filter; import org.libresonic.player.Logger; import org.libresonic.player.service.SettingsService; -import javax.servlet.Filter; -import javax.servlet.FilterChain; -import javax.servlet.FilterConfig; -import javax.servlet.ServletException; -import javax.servlet.ServletOutputStream; -import javax.servlet.ServletRequest; -import javax.servlet.ServletResponse; +import javax.servlet.*; import javax.servlet.http.HttpServletRequest; import java.io.File; diff --git a/libresonic-main/src/main/java/org/libresonic/player/filter/ParameterDecodingFilter.java b/libresonic-main/src/main/java/org/libresonic/player/filter/ParameterDecodingFilter.java index 019784ba..1a570d0e 100644 --- a/libresonic-main/src/main/java/org/libresonic/player/filter/ParameterDecodingFilter.java +++ b/libresonic-main/src/main/java/org/libresonic/player/filter/ParameterDecodingFilter.java @@ -25,6 +25,7 @@ import org.libresonic.player.util.StringUtil; import javax.servlet.*; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequestWrapper; + import java.io.IOException; import java.util.Enumeration; import java.util.HashMap; diff --git a/libresonic-main/src/main/java/org/libresonic/player/filter/RESTFilter.java b/libresonic-main/src/main/java/org/libresonic/player/filter/RESTFilter.java index 2140c217..88705e06 100644 --- a/libresonic-main/src/main/java/org/libresonic/player/filter/RESTFilter.java +++ b/libresonic-main/src/main/java/org/libresonic/player/filter/RESTFilter.java @@ -19,23 +19,17 @@ */ package org.libresonic.player.filter; -import java.io.IOException; +import org.libresonic.player.Logger; +import org.libresonic.player.controller.JAXBWriter; +import org.libresonic.player.controller.RESTController; +import org.springframework.web.bind.ServletRequestBindingException; +import org.springframework.web.util.NestedServletException; -import javax.servlet.Filter; -import javax.servlet.FilterChain; -import javax.servlet.FilterConfig; -import javax.servlet.ServletException; -import javax.servlet.ServletRequest; -import javax.servlet.ServletResponse; +import javax.servlet.*; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; -import org.springframework.web.bind.ServletRequestBindingException; -import org.springframework.web.util.NestedServletException; - -import org.libresonic.player.Logger; -import org.libresonic.player.controller.JAXBWriter; -import org.libresonic.player.controller.RESTController; +import java.io.IOException; import static org.libresonic.player.controller.RESTController.ErrorCode.GENERIC; import static org.libresonic.player.controller.RESTController.ErrorCode.MISSING_PARAMETER; diff --git a/libresonic-main/src/main/java/org/libresonic/player/filter/RequestEncodingFilter.java b/libresonic-main/src/main/java/org/libresonic/player/filter/RequestEncodingFilter.java index 6deeb3ab..eb062bb0 100644 --- a/libresonic-main/src/main/java/org/libresonic/player/filter/RequestEncodingFilter.java +++ b/libresonic-main/src/main/java/org/libresonic/player/filter/RequestEncodingFilter.java @@ -20,8 +20,9 @@ package org.libresonic.player.filter; import javax.servlet.*; -import javax.servlet.http.*; -import java.io.*; +import javax.servlet.http.HttpServletRequest; + +import java.io.IOException; /** * Configurable filter for setting the character encoding to use for the HTTP request. diff --git a/libresonic-main/src/main/java/org/libresonic/player/filter/ResponseHeaderFilter.java b/libresonic-main/src/main/java/org/libresonic/player/filter/ResponseHeaderFilter.java index 48b3959b..80a5ee44 100644 --- a/libresonic-main/src/main/java/org/libresonic/player/filter/ResponseHeaderFilter.java +++ b/libresonic-main/src/main/java/org/libresonic/player/filter/ResponseHeaderFilter.java @@ -20,9 +20,10 @@ package org.libresonic.player.filter; import javax.servlet.*; -import javax.servlet.http.*; -import java.io.*; -import java.util.*; +import javax.servlet.http.HttpServletResponse; + +import java.io.IOException; +import java.util.Enumeration; /** * Configurable filter for setting HTTP response headers. Can be used, for instance, to diff --git a/libresonic-main/src/main/java/org/libresonic/player/i18n/LibresonicLocaleResolver.java b/libresonic-main/src/main/java/org/libresonic/player/i18n/LibresonicLocaleResolver.java index 68bfe5d2..2eaa3aa1 100644 --- a/libresonic-main/src/main/java/org/libresonic/player/i18n/LibresonicLocaleResolver.java +++ b/libresonic-main/src/main/java/org/libresonic/player/i18n/LibresonicLocaleResolver.java @@ -19,12 +19,18 @@ */ package org.libresonic.player.i18n; -import org.libresonic.player.service.*; -import org.libresonic.player.domain.*; -import org.springframework.web.servlet.*; - -import javax.servlet.http.*; -import java.util.*; +import org.libresonic.player.domain.UserSettings; +import org.libresonic.player.service.SecurityService; +import org.libresonic.player.service.SettingsService; +import org.springframework.web.servlet.LocaleResolver; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +import java.util.Arrays; +import java.util.HashSet; +import java.util.Locale; +import java.util.Set; /** * Locale resolver implementation which returns the locale selected in the settings. diff --git a/libresonic-main/src/main/java/org/libresonic/player/io/InputStreamReaderThread.java b/libresonic-main/src/main/java/org/libresonic/player/io/InputStreamReaderThread.java index 9568cbd9..6bbf8759 100644 --- a/libresonic-main/src/main/java/org/libresonic/player/io/InputStreamReaderThread.java +++ b/libresonic-main/src/main/java/org/libresonic/player/io/InputStreamReaderThread.java @@ -19,10 +19,13 @@ */ package org.libresonic.player.io; -import org.libresonic.player.*; -import org.apache.commons.io.*; +import org.apache.commons.io.IOUtils; +import org.libresonic.player.Logger; -import java.io.*; +import java.io.BufferedReader; +import java.io.IOException; +import java.io.InputStream; +import java.io.InputStreamReader; /** * Utility class which reads everything from an input stream and optionally logs it. diff --git a/libresonic-main/src/main/java/org/libresonic/player/io/PlayQueueInputStream.java b/libresonic-main/src/main/java/org/libresonic/player/io/PlayQueueInputStream.java index 5277209d..cca08d5a 100644 --- a/libresonic-main/src/main/java/org/libresonic/player/io/PlayQueueInputStream.java +++ b/libresonic-main/src/main/java/org/libresonic/player/io/PlayQueueInputStream.java @@ -19,16 +19,8 @@ */ package org.libresonic.player.io; -import java.io.IOException; -import java.io.InputStream; -import java.util.List; - import org.libresonic.player.Logger; -import org.libresonic.player.domain.MediaFile; -import org.libresonic.player.domain.PlayQueue; -import org.libresonic.player.domain.Player; -import org.libresonic.player.domain.TransferStatus; -import org.libresonic.player.domain.VideoTranscodingSettings; +import org.libresonic.player.domain.*; import org.libresonic.player.service.AudioScrobblerService; import org.libresonic.player.service.MediaFileService; import org.libresonic.player.service.SearchService; @@ -36,6 +28,10 @@ import org.libresonic.player.service.TranscodingService; import org.libresonic.player.service.sonos.SonosHelper; import org.libresonic.player.util.FileUtil; +import java.io.IOException; +import java.io.InputStream; +import java.util.List; + /** * Implementation of {@link InputStream} which reads from a {@link org.libresonic.player.domain.PlayQueue}. * diff --git a/libresonic-main/src/main/java/org/libresonic/player/io/ShoutCastOutputStream.java b/libresonic-main/src/main/java/org/libresonic/player/io/ShoutCastOutputStream.java index b7b4d8f3..ddc1235e 100644 --- a/libresonic-main/src/main/java/org/libresonic/player/io/ShoutCastOutputStream.java +++ b/libresonic-main/src/main/java/org/libresonic/player/io/ShoutCastOutputStream.java @@ -19,11 +19,11 @@ */ package org.libresonic.player.io; +import org.apache.commons.lang.StringUtils; import org.libresonic.player.Logger; import org.libresonic.player.domain.MediaFile; import org.libresonic.player.domain.PlayQueue; import org.libresonic.player.service.SettingsService; -import org.apache.commons.lang.StringUtils; import java.io.IOException; import java.io.OutputStream; diff --git a/libresonic-main/src/main/java/org/libresonic/player/io/TranscodeInputStream.java b/libresonic-main/src/main/java/org/libresonic/player/io/TranscodeInputStream.java index c474bfd2..2554f3d7 100644 --- a/libresonic-main/src/main/java/org/libresonic/player/io/TranscodeInputStream.java +++ b/libresonic-main/src/main/java/org/libresonic/player/io/TranscodeInputStream.java @@ -19,11 +19,13 @@ */ package org.libresonic.player.io; -import org.libresonic.player.*; +import org.apache.commons.io.IOUtils; +import org.libresonic.player.Logger; -import org.apache.commons.io.*; - -import java.io.*; +import java.io.File; +import java.io.IOException; +import java.io.InputStream; +import java.io.OutputStream; /** * Subclass of {@link InputStream} which provides on-the-fly transcoding. diff --git a/libresonic-main/src/main/java/org/libresonic/player/security/CsrfSecurityRequestMatcher.java b/libresonic-main/src/main/java/org/libresonic/player/security/CsrfSecurityRequestMatcher.java index 2dd4f9c3..f5284f5c 100644 --- a/libresonic-main/src/main/java/org/libresonic/player/security/CsrfSecurityRequestMatcher.java +++ b/libresonic-main/src/main/java/org/libresonic/player/security/CsrfSecurityRequestMatcher.java @@ -5,6 +5,7 @@ import org.springframework.security.web.util.matcher.RequestMatcher; import org.springframework.stereotype.Component; import javax.servlet.http.HttpServletRequest; + import java.util.regex.Pattern; /** diff --git a/libresonic-main/src/main/java/org/libresonic/player/security/RESTRequestParameterProcessingFilter.java b/libresonic-main/src/main/java/org/libresonic/player/security/RESTRequestParameterProcessingFilter.java index 5e99b1f5..7de14cce 100644 --- a/libresonic-main/src/main/java/org/libresonic/player/security/RESTRequestParameterProcessingFilter.java +++ b/libresonic-main/src/main/java/org/libresonic/player/security/RESTRequestParameterProcessingFilter.java @@ -39,6 +39,7 @@ import org.springframework.security.web.util.matcher.RequestMatcher; import javax.servlet.*; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; + import java.io.IOException; /** diff --git a/libresonic-main/src/main/java/org/libresonic/player/service/ApacheCommonsConfigurationService.java b/libresonic-main/src/main/java/org/libresonic/player/service/ApacheCommonsConfigurationService.java index dc8e0f6e..d797c0c6 100644 --- a/libresonic-main/src/main/java/org/libresonic/player/service/ApacheCommonsConfigurationService.java +++ b/libresonic-main/src/main/java/org/libresonic/player/service/ApacheCommonsConfigurationService.java @@ -1,12 +1,6 @@ package org.libresonic.player.service; -import com.google.common.collect.Lists; -import org.apache.commons.configuration2.Configuration; -import org.apache.commons.configuration2.FileBasedConfiguration; -import org.apache.commons.configuration2.ImmutableConfiguration; -import org.apache.commons.configuration2.MapConfiguration; -import org.apache.commons.configuration2.PropertiesConfiguration; -import org.apache.commons.configuration2.PropertiesConfigurationLayout; +import org.apache.commons.configuration2.*; import org.apache.commons.configuration2.builder.FileBasedConfigurationBuilder; import org.apache.commons.configuration2.builder.fluent.Parameters; import org.apache.commons.configuration2.ex.ConfigurationException; diff --git a/libresonic-main/src/main/java/org/libresonic/player/service/AudioScrobblerService.java b/libresonic-main/src/main/java/org/libresonic/player/service/AudioScrobblerService.java index 9546ab30..a8b57174 100644 --- a/libresonic-main/src/main/java/org/libresonic/player/service/AudioScrobblerService.java +++ b/libresonic-main/src/main/java/org/libresonic/player/service/AudioScrobblerService.java @@ -19,14 +19,6 @@ */ package org.libresonic.player.service; -import java.io.IOException; -import java.util.ArrayList; -import java.util.Date; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.concurrent.LinkedBlockingQueue; - import org.apache.commons.codec.digest.DigestUtils; import org.apache.http.NameValuePair; import org.apache.http.client.ResponseHandler; @@ -39,12 +31,15 @@ import org.apache.http.impl.client.BasicResponseHandler; import org.apache.http.impl.client.CloseableHttpClient; import org.apache.http.impl.client.HttpClients; import org.apache.http.message.BasicNameValuePair; - import org.libresonic.player.Logger; import org.libresonic.player.domain.MediaFile; import org.libresonic.player.domain.UserSettings; import org.libresonic.player.util.StringUtil; +import java.io.IOException; +import java.util.*; +import java.util.concurrent.LinkedBlockingQueue; + /** * Provides services for "audioscrobbling", which is the process of * registering what songs are played at www.last.fm. diff --git a/libresonic-main/src/main/java/org/libresonic/player/service/ITunesParser.java b/libresonic-main/src/main/java/org/libresonic/player/service/ITunesParser.java index 1b661d62..39797ef5 100644 --- a/libresonic-main/src/main/java/org/libresonic/player/service/ITunesParser.java +++ b/libresonic-main/src/main/java/org/libresonic/player/service/ITunesParser.java @@ -19,29 +19,22 @@ package org.libresonic.player.service; -import java.io.File; -import java.io.FileInputStream; -import java.io.InputStream; -import java.net.URL; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.SortedSet; -import java.util.TreeSet; +import com.google.common.base.Predicate; +import com.google.common.collect.Iterables; +import com.google.common.collect.Lists; +import org.apache.commons.io.IOUtils; +import org.libresonic.player.util.StringUtil; import javax.xml.stream.XMLInputFactory; import javax.xml.stream.XMLStreamConstants; import javax.xml.stream.XMLStreamException; import javax.xml.stream.XMLStreamReader; -import org.apache.commons.io.IOUtils; - -import com.google.common.base.Predicate; -import com.google.common.collect.Iterables; -import com.google.common.collect.Lists; - -import org.libresonic.player.util.StringUtil; +import java.io.File; +import java.io.FileInputStream; +import java.io.InputStream; +import java.net.URL; +import java.util.*; /** * @author Sindre Mehus diff --git a/libresonic-main/src/main/java/org/libresonic/player/service/JukeboxService.java b/libresonic-main/src/main/java/org/libresonic/player/service/JukeboxService.java index f0265e19..fe93c327 100644 --- a/libresonic-main/src/main/java/org/libresonic/player/service/JukeboxService.java +++ b/libresonic-main/src/main/java/org/libresonic/player/service/JukeboxService.java @@ -19,21 +19,14 @@ */ package org.libresonic.player.service; -import java.io.InputStream; - import org.apache.commons.io.IOUtils; - import org.libresonic.player.Logger; -import org.libresonic.player.domain.MediaFile; -import org.libresonic.player.domain.PlayQueue; -import org.libresonic.player.domain.Player; -import org.libresonic.player.domain.Transcoding; -import org.libresonic.player.domain.TransferStatus; -import org.libresonic.player.domain.User; -import org.libresonic.player.domain.VideoTranscodingSettings; +import org.libresonic.player.domain.*; import org.libresonic.player.service.jukebox.AudioPlayer; import org.libresonic.player.util.FileUtil; +import java.io.InputStream; + import static org.libresonic.player.service.jukebox.AudioPlayer.State.EOM; /** diff --git a/libresonic-main/src/main/java/org/libresonic/player/service/LastFmCache.java b/libresonic-main/src/main/java/org/libresonic/player/service/LastFmCache.java index a7b01f91..a7e8f8e9 100644 --- a/libresonic-main/src/main/java/org/libresonic/player/service/LastFmCache.java +++ b/libresonic-main/src/main/java/org/libresonic/player/service/LastFmCache.java @@ -19,20 +19,14 @@ package org.libresonic.player.service; -import java.io.ByteArrayInputStream; -import java.io.File; -import java.io.FileInputStream; -import java.io.FileOutputStream; -import java.io.InputStream; -import java.io.OutputStream; -import java.util.Map; -import java.util.Properties; - -import org.apache.commons.io.IOUtils; - import de.umass.lastfm.cache.Cache; import de.umass.lastfm.cache.ExpirationPolicy; import de.umass.lastfm.cache.FileSystemCache; +import org.apache.commons.io.IOUtils; + +import java.io.*; +import java.util.Map; +import java.util.Properties; /** * Based on {@link FileSystemCache}, but properly closes files and enforces diff --git a/libresonic-main/src/main/java/org/libresonic/player/service/LastFmExpirationPolicy.java b/libresonic-main/src/main/java/org/libresonic/player/service/LastFmExpirationPolicy.java index e5a378a5..e3cd6f16 100644 --- a/libresonic-main/src/main/java/org/libresonic/player/service/LastFmExpirationPolicy.java +++ b/libresonic-main/src/main/java/org/libresonic/player/service/LastFmExpirationPolicy.java @@ -19,11 +19,11 @@ package org.libresonic.player.service; +import de.umass.lastfm.cache.ExpirationPolicy; + import java.util.LinkedHashMap; import java.util.Map; -import de.umass.lastfm.cache.ExpirationPolicy; - /** * Artist and album info is cached permanently. Everything else is cached one year. * diff --git a/libresonic-main/src/main/java/org/libresonic/player/service/LastFmService.java b/libresonic-main/src/main/java/org/libresonic/player/service/LastFmService.java index 037c8d7e..c8065ae3 100644 --- a/libresonic-main/src/main/java/org/libresonic/player/service/LastFmService.java +++ b/libresonic-main/src/main/java/org/libresonic/player/service/LastFmService.java @@ -19,38 +19,26 @@ package org.libresonic.player.service; -import java.io.File; -import java.io.IOException; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collection; -import java.util.Collections; -import java.util.List; -import java.util.regex.Matcher; -import java.util.regex.Pattern; - -import org.apache.commons.lang.StringUtils; - import com.google.common.base.Function; import com.google.common.base.Predicates; import com.google.common.collect.FluentIterable; import com.google.common.collect.Lists; - import de.umass.lastfm.Album; import de.umass.lastfm.Artist; import de.umass.lastfm.Caller; import de.umass.lastfm.ImageSize; import de.umass.lastfm.Track; -import de.umass.lastfm.cache.Cache; - +import org.apache.commons.lang.StringUtils; import org.libresonic.player.Logger; import org.libresonic.player.dao.ArtistDao; import org.libresonic.player.dao.MediaFileDao; -import org.libresonic.player.domain.LastFmCoverArt; -import org.libresonic.player.domain.AlbumNotes; -import org.libresonic.player.domain.ArtistBio; -import org.libresonic.player.domain.MediaFile; -import org.libresonic.player.domain.MusicFolder; +import org.libresonic.player.domain.*; + +import java.io.File; +import java.io.IOException; +import java.util.*; +import java.util.regex.Matcher; +import java.util.regex.Pattern; /** * Provides services from the Last.fm REST API. diff --git a/libresonic-main/src/main/java/org/libresonic/player/service/MediaFileService.java b/libresonic-main/src/main/java/org/libresonic/player/service/MediaFileService.java index 5e59832c..d02996ac 100644 --- a/libresonic-main/src/main/java/org/libresonic/player/service/MediaFileService.java +++ b/libresonic-main/src/main/java/org/libresonic/player/service/MediaFileService.java @@ -19,25 +19,10 @@ */ package org.libresonic.player.service; -import java.io.File; -import java.io.IOException; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collections; -import java.util.Comparator; -import java.util.Date; -import java.util.HashMap; -import java.util.Iterator; -import java.util.List; -import java.util.Map; -import java.util.Set; -import java.util.TreeSet; - -import org.apache.commons.io.FilenameUtils; -import org.apache.commons.lang.StringUtils; - import net.sf.ehcache.Ehcache; import net.sf.ehcache.Element; +import org.apache.commons.io.FilenameUtils; +import org.apache.commons.lang.StringUtils; import org.libresonic.player.Logger; import org.libresonic.player.dao.AlbumDao; import org.libresonic.player.dao.MediaFileDao; @@ -48,6 +33,10 @@ import org.libresonic.player.service.metadata.MetaDataParser; import org.libresonic.player.service.metadata.MetaDataParserFactory; import org.libresonic.player.util.FileUtil; +import java.io.File; +import java.io.IOException; +import java.util.*; + import static org.libresonic.player.domain.MediaFile.MediaType.*; /** diff --git a/libresonic-main/src/main/java/org/libresonic/player/service/MediaScannerService.java b/libresonic-main/src/main/java/org/libresonic/player/service/MediaScannerService.java index 445e79b5..e32c958b 100644 --- a/libresonic-main/src/main/java/org/libresonic/player/service/MediaScannerService.java +++ b/libresonic-main/src/main/java/org/libresonic/player/service/MediaScannerService.java @@ -19,28 +19,17 @@ */ package org.libresonic.player.service; -import java.io.File; -import java.util.Calendar; -import java.util.Date; -import java.util.HashMap; -import java.util.Map; -import java.util.Timer; -import java.util.TimerTask; - import org.apache.commons.lang.ObjectUtils; - import org.libresonic.player.Logger; import org.libresonic.player.dao.AlbumDao; import org.libresonic.player.dao.ArtistDao; import org.libresonic.player.dao.MediaFileDao; -import org.libresonic.player.domain.Album; -import org.libresonic.player.domain.Artist; -import org.libresonic.player.domain.Genres; -import org.libresonic.player.domain.MediaFile; -import org.libresonic.player.domain.MediaLibraryStatistics; -import org.libresonic.player.domain.MusicFolder; +import org.libresonic.player.domain.*; import org.libresonic.player.util.FileUtil; +import java.io.File; +import java.util.*; + /** * Provides services for scanning the music library. * diff --git a/libresonic-main/src/main/java/org/libresonic/player/service/MusicIndexService.java b/libresonic-main/src/main/java/org/libresonic/player/service/MusicIndexService.java index 8e4618ec..669fcac9 100644 --- a/libresonic-main/src/main/java/org/libresonic/player/service/MusicIndexService.java +++ b/libresonic-main/src/main/java/org/libresonic/player/service/MusicIndexService.java @@ -19,28 +19,15 @@ */ package org.libresonic.player.service; +import org.libresonic.player.domain.*; +import org.libresonic.player.domain.MusicIndex.SortableArtist; +import org.libresonic.player.util.FileUtil; + import java.io.File; import java.io.IOException; import java.io.Serializable; import java.text.Collator; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collections; -import java.util.Comparator; -import java.util.HashSet; -import java.util.List; -import java.util.Set; -import java.util.SortedMap; -import java.util.StringTokenizer; -import java.util.TreeMap; - -import org.libresonic.player.domain.Artist; -import org.libresonic.player.domain.MediaFile; -import org.libresonic.player.domain.MusicFolder; -import org.libresonic.player.domain.MusicFolderContent; -import org.libresonic.player.domain.MusicIndex; -import org.libresonic.player.domain.MusicIndex.SortableArtist; -import org.libresonic.player.util.FileUtil; +import java.util.*; /** * Provides services for grouping artists by index. diff --git a/libresonic-main/src/main/java/org/libresonic/player/service/NetworkService.java b/libresonic-main/src/main/java/org/libresonic/player/service/NetworkService.java index 1d0d89e3..23648f51 100644 --- a/libresonic-main/src/main/java/org/libresonic/player/service/NetworkService.java +++ b/libresonic-main/src/main/java/org/libresonic/player/service/NetworkService.java @@ -19,15 +19,6 @@ */ package org.libresonic.player.service; -import java.io.IOException; -import java.util.ArrayList; -import java.util.Date; -import java.util.List; -import java.util.concurrent.Executors; -import java.util.concurrent.Future; -import java.util.concurrent.ScheduledExecutorService; -import java.util.concurrent.TimeUnit; - import org.apache.http.HttpStatus; import org.apache.http.NameValuePair; import org.apache.http.StatusLine; @@ -41,7 +32,6 @@ import org.apache.http.impl.client.CloseableHttpClient; import org.apache.http.impl.client.HttpClients; import org.apache.http.message.BasicNameValuePair; import org.apache.http.util.EntityUtils; - import org.libresonic.player.Logger; import org.libresonic.player.domain.UrlRedirectType; import org.libresonic.player.service.upnp.ClingRouter; @@ -49,6 +39,15 @@ import org.libresonic.player.service.upnp.NATPMPRouter; import org.libresonic.player.service.upnp.Router; import org.libresonic.player.util.StringUtil; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Date; +import java.util.List; +import java.util.concurrent.Executors; +import java.util.concurrent.Future; +import java.util.concurrent.ScheduledExecutorService; +import java.util.concurrent.TimeUnit; + /** * Provides network-related services, including port forwarding on UPnP routers and * URL redirection from http://xxxx.libresonic.org. diff --git a/libresonic-main/src/main/java/org/libresonic/player/service/PlayerService.java b/libresonic-main/src/main/java/org/libresonic/player/service/PlayerService.java index 441186ef..46dd1afd 100644 --- a/libresonic-main/src/main/java/org/libresonic/player/service/PlayerService.java +++ b/libresonic-main/src/main/java/org/libresonic/player/service/PlayerService.java @@ -19,17 +19,8 @@ */ package org.libresonic.player.service; -import java.util.ArrayList; -import java.util.Date; -import java.util.List; - -import javax.servlet.http.Cookie; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - import org.apache.commons.lang.RandomStringUtils; import org.apache.commons.lang.StringUtils; - import org.libresonic.player.dao.PlayerDao; import org.libresonic.player.domain.Player; import org.libresonic.player.domain.Transcoding; @@ -37,6 +28,14 @@ import org.libresonic.player.domain.TransferStatus; import org.libresonic.player.domain.User; import org.libresonic.player.util.StringUtil; +import javax.servlet.http.Cookie; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +import java.util.ArrayList; +import java.util.Date; +import java.util.List; + /** * Provides services for maintaining the set of players. * diff --git a/libresonic-main/src/main/java/org/libresonic/player/service/PlaylistService.java b/libresonic-main/src/main/java/org/libresonic/player/service/PlaylistService.java index 1f2aab3b..c3878bcc 100644 --- a/libresonic-main/src/main/java/org/libresonic/player/service/PlaylistService.java +++ b/libresonic-main/src/main/java/org/libresonic/player/service/PlaylistService.java @@ -19,25 +19,6 @@ */ package org.libresonic.player.service; -import java.io.BufferedReader; -import java.io.ByteArrayInputStream; -import java.io.File; -import java.io.FileInputStream; -import java.io.IOException; -import java.io.InputStream; -import java.io.InputStreamReader; -import java.io.OutputStream; -import java.io.OutputStreamWriter; -import java.io.PrintWriter; -import java.nio.charset.Charset; -import java.util.ArrayList; -import java.util.Collections; -import java.util.Comparator; -import java.util.Date; -import java.util.List; -import java.util.regex.Matcher; -import java.util.regex.Pattern; - import org.apache.commons.io.FilenameUtils; import org.apache.commons.io.IOUtils; import org.apache.commons.lang.StringEscapeUtils; @@ -46,7 +27,6 @@ import org.jdom.Element; import org.jdom.JDOMException; import org.jdom.Namespace; import org.jdom.input.SAXBuilder; - import org.libresonic.player.Logger; import org.libresonic.player.dao.MediaFileDao; import org.libresonic.player.dao.PlaylistDao; @@ -58,6 +38,12 @@ import org.libresonic.player.util.Pair; import org.libresonic.player.util.StringUtil; import org.libresonic.player.util.Util; +import java.io.*; +import java.nio.charset.Charset; +import java.util.*; +import java.util.regex.Matcher; +import java.util.regex.Pattern; + /** * Provides services for loading and saving playlists to and from persistent storage. * diff --git a/libresonic-main/src/main/java/org/libresonic/player/service/PodcastService.java b/libresonic-main/src/main/java/org/libresonic/player/service/PodcastService.java index cd6e5b4d..5c7fb3ff 100644 --- a/libresonic-main/src/main/java/org/libresonic/player/service/PodcastService.java +++ b/libresonic-main/src/main/java/org/libresonic/player/service/PodcastService.java @@ -19,26 +19,6 @@ */ package org.libresonic.player.service; -import java.io.File; -import java.io.FileOutputStream; -import java.io.InputStream; -import java.io.OutputStream; -import java.text.DateFormat; -import java.text.SimpleDateFormat; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collections; -import java.util.Comparator; -import java.util.Date; -import java.util.List; -import java.util.Locale; -import java.util.concurrent.ExecutorService; -import java.util.concurrent.Executors; -import java.util.concurrent.ScheduledExecutorService; -import java.util.concurrent.ScheduledFuture; -import java.util.concurrent.ThreadFactory; -import java.util.concurrent.TimeUnit; - import com.google.common.base.Predicate; import com.google.common.collect.Iterables; import com.google.common.collect.Lists; @@ -57,7 +37,6 @@ import org.jdom.Document; import org.jdom.Element; import org.jdom.Namespace; import org.jdom.input.SAXBuilder; - import org.libresonic.player.Logger; import org.libresonic.player.dao.PodcastDao; import org.libresonic.player.domain.MediaFile; @@ -69,6 +48,15 @@ import org.libresonic.player.service.metadata.MetaDataParser; import org.libresonic.player.service.metadata.MetaDataParserFactory; import org.libresonic.player.util.StringUtil; +import java.io.File; +import java.io.FileOutputStream; +import java.io.InputStream; +import java.io.OutputStream; +import java.text.DateFormat; +import java.text.SimpleDateFormat; +import java.util.*; +import java.util.concurrent.*; + /** * Provides services for Podcast reception. * diff --git a/libresonic-main/src/main/java/org/libresonic/player/service/RatingService.java b/libresonic-main/src/main/java/org/libresonic/player/service/RatingService.java index 5b8f0e2d..ab8b087c 100644 --- a/libresonic-main/src/main/java/org/libresonic/player/service/RatingService.java +++ b/libresonic-main/src/main/java/org/libresonic/player/service/RatingService.java @@ -19,15 +19,15 @@ */ package org.libresonic.player.service; -import java.io.File; -import java.util.ArrayList; -import java.util.List; - import org.libresonic.player.dao.RatingDao; import org.libresonic.player.domain.MediaFile; import org.libresonic.player.domain.MusicFolder; import org.libresonic.player.util.FileUtil; +import java.io.File; +import java.util.ArrayList; +import java.util.List; + /** * Provides services for user ratings. * diff --git a/libresonic-main/src/main/java/org/libresonic/player/service/SearchService.java b/libresonic-main/src/main/java/org/libresonic/player/service/SearchService.java index a73a964c..aa4c100c 100644 --- a/libresonic-main/src/main/java/org/libresonic/player/service/SearchService.java +++ b/libresonic-main/src/main/java/org/libresonic/player/service/SearchService.java @@ -19,21 +19,8 @@ */ package org.libresonic.player.service; -import java.io.File; -import java.io.IOException; -import java.io.Reader; -import java.io.StringReader; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Random; - -import org.apache.lucene.analysis.ASCIIFoldingFilter; -import org.apache.lucene.analysis.Analyzer; -import org.apache.lucene.analysis.LowerCaseFilter; -import org.apache.lucene.analysis.StopFilter; -import org.apache.lucene.analysis.TokenStream; +import com.google.common.collect.Lists; +import org.apache.lucene.analysis.*; import org.apache.lucene.analysis.standard.StandardAnalyzer; import org.apache.lucene.analysis.standard.StandardFilter; import org.apache.lucene.analysis.standard.StandardTokenizer; @@ -45,15 +32,7 @@ import org.apache.lucene.index.IndexReader; import org.apache.lucene.index.IndexWriter; import org.apache.lucene.index.Term; import org.apache.lucene.queryParser.MultiFieldQueryParser; -import org.apache.lucene.search.BooleanClause; -import org.apache.lucene.search.BooleanQuery; -import org.apache.lucene.search.IndexSearcher; -import org.apache.lucene.search.NumericRangeQuery; -import org.apache.lucene.search.Query; -import org.apache.lucene.search.ScoreDoc; -import org.apache.lucene.search.Searcher; -import org.apache.lucene.search.TermQuery; -import org.apache.lucene.search.TopDocs; +import org.apache.lucene.search.*; import org.apache.lucene.search.spans.SpanOrQuery; import org.apache.lucene.search.spans.SpanQuery; import org.apache.lucene.search.spans.SpanTermQuery; @@ -61,21 +40,18 @@ import org.apache.lucene.store.Directory; import org.apache.lucene.store.FSDirectory; import org.apache.lucene.util.NumericUtils; import org.apache.lucene.util.Version; - -import com.google.common.collect.Lists; - import org.libresonic.player.Logger; import org.libresonic.player.dao.AlbumDao; import org.libresonic.player.dao.ArtistDao; -import org.libresonic.player.domain.Album; -import org.libresonic.player.domain.Artist; -import org.libresonic.player.domain.MediaFile; -import org.libresonic.player.domain.MusicFolder; -import org.libresonic.player.domain.RandomSearchCriteria; -import org.libresonic.player.domain.SearchCriteria; -import org.libresonic.player.domain.SearchResult; +import org.libresonic.player.domain.*; import org.libresonic.player.util.FileUtil; +import java.io.File; +import java.io.IOException; +import java.io.Reader; +import java.io.StringReader; +import java.util.*; + import static org.libresonic.player.service.SearchService.IndexType.*; /** diff --git a/libresonic-main/src/main/java/org/libresonic/player/service/SecurityService.java b/libresonic-main/src/main/java/org/libresonic/player/service/SecurityService.java index 2b79c018..d4b07cc5 100644 --- a/libresonic-main/src/main/java/org/libresonic/player/service/SecurityService.java +++ b/libresonic-main/src/main/java/org/libresonic/player/service/SecurityService.java @@ -35,6 +35,7 @@ import org.springframework.security.core.userdetails.UsernameNotFoundException; import org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestWrapper; import javax.servlet.http.HttpServletRequest; + import java.io.File; import java.util.ArrayList; import java.util.List; diff --git a/libresonic-main/src/main/java/org/libresonic/player/service/SettingsService.java b/libresonic-main/src/main/java/org/libresonic/player/service/SettingsService.java index 2f253ae2..eb68b64a 100644 --- a/libresonic-main/src/main/java/org/libresonic/player/service/SettingsService.java +++ b/libresonic-main/src/main/java/org/libresonic/player/service/SettingsService.java @@ -20,20 +20,12 @@ package org.libresonic.player.service; import org.apache.commons.lang.StringUtils; - import org.libresonic.player.Logger; import org.libresonic.player.dao.AvatarDao; import org.libresonic.player.dao.InternetRadioDao; import org.libresonic.player.dao.MusicFolderDao; import org.libresonic.player.dao.UserDao; -import org.libresonic.player.domain.AlbumListType; -import org.libresonic.player.domain.Avatar; -import org.libresonic.player.domain.InternetRadio; -import org.libresonic.player.domain.MediaLibraryStatistics; -import org.libresonic.player.domain.MusicFolder; -import org.libresonic.player.domain.Theme; -import org.libresonic.player.domain.UrlRedirectType; -import org.libresonic.player.domain.UserSettings; +import org.libresonic.player.domain.*; import org.libresonic.player.util.FileUtil; import org.libresonic.player.util.StringUtil; import org.libresonic.player.util.Util; diff --git a/libresonic-main/src/main/java/org/libresonic/player/service/ShareService.java b/libresonic-main/src/main/java/org/libresonic/player/service/ShareService.java index 6ca0f66c..69873e83 100644 --- a/libresonic-main/src/main/java/org/libresonic/player/service/ShareService.java +++ b/libresonic-main/src/main/java/org/libresonic/player/service/ShareService.java @@ -19,16 +19,8 @@ */ package org.libresonic.player.service; -import java.util.ArrayList; -import java.util.Calendar; -import java.util.Date; -import java.util.List; - -import javax.servlet.http.HttpServletRequest; - import org.apache.commons.lang.ObjectUtils; import org.apache.commons.lang.RandomStringUtils; - import org.libresonic.player.Logger; import org.libresonic.player.dao.ShareDao; import org.libresonic.player.domain.MediaFile; @@ -36,6 +28,13 @@ import org.libresonic.player.domain.MusicFolder; import org.libresonic.player.domain.Share; import org.libresonic.player.domain.User; +import javax.servlet.http.HttpServletRequest; + +import java.util.ArrayList; +import java.util.Calendar; +import java.util.Date; +import java.util.List; + /** * Provides services for sharing media. * diff --git a/libresonic-main/src/main/java/org/libresonic/player/service/SonosService.java b/libresonic-main/src/main/java/org/libresonic/player/service/SonosService.java index e9a1e013..a2a59555 100644 --- a/libresonic-main/src/main/java/org/libresonic/player/service/SonosService.java +++ b/libresonic-main/src/main/java/org/libresonic/player/service/SonosService.java @@ -19,28 +19,8 @@ package org.libresonic.player.service; -import java.io.IOException; -import java.util.ArrayList; -import java.util.Date; -import java.util.List; -import java.util.SortedMap; -import java.util.SortedSet; -import java.util.TreeSet; -import java.util.concurrent.ConcurrentSkipListMap; -import java.util.concurrent.Executors; -import java.util.concurrent.ScheduledExecutorService; -import java.util.concurrent.TimeUnit; - -import javax.annotation.Resource; -import javax.servlet.http.HttpServletRequest; -import javax.xml.bind.JAXBContext; -import javax.xml.bind.JAXBException; -import javax.xml.bind.Unmarshaller; -import javax.xml.datatype.XMLGregorianCalendar; -import javax.xml.ws.Holder; -import javax.xml.ws.WebServiceContext; -import javax.xml.ws.handler.MessageContext; - +import com.sonos.services._1.*; +import com.sonos.services._1_1.SonosSoap; import org.apache.commons.lang.RandomStringUtils; import org.apache.commons.lang.StringUtils; import org.apache.cxf.headers.Header; @@ -48,45 +28,6 @@ import org.apache.cxf.helpers.CastUtils; import org.apache.cxf.jaxb.JAXBDataBinding; import org.apache.cxf.jaxws.context.WrappedMessageContext; import org.apache.cxf.message.Message; -import org.w3c.dom.Node; - -import com.sonos.services._1.AbstractMedia; -import com.sonos.services._1.AddToContainerResult; -import com.sonos.services._1.ContentKey; -import com.sonos.services._1.CreateContainerResult; -import com.sonos.services._1.Credentials; -import com.sonos.services._1.DeleteContainerResult; -import com.sonos.services._1.DeviceAuthTokenResult; -import com.sonos.services._1.DeviceLinkCodeResult; -import com.sonos.services._1.ExtendedMetadata; -import com.sonos.services._1.GetExtendedMetadata; -import com.sonos.services._1.GetExtendedMetadataResponse; -import com.sonos.services._1.GetExtendedMetadataText; -import com.sonos.services._1.GetExtendedMetadataTextResponse; -import com.sonos.services._1.GetMediaMetadata; -import com.sonos.services._1.GetMediaMetadataResponse; -import com.sonos.services._1.GetMetadata; -import com.sonos.services._1.GetMetadataResponse; -import com.sonos.services._1.GetSessionId; -import com.sonos.services._1.GetSessionIdResponse; -import com.sonos.services._1.HttpHeaders; -import com.sonos.services._1.LastUpdate; -import com.sonos.services._1.MediaCollection; -import com.sonos.services._1.MediaList; -import com.sonos.services._1.MediaMetadata; -import com.sonos.services._1.MediaUriAction; -import com.sonos.services._1.RateItem; -import com.sonos.services._1.RateItemResponse; -import com.sonos.services._1.RelatedBrowse; -import com.sonos.services._1.RemoveFromContainerResult; -import com.sonos.services._1.RenameContainerResult; -import com.sonos.services._1.ReorderContainerResult; -import com.sonos.services._1.ReportPlaySecondsResult; -import com.sonos.services._1.Search; -import com.sonos.services._1.SearchResponse; -import com.sonos.services._1.SegmentMetadataList; -import com.sonos.services._1_1.SonosSoap; - import org.libresonic.player.Logger; import org.libresonic.player.domain.AlbumListType; import org.libresonic.player.domain.MediaFile; @@ -95,6 +36,24 @@ import org.libresonic.player.domain.User; import org.libresonic.player.service.sonos.SonosHelper; import org.libresonic.player.service.sonos.SonosServiceRegistration; import org.libresonic.player.service.sonos.SonosSoapFault; +import org.w3c.dom.Node; + +import javax.annotation.Resource; +import javax.servlet.http.HttpServletRequest; +import javax.xml.bind.JAXBContext; +import javax.xml.bind.JAXBException; +import javax.xml.bind.Unmarshaller; +import javax.xml.datatype.XMLGregorianCalendar; +import javax.xml.ws.Holder; +import javax.xml.ws.WebServiceContext; +import javax.xml.ws.handler.MessageContext; + +import java.io.IOException; +import java.util.*; +import java.util.concurrent.ConcurrentSkipListMap; +import java.util.concurrent.Executors; +import java.util.concurrent.ScheduledExecutorService; +import java.util.concurrent.TimeUnit; /** * For manual testing of this service: diff --git a/libresonic-main/src/main/java/org/libresonic/player/service/StatusService.java b/libresonic-main/src/main/java/org/libresonic/player/service/StatusService.java index 7a9d84d3..255af64c 100644 --- a/libresonic-main/src/main/java/org/libresonic/player/service/StatusService.java +++ b/libresonic-main/src/main/java/org/libresonic/player/service/StatusService.java @@ -20,19 +20,12 @@ package org.libresonic.player.service; import org.libresonic.player.domain.MediaFile; -import org.libresonic.player.domain.Player; import org.libresonic.player.domain.PlayStatus; +import org.libresonic.player.domain.Player; import org.libresonic.player.domain.TransferStatus; import java.io.File; -import java.util.ArrayList; -import java.util.Date; -import java.util.HashSet; -import java.util.Iterator; -import java.util.LinkedHashMap; -import java.util.List; -import java.util.Map; -import java.util.Set; +import java.util.*; /** * Provides services for maintaining the list of stream, download and upload statuses. diff --git a/libresonic-main/src/main/java/org/libresonic/player/service/TranscodingService.java b/libresonic-main/src/main/java/org/libresonic/player/service/TranscodingService.java index 36871490..87bbb0b8 100644 --- a/libresonic-main/src/main/java/org/libresonic/player/service/TranscodingService.java +++ b/libresonic-main/src/main/java/org/libresonic/player/service/TranscodingService.java @@ -19,32 +19,26 @@ */ package org.libresonic.player.service; -import java.io.File; -import java.io.FileInputStream; -import java.io.IOException; -import java.io.InputStream; -import java.util.Arrays; -import java.util.LinkedList; -import java.util.List; - import org.apache.commons.io.FileUtils; import org.apache.commons.io.FilenameUtils; import org.apache.commons.io.filefilter.PrefixFileFilter; import org.apache.commons.lang.StringUtils; - import org.libresonic.player.Logger; import org.libresonic.player.controller.VideoPlayerController; import org.libresonic.player.dao.TranscodingDao; -import org.libresonic.player.domain.MediaFile; -import org.libresonic.player.domain.Player; -import org.libresonic.player.domain.TranscodeScheme; -import org.libresonic.player.domain.Transcoding; -import org.libresonic.player.domain.UserSettings; -import org.libresonic.player.domain.VideoTranscodingSettings; +import org.libresonic.player.domain.*; import org.libresonic.player.io.TranscodeInputStream; import org.libresonic.player.util.StringUtil; import org.libresonic.player.util.Util; +import java.io.File; +import java.io.FileInputStream; +import java.io.IOException; +import java.io.InputStream; +import java.util.Arrays; +import java.util.LinkedList; +import java.util.List; + /** * Provides services for transcoding media. Transcoding is the process of * converting an audio stream to a different format and/or bit rate. The latter is diff --git a/libresonic-main/src/main/java/org/libresonic/player/service/UPnPService.java b/libresonic-main/src/main/java/org/libresonic/player/service/UPnPService.java index e33efe10..df4178d1 100644 --- a/libresonic-main/src/main/java/org/libresonic/player/service/UPnPService.java +++ b/libresonic-main/src/main/java/org/libresonic/player/service/UPnPService.java @@ -19,23 +19,11 @@ */ package org.libresonic.player.service; -import java.net.URL; -import java.util.ArrayList; -import java.util.List; - import org.fourthline.cling.UpnpService; import org.fourthline.cling.UpnpServiceImpl; import org.fourthline.cling.binding.annotations.AnnotationLocalServiceBinder; import org.fourthline.cling.model.DefaultServiceManager; -import org.fourthline.cling.model.meta.Device; -import org.fourthline.cling.model.meta.DeviceDetails; -import org.fourthline.cling.model.meta.DeviceIdentity; -import org.fourthline.cling.model.meta.Icon; -import org.fourthline.cling.model.meta.LocalDevice; -import org.fourthline.cling.model.meta.LocalService; -import org.fourthline.cling.model.meta.ManufacturerDetails; -import org.fourthline.cling.model.meta.ModelDetails; -import org.fourthline.cling.model.meta.RemoteDevice; +import org.fourthline.cling.model.meta.*; import org.fourthline.cling.model.types.DLNADoc; import org.fourthline.cling.model.types.DeviceType; import org.fourthline.cling.model.types.UDADeviceType; @@ -44,13 +32,16 @@ import org.fourthline.cling.support.connectionmanager.ConnectionManagerService; import org.fourthline.cling.support.model.ProtocolInfos; import org.fourthline.cling.support.model.dlna.DLNAProfiles; import org.fourthline.cling.support.model.dlna.DLNAProtocolInfo; - import org.libresonic.player.Logger; import org.libresonic.player.domain.Version; import org.libresonic.player.service.upnp.ApacheUpnpServiceConfiguration; import org.libresonic.player.service.upnp.FolderBasedContentDirectory; import org.libresonic.player.service.upnp.MSMediaReceiverRegistrarService; +import java.net.URL; +import java.util.ArrayList; +import java.util.List; + /** * @author Sindre Mehus * @version $Id$ diff --git a/libresonic-main/src/main/java/org/libresonic/player/service/VersionService.java b/libresonic-main/src/main/java/org/libresonic/player/service/VersionService.java index c93e117d..5c35a5cc 100644 --- a/libresonic-main/src/main/java/org/libresonic/player/service/VersionService.java +++ b/libresonic-main/src/main/java/org/libresonic/player/service/VersionService.java @@ -19,17 +19,6 @@ */ package org.libresonic.player.service; -import java.io.BufferedReader; -import java.io.IOException; -import java.io.InputStream; -import java.io.InputStreamReader; -import java.io.StringReader; -import java.text.DateFormat; -import java.text.SimpleDateFormat; -import java.util.Date; -import java.util.regex.Matcher; -import java.util.regex.Pattern; - import org.apache.commons.io.IOUtils; import org.apache.http.client.ResponseHandler; import org.apache.http.client.config.RequestConfig; @@ -37,10 +26,16 @@ import org.apache.http.client.methods.HttpGet; import org.apache.http.impl.client.BasicResponseHandler; import org.apache.http.impl.client.CloseableHttpClient; import org.apache.http.impl.client.HttpClients; - import org.libresonic.player.Logger; import org.libresonic.player.domain.Version; +import java.io.*; +import java.text.DateFormat; +import java.text.SimpleDateFormat; +import java.util.Date; +import java.util.regex.Matcher; +import java.util.regex.Pattern; + /** * Provides version-related services, including functionality for determining whether a newer * version of Libresonic is available. diff --git a/libresonic-main/src/main/java/org/libresonic/player/service/jukebox/AudioPlayer.java b/libresonic-main/src/main/java/org/libresonic/player/service/jukebox/AudioPlayer.java index bacca409..fdf34464 100644 --- a/libresonic-main/src/main/java/org/libresonic/player/service/jukebox/AudioPlayer.java +++ b/libresonic-main/src/main/java/org/libresonic/player/service/jukebox/AudioPlayer.java @@ -19,19 +19,18 @@ */ package org.libresonic.player.service.jukebox; -import java.io.IOException; -import java.io.InputStream; -import java.util.concurrent.atomic.AtomicReference; +import org.apache.commons.io.IOUtils; +import org.libresonic.player.Logger; +import org.libresonic.player.service.JukeboxService; import javax.sound.sampled.AudioFormat; import javax.sound.sampled.AudioSystem; import javax.sound.sampled.FloatControl; import javax.sound.sampled.SourceDataLine; -import org.apache.commons.io.IOUtils; - -import org.libresonic.player.Logger; -import org.libresonic.player.service.JukeboxService; +import java.io.IOException; +import java.io.InputStream; +import java.util.concurrent.atomic.AtomicReference; import static org.libresonic.player.service.jukebox.AudioPlayer.State.*; diff --git a/libresonic-main/src/main/java/org/libresonic/player/service/jukebox/PlayerTest.java b/libresonic-main/src/main/java/org/libresonic/player/service/jukebox/PlayerTest.java index 5eb41610..a91fd858 100644 --- a/libresonic-main/src/main/java/org/libresonic/player/service/jukebox/PlayerTest.java +++ b/libresonic-main/src/main/java/org/libresonic/player/service/jukebox/PlayerTest.java @@ -3,6 +3,7 @@ package org.libresonic.player.service.jukebox; import javax.swing.*; import javax.swing.event.ChangeEvent; import javax.swing.event.ChangeListener; + import java.awt.*; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; diff --git a/libresonic-main/src/main/java/org/libresonic/player/service/metadata/FFmpegParser.java b/libresonic-main/src/main/java/org/libresonic/player/service/metadata/FFmpegParser.java index 628884ba..79ec7f73 100644 --- a/libresonic-main/src/main/java/org/libresonic/player/service/metadata/FFmpegParser.java +++ b/libresonic-main/src/main/java/org/libresonic/player/service/metadata/FFmpegParser.java @@ -19,13 +19,13 @@ */ package org.libresonic.player.service.metadata; +import org.apache.commons.io.FilenameUtils; import org.libresonic.player.Logger; import org.libresonic.player.domain.MediaFile; import org.libresonic.player.io.InputStreamReaderThread; import org.libresonic.player.service.ServiceLocator; import org.libresonic.player.service.TranscodingService; import org.libresonic.player.util.StringUtil; -import org.apache.commons.io.FilenameUtils; import java.io.File; import java.io.InputStream; diff --git a/libresonic-main/src/main/java/org/libresonic/player/service/metadata/JaudiotaggerParser.java b/libresonic-main/src/main/java/org/libresonic/player/service/metadata/JaudiotaggerParser.java index 3eb00e81..903e42d9 100644 --- a/libresonic-main/src/main/java/org/libresonic/player/service/metadata/JaudiotaggerParser.java +++ b/libresonic-main/src/main/java/org/libresonic/player/service/metadata/JaudiotaggerParser.java @@ -19,8 +19,6 @@ */ package org.libresonic.player.service.metadata; -import org.libresonic.player.Logger; -import org.libresonic.player.domain.MediaFile; import org.apache.commons.io.FilenameUtils; import org.apache.commons.lang.StringUtils; import org.jaudiotagger.audio.AudioFile; @@ -30,6 +28,8 @@ import org.jaudiotagger.tag.FieldKey; import org.jaudiotagger.tag.Tag; import org.jaudiotagger.tag.datatype.Artwork; import org.jaudiotagger.tag.reference.GenreTypes; +import org.libresonic.player.Logger; +import org.libresonic.player.domain.MediaFile; import java.io.File; import java.util.SortedSet; diff --git a/libresonic-main/src/main/java/org/libresonic/player/service/metadata/MetaDataParser.java b/libresonic-main/src/main/java/org/libresonic/player/service/metadata/MetaDataParser.java index 6f724e1f..f820aad8 100644 --- a/libresonic-main/src/main/java/org/libresonic/player/service/metadata/MetaDataParser.java +++ b/libresonic-main/src/main/java/org/libresonic/player/service/metadata/MetaDataParser.java @@ -19,12 +19,12 @@ */ package org.libresonic.player.service.metadata; +import org.apache.commons.io.FilenameUtils; +import org.apache.commons.lang.StringUtils; import org.libresonic.player.domain.MediaFile; import org.libresonic.player.domain.MusicFolder; import org.libresonic.player.service.ServiceLocator; import org.libresonic.player.service.SettingsService; -import org.apache.commons.io.FilenameUtils; -import org.apache.commons.lang.StringUtils; import java.io.File; import java.util.List; diff --git a/libresonic-main/src/main/java/org/libresonic/player/service/sonos/AlbumList.java b/libresonic-main/src/main/java/org/libresonic/player/service/sonos/AlbumList.java index ea2102d9..6ab2c396 100644 --- a/libresonic-main/src/main/java/org/libresonic/player/service/sonos/AlbumList.java +++ b/libresonic-main/src/main/java/org/libresonic/player/service/sonos/AlbumList.java @@ -19,10 +19,10 @@ package org.libresonic.player.service.sonos; -import java.util.List; - import org.libresonic.player.domain.MediaFile; +import java.util.List; + /** * @author Sindre Mehus * @version $Id$ diff --git a/libresonic-main/src/main/java/org/libresonic/player/service/sonos/SonosFaultInterceptor.java b/libresonic-main/src/main/java/org/libresonic/player/service/sonos/SonosFaultInterceptor.java index 4f7c4e99..eb795875 100644 --- a/libresonic-main/src/main/java/org/libresonic/player/service/sonos/SonosFaultInterceptor.java +++ b/libresonic-main/src/main/java/org/libresonic/player/service/sonos/SonosFaultInterceptor.java @@ -19,17 +19,16 @@ package org.libresonic.player.service.sonos; -import javax.xml.namespace.QName; - import org.apache.cxf.binding.soap.SoapMessage; import org.apache.cxf.binding.soap.interceptor.AbstractSoapInterceptor; import org.apache.cxf.helpers.DOMUtils; import org.apache.cxf.interceptor.Fault; import org.apache.cxf.phase.Phase; +import org.libresonic.player.Logger; import org.w3c.dom.Document; import org.w3c.dom.Element; -import org.libresonic.player.Logger; +import javax.xml.namespace.QName; /** * Intercepts all SonosSoapFault exceptions and builds a SOAP Fault. diff --git a/libresonic-main/src/main/java/org/libresonic/player/service/sonos/SonosHelper.java b/libresonic-main/src/main/java/org/libresonic/player/service/sonos/SonosHelper.java index ab26678f..8c5d3e87 100644 --- a/libresonic-main/src/main/java/org/libresonic/player/service/sonos/SonosHelper.java +++ b/libresonic-main/src/main/java/org/libresonic/player/service/sonos/SonosHelper.java @@ -19,58 +19,22 @@ package org.libresonic.player.service.sonos; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Calendar; -import java.util.Collections; -import java.util.List; - -import javax.servlet.http.HttpServletRequest; - -import org.apache.commons.lang.StringUtils; -import org.springframework.web.bind.ServletRequestUtils; - import com.google.common.base.Predicate; import com.google.common.collect.Iterables; import com.google.common.collect.Lists; -import com.sonos.services._1.AbstractMedia; -import com.sonos.services._1.AlbumArtUrl; -import com.sonos.services._1.ItemType; -import com.sonos.services._1.MediaCollection; -import com.sonos.services._1.MediaList; -import com.sonos.services._1.MediaMetadata; -import com.sonos.services._1.TrackMetadata; - +import com.sonos.services._1.*; +import org.apache.commons.lang.StringUtils; import org.libresonic.player.controller.CoverArtController; import org.libresonic.player.dao.MediaFileDao; -import org.libresonic.player.domain.AlbumListType; -import org.libresonic.player.domain.CoverArtScheme; -import org.libresonic.player.domain.Genre; -import org.libresonic.player.domain.MediaFile; -import org.libresonic.player.domain.MusicFolder; -import org.libresonic.player.domain.MusicFolderContent; -import org.libresonic.player.domain.MusicIndex; -import org.libresonic.player.domain.Player; -import org.libresonic.player.domain.PlayerTechnology; -import org.libresonic.player.domain.Playlist; -import org.libresonic.player.domain.PodcastChannel; -import org.libresonic.player.domain.PodcastEpisode; -import org.libresonic.player.domain.PodcastStatus; -import org.libresonic.player.domain.SearchCriteria; -import org.libresonic.player.domain.SearchResult; -import org.libresonic.player.service.LastFmService; -import org.libresonic.player.service.MediaFileService; -import org.libresonic.player.service.MusicIndexService; -import org.libresonic.player.service.PlayerService; -import org.libresonic.player.service.PlaylistService; -import org.libresonic.player.service.PodcastService; -import org.libresonic.player.service.RatingService; -import org.libresonic.player.service.SearchService; -import org.libresonic.player.service.SettingsService; -import org.libresonic.player.service.SonosService; -import org.libresonic.player.service.TranscodingService; +import org.libresonic.player.domain.*; +import org.libresonic.player.service.*; import org.libresonic.player.util.StringUtil; import org.libresonic.player.util.Util; +import org.springframework.web.bind.ServletRequestUtils; + +import javax.servlet.http.HttpServletRequest; + +import java.util.*; /** * @author Sindre Mehus diff --git a/libresonic-main/src/main/java/org/libresonic/player/service/sonos/SonosServiceRegistration.java b/libresonic-main/src/main/java/org/libresonic/player/service/sonos/SonosServiceRegistration.java index 5215073b..08533ed1 100644 --- a/libresonic-main/src/main/java/org/libresonic/player/service/sonos/SonosServiceRegistration.java +++ b/libresonic-main/src/main/java/org/libresonic/player/service/sonos/SonosServiceRegistration.java @@ -19,10 +19,6 @@ package org.libresonic.player.service.sonos; -import java.io.IOException; -import java.util.ArrayList; -import java.util.List; - import org.apache.http.NameValuePair; import org.apache.http.client.ResponseHandler; import org.apache.http.client.config.RequestConfig; @@ -33,11 +29,14 @@ import org.apache.http.impl.client.BasicResponseHandler; import org.apache.http.impl.client.CloseableHttpClient; import org.apache.http.impl.client.HttpClients; import org.apache.http.message.BasicNameValuePair; - import org.libresonic.player.Logger; import org.libresonic.player.util.Pair; import org.libresonic.player.util.StringUtil; +import java.io.IOException; +import java.util.ArrayList; +import java.util.List; + /** * @author Sindre Mehus * @version $Id$ diff --git a/libresonic-main/src/main/java/org/libresonic/player/service/upnp/ApacheUpnpServiceConfiguration.java b/libresonic-main/src/main/java/org/libresonic/player/service/upnp/ApacheUpnpServiceConfiguration.java index 464ce2af..732e0772 100644 --- a/libresonic-main/src/main/java/org/libresonic/player/service/upnp/ApacheUpnpServiceConfiguration.java +++ b/libresonic-main/src/main/java/org/libresonic/player/service/upnp/ApacheUpnpServiceConfiguration.java @@ -19,8 +19,6 @@ */ package org.libresonic.player.service.upnp; -import java.util.concurrent.Executors; - import org.fourthline.cling.DefaultUpnpServiceConfiguration; import org.fourthline.cling.transport.impl.apache.StreamClientConfigurationImpl; import org.fourthline.cling.transport.impl.apache.StreamClientImpl; @@ -30,6 +28,8 @@ import org.fourthline.cling.transport.spi.NetworkAddressFactory; import org.fourthline.cling.transport.spi.StreamClient; import org.fourthline.cling.transport.spi.StreamServer; +import java.util.concurrent.Executors; + /** * UPnP configuration which uses Apache HttpComponents. Needed to make UPnP work * when deploying on Tomcat. diff --git a/libresonic-main/src/main/java/org/libresonic/player/service/upnp/ClingRouter.java b/libresonic-main/src/main/java/org/libresonic/player/service/upnp/ClingRouter.java index b8c59644..3fce9460 100644 --- a/libresonic-main/src/main/java/org/libresonic/player/service/upnp/ClingRouter.java +++ b/libresonic-main/src/main/java/org/libresonic/player/service/upnp/ClingRouter.java @@ -19,12 +19,6 @@ */ package org.libresonic.player.service.upnp; -import java.net.InetAddress; -import java.net.UnknownHostException; -import java.util.Collection; -import java.util.concurrent.Semaphore; -import java.util.concurrent.atomic.AtomicReference; - import org.fourthline.cling.UpnpService; import org.fourthline.cling.model.action.ActionInvocation; import org.fourthline.cling.model.message.UpnpResponse; @@ -34,9 +28,14 @@ import org.fourthline.cling.support.igd.PortMappingListener; import org.fourthline.cling.support.igd.callback.PortMappingAdd; import org.fourthline.cling.support.igd.callback.PortMappingDelete; import org.fourthline.cling.support.model.PortMapping; - import org.libresonic.player.service.UPnPService; +import java.net.InetAddress; +import java.net.UnknownHostException; +import java.util.Collection; +import java.util.concurrent.Semaphore; +import java.util.concurrent.atomic.AtomicReference; + /** * @author Sindre Mehus * @version $Id$ diff --git a/libresonic-main/src/main/java/org/libresonic/player/service/upnp/FolderBasedContentDirectory.java b/libresonic-main/src/main/java/org/libresonic/player/service/upnp/FolderBasedContentDirectory.java index a706e062..feec52d4 100644 --- a/libresonic-main/src/main/java/org/libresonic/player/service/upnp/FolderBasedContentDirectory.java +++ b/libresonic-main/src/main/java/org/libresonic/player/service/upnp/FolderBasedContentDirectory.java @@ -19,37 +19,26 @@ */ package org.libresonic.player.service.upnp; -import java.net.URI; -import java.net.URISyntaxException; -import java.util.Arrays; -import java.util.List; - import org.fourthline.cling.support.contentdirectory.ContentDirectoryErrorCode; import org.fourthline.cling.support.contentdirectory.ContentDirectoryException; -import org.fourthline.cling.support.model.BrowseFlag; -import org.fourthline.cling.support.model.BrowseResult; -import org.fourthline.cling.support.model.DIDLContent; -import org.fourthline.cling.support.model.DIDLObject; -import org.fourthline.cling.support.model.PersonWithRole; -import org.fourthline.cling.support.model.SortCriterion; -import org.fourthline.cling.support.model.WriteStatus; +import org.fourthline.cling.support.model.*; import org.fourthline.cling.support.model.container.Container; import org.fourthline.cling.support.model.container.MusicAlbum; import org.fourthline.cling.support.model.container.PlaylistContainer; import org.fourthline.cling.support.model.container.StorageFolder; import org.fourthline.cling.support.model.item.Item; import org.fourthline.cling.support.model.item.MusicTrack; - import org.libresonic.player.Logger; -import org.libresonic.player.domain.CoverArtScheme; -import org.libresonic.player.domain.MediaFile; -import org.libresonic.player.domain.MediaLibraryStatistics; -import org.libresonic.player.domain.MusicFolder; -import org.libresonic.player.domain.Playlist; +import org.libresonic.player.domain.*; import org.libresonic.player.service.MediaFileService; import org.libresonic.player.service.PlaylistService; import org.libresonic.player.util.Util; +import java.net.URI; +import java.net.URISyntaxException; +import java.util.Arrays; +import java.util.List; + /** * @author Sindre Mehus * @version $Id$ diff --git a/libresonic-main/src/main/java/org/libresonic/player/service/upnp/LibresonicContentDirectory.java b/libresonic-main/src/main/java/org/libresonic/player/service/upnp/LibresonicContentDirectory.java index 61a06245..ef540aa0 100644 --- a/libresonic-main/src/main/java/org/libresonic/player/service/upnp/LibresonicContentDirectory.java +++ b/libresonic-main/src/main/java/org/libresonic/player/service/upnp/LibresonicContentDirectory.java @@ -28,14 +28,13 @@ import org.fourthline.cling.support.model.BrowseResult; import org.fourthline.cling.support.model.DIDLContent; import org.fourthline.cling.support.model.Res; import org.fourthline.cling.support.model.SortCriterion; -import org.seamless.util.MimeType; - import org.libresonic.player.domain.MediaFile; import org.libresonic.player.domain.Player; import org.libresonic.player.service.PlayerService; import org.libresonic.player.service.SettingsService; import org.libresonic.player.service.TranscodingService; import org.libresonic.player.util.StringUtil; +import org.seamless.util.MimeType; /** * @author Sindre Mehus diff --git a/libresonic-main/src/main/java/org/libresonic/player/spring/LoggingExceptionResolver.java b/libresonic-main/src/main/java/org/libresonic/player/spring/LoggingExceptionResolver.java index 14c753a4..e852ceb5 100644 --- a/libresonic-main/src/main/java/org/libresonic/player/spring/LoggingExceptionResolver.java +++ b/libresonic-main/src/main/java/org/libresonic/player/spring/LoggingExceptionResolver.java @@ -1,12 +1,13 @@ package org.libresonic.player.spring; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; import org.libresonic.player.Logger; import org.springframework.core.Ordered; import org.springframework.web.servlet.HandlerExceptionResolver; import org.springframework.web.servlet.ModelAndView; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + public class LoggingExceptionResolver implements HandlerExceptionResolver, Ordered { private static final Logger logger = Logger.getLogger(LoggingExceptionResolver.class); diff --git a/libresonic-main/src/main/java/org/libresonic/player/taglib/EscapeJavaScriptTag.java b/libresonic-main/src/main/java/org/libresonic/player/taglib/EscapeJavaScriptTag.java index 736e918d..2d786ed5 100644 --- a/libresonic-main/src/main/java/org/libresonic/player/taglib/EscapeJavaScriptTag.java +++ b/libresonic-main/src/main/java/org/libresonic/player/taglib/EscapeJavaScriptTag.java @@ -24,6 +24,7 @@ import org.apache.commons.lang.StringEscapeUtils; import javax.servlet.jsp.JspException; import javax.servlet.jsp.JspTagException; import javax.servlet.jsp.tagext.BodyTagSupport; + import java.io.IOException; /** diff --git a/libresonic-main/src/main/java/org/libresonic/player/taglib/FormatBytesTag.java b/libresonic-main/src/main/java/org/libresonic/player/taglib/FormatBytesTag.java index 81c53903..f89a603d 100644 --- a/libresonic-main/src/main/java/org/libresonic/player/taglib/FormatBytesTag.java +++ b/libresonic-main/src/main/java/org/libresonic/player/taglib/FormatBytesTag.java @@ -19,14 +19,16 @@ */ package org.libresonic.player.taglib; -import org.libresonic.player.util.*; -import org.springframework.web.servlet.support.*; +import org.libresonic.player.util.StringUtil; +import org.springframework.web.servlet.support.RequestContextUtils; -import javax.servlet.http.*; -import javax.servlet.jsp.*; -import javax.servlet.jsp.tagext.*; -import java.io.*; -import java.util.*; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.jsp.JspException; +import javax.servlet.jsp.JspTagException; +import javax.servlet.jsp.tagext.BodyTagSupport; + +import java.io.IOException; +import java.util.Locale; /** * Converts a byte-count to a formatted string suitable for display to the user, with respect diff --git a/libresonic-main/src/main/java/org/libresonic/player/taglib/ParamTag.java b/libresonic-main/src/main/java/org/libresonic/player/taglib/ParamTag.java index 42975ce9..3f110f63 100644 --- a/libresonic-main/src/main/java/org/libresonic/player/taglib/ParamTag.java +++ b/libresonic-main/src/main/java/org/libresonic/player/taglib/ParamTag.java @@ -19,8 +19,8 @@ */ package org.libresonic.player.taglib; -import javax.servlet.jsp.tagext.*; -import javax.servlet.jsp.*; +import javax.servlet.jsp.JspTagException; +import javax.servlet.jsp.tagext.TagSupport; /** * A tag representing an URL query parameter. diff --git a/libresonic-main/src/main/java/org/libresonic/player/taglib/UrlTag.java b/libresonic-main/src/main/java/org/libresonic/player/taglib/UrlTag.java index 4ef8d9d5..fdeedb24 100644 --- a/libresonic-main/src/main/java/org/libresonic/player/taglib/UrlTag.java +++ b/libresonic-main/src/main/java/org/libresonic/player/taglib/UrlTag.java @@ -19,16 +19,17 @@ */ package org.libresonic.player.taglib; +import org.apache.commons.lang.CharUtils; +import org.apache.taglibs.standard.tag.common.core.UrlSupport; import org.libresonic.player.Logger; import org.libresonic.player.filter.ParameterDecodingFilter; import org.libresonic.player.util.StringUtil; -import org.apache.taglibs.standard.tag.common.core.UrlSupport; -import org.apache.commons.lang.CharUtils; import javax.servlet.jsp.JspException; import javax.servlet.jsp.JspTagException; import javax.servlet.jsp.PageContext; import javax.servlet.jsp.tagext.BodyTagSupport; + import java.io.IOException; import java.io.UnsupportedEncodingException; import java.net.URLEncoder; diff --git a/libresonic-main/src/main/java/org/libresonic/player/taglib/WikiTag.java b/libresonic-main/src/main/java/org/libresonic/player/taglib/WikiTag.java index 3e7a6065..23d51d06 100644 --- a/libresonic-main/src/main/java/org/libresonic/player/taglib/WikiTag.java +++ b/libresonic-main/src/main/java/org/libresonic/player/taglib/WikiTag.java @@ -19,15 +19,17 @@ */ package org.libresonic.player.taglib; -import org.radeox.api.engine.*; -import org.radeox.api.engine.context.*; -import org.radeox.engine.*; -import org.radeox.engine.context.*; -import org.apache.commons.lang.*; +import org.apache.commons.lang.StringEscapeUtils; +import org.radeox.api.engine.RenderEngine; +import org.radeox.api.engine.context.RenderContext; +import org.radeox.engine.BaseRenderEngine; +import org.radeox.engine.context.BaseRenderContext; -import javax.servlet.jsp.*; -import javax.servlet.jsp.tagext.*; -import java.io.*; +import javax.servlet.jsp.JspException; +import javax.servlet.jsp.JspTagException; +import javax.servlet.jsp.tagext.BodyTagSupport; + +import java.io.IOException; /** * Renders a Wiki text with markup to HTML, using the Radeox render engine. diff --git a/libresonic-main/src/main/java/org/libresonic/player/theme/LibresonicThemeResolver.java b/libresonic-main/src/main/java/org/libresonic/player/theme/LibresonicThemeResolver.java index 437948a4..2743e8f2 100644 --- a/libresonic-main/src/main/java/org/libresonic/player/theme/LibresonicThemeResolver.java +++ b/libresonic-main/src/main/java/org/libresonic/player/theme/LibresonicThemeResolver.java @@ -19,12 +19,17 @@ */ package org.libresonic.player.theme; -import org.libresonic.player.service.*; -import org.libresonic.player.domain.*; -import org.springframework.web.servlet.*; +import org.libresonic.player.domain.Theme; +import org.libresonic.player.domain.UserSettings; +import org.libresonic.player.service.SecurityService; +import org.libresonic.player.service.SettingsService; +import org.springframework.web.servlet.ThemeResolver; -import javax.servlet.http.*; -import java.util.*; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +import java.util.HashSet; +import java.util.Set; /** * Theme resolver implementation which returns the theme selected in the settings. diff --git a/libresonic-main/src/main/java/org/libresonic/player/theme/LibresonicThemeSource.java b/libresonic-main/src/main/java/org/libresonic/player/theme/LibresonicThemeSource.java index 2ac4c5e3..4c87239c 100644 --- a/libresonic-main/src/main/java/org/libresonic/player/theme/LibresonicThemeSource.java +++ b/libresonic-main/src/main/java/org/libresonic/player/theme/LibresonicThemeSource.java @@ -19,12 +19,11 @@ */ package org.libresonic.player.theme; -import org.springframework.ui.context.support.ResourceBundleThemeSource; -import org.springframework.context.MessageSource; -import org.springframework.context.support.ResourceBundleMessageSource; - import org.libresonic.player.domain.Theme; import org.libresonic.player.service.SettingsService; +import org.springframework.context.MessageSource; +import org.springframework.context.support.ResourceBundleMessageSource; +import org.springframework.ui.context.support.ResourceBundleThemeSource; /** * Theme source implementation which uses two resource bundles: the diff --git a/libresonic-main/src/main/java/org/libresonic/player/upload/MonitoredDiskFileItem.java b/libresonic-main/src/main/java/org/libresonic/player/upload/MonitoredDiskFileItem.java index dbdaee36..4531f031 100644 --- a/libresonic-main/src/main/java/org/libresonic/player/upload/MonitoredDiskFileItem.java +++ b/libresonic-main/src/main/java/org/libresonic/player/upload/MonitoredDiskFileItem.java @@ -22,8 +22,8 @@ package org.libresonic.player.upload; import org.apache.commons.fileupload.disk.DiskFileItem; import java.io.File; -import java.io.OutputStream; import java.io.IOException; +import java.io.OutputStream; /** * Extension of Commons FileUpload for monitoring the upload progress. diff --git a/libresonic-main/src/main/java/org/libresonic/player/upload/MonitoredOutputStream.java b/libresonic-main/src/main/java/org/libresonic/player/upload/MonitoredOutputStream.java index d7d1b210..452b394e 100644 --- a/libresonic-main/src/main/java/org/libresonic/player/upload/MonitoredOutputStream.java +++ b/libresonic-main/src/main/java/org/libresonic/player/upload/MonitoredOutputStream.java @@ -19,8 +19,8 @@ */ package org.libresonic.player.upload; -import java.io.OutputStream; import java.io.IOException; +import java.io.OutputStream; /** * Extension of Commons FileUpload for monitoring the upload progress. diff --git a/libresonic-main/src/main/java/org/libresonic/player/util/BoundedList.java b/libresonic-main/src/main/java/org/libresonic/player/util/BoundedList.java index 68f9f6a2..bd61a130 100644 --- a/libresonic-main/src/main/java/org/libresonic/player/util/BoundedList.java +++ b/libresonic-main/src/main/java/org/libresonic/player/util/BoundedList.java @@ -19,7 +19,7 @@ */ package org.libresonic.player.util; -import java.util.*; +import java.util.LinkedList; /** * Simple implementation of a bounded list. If the maximum size is reached, adding a new element will diff --git a/libresonic-main/src/main/java/org/libresonic/player/util/FileUtil.java b/libresonic-main/src/main/java/org/libresonic/player/util/FileUtil.java index 43a3a150..5d2f000e 100644 --- a/libresonic-main/src/main/java/org/libresonic/player/util/FileUtil.java +++ b/libresonic-main/src/main/java/org/libresonic/player/util/FileUtil.java @@ -19,14 +19,14 @@ */ package org.libresonic.player.util; +import org.libresonic.player.Logger; + import java.io.Closeable; import java.io.File; import java.io.FilenameFilter; import java.io.IOException; import java.util.Arrays; -import org.libresonic.player.Logger; - /** * Miscellaneous file utility methods. * diff --git a/libresonic-main/src/main/java/org/libresonic/player/util/HttpRange.java b/libresonic-main/src/main/java/org/libresonic/player/util/HttpRange.java index ea7f8546..062fbc00 100644 --- a/libresonic-main/src/main/java/org/libresonic/player/util/HttpRange.java +++ b/libresonic-main/src/main/java/org/libresonic/player/util/HttpRange.java @@ -19,11 +19,11 @@ */ package org.libresonic.player.util; +import org.apache.commons.lang.StringUtils; + import java.util.regex.Matcher; import java.util.regex.Pattern; -import org.apache.commons.lang.StringUtils; - /** * @author Sindre Mehus * @version $Id$ diff --git a/libresonic-main/src/main/java/org/libresonic/player/util/Pair.java b/libresonic-main/src/main/java/org/libresonic/player/util/Pair.java index b10028fb..fb9ef2aa 100644 --- a/libresonic-main/src/main/java/org/libresonic/player/util/Pair.java +++ b/libresonic-main/src/main/java/org/libresonic/player/util/Pair.java @@ -19,10 +19,10 @@ */ package org.libresonic.player.util; -import java.io.Serializable; - import org.apache.commons.lang.ObjectUtils; +import java.io.Serializable; + /** * @author Sindre Mehus */ diff --git a/libresonic-main/src/main/java/org/libresonic/player/util/StringUtil.java b/libresonic-main/src/main/java/org/libresonic/player/util/StringUtil.java index d918ce4d..c1530fea 100644 --- a/libresonic-main/src/main/java/org/libresonic/player/util/StringUtil.java +++ b/libresonic-main/src/main/java/org/libresonic/player/util/StringUtil.java @@ -19,22 +19,18 @@ */ package org.libresonic.player.util; -import java.io.BufferedReader; -import java.io.File; -import java.io.IOException; -import java.io.InputStream; -import java.io.InputStreamReader; -import java.io.UnsupportedEncodingException; +import org.apache.commons.codec.binary.Hex; +import org.apache.commons.io.IOUtils; +import org.apache.commons.lang.StringUtils; +import org.libresonic.player.domain.UrlRedirectType; + +import java.io.*; import java.net.MalformedURLException; import java.net.URL; import java.net.URLDecoder; import java.net.URLEncoder; import java.security.MessageDigest; -import java.text.DateFormat; -import java.text.DecimalFormat; -import java.text.DecimalFormatSymbols; -import java.text.NumberFormat; -import java.text.SimpleDateFormat; +import java.text.*; import java.util.ArrayList; import java.util.Date; import java.util.List; @@ -42,12 +38,6 @@ import java.util.Locale; import java.util.regex.Matcher; import java.util.regex.Pattern; -import org.apache.commons.codec.binary.Hex; -import org.apache.commons.io.IOUtils; -import org.apache.commons.lang.StringUtils; - -import org.libresonic.player.domain.UrlRedirectType; - /** * Miscellaneous string utility methods. * diff --git a/libresonic-main/src/main/java/org/libresonic/player/util/Util.java b/libresonic-main/src/main/java/org/libresonic/player/util/Util.java index b16b17af..9f69da6e 100644 --- a/libresonic-main/src/main/java/org/libresonic/player/util/Util.java +++ b/libresonic-main/src/main/java/org/libresonic/player/util/Util.java @@ -19,21 +19,16 @@ */ package org.libresonic.player.util; -import java.net.Inet4Address; -import java.net.InetAddress; -import java.net.NetworkInterface; -import java.util.ArrayList; -import java.util.Collections; -import java.util.Enumeration; -import java.util.Iterator; -import java.util.List; -import java.util.Random; +import org.libresonic.player.Logger; +import org.libresonic.player.service.SettingsService; import javax.servlet.ServletResponse; import javax.servlet.http.HttpServletResponse; -import org.libresonic.player.Logger; -import org.libresonic.player.service.SettingsService; +import java.net.Inet4Address; +import java.net.InetAddress; +import java.net.NetworkInterface; +import java.util.*; /** * Miscellaneous general utility methods. diff --git a/libresonic-main/src/main/java/org/libresonic/player/validator/PasswordSettingsValidator.java b/libresonic-main/src/main/java/org/libresonic/player/validator/PasswordSettingsValidator.java index bf6ea6fa..deac6a73 100644 --- a/libresonic-main/src/main/java/org/libresonic/player/validator/PasswordSettingsValidator.java +++ b/libresonic-main/src/main/java/org/libresonic/player/validator/PasswordSettingsValidator.java @@ -19,10 +19,11 @@ */ package org.libresonic.player.validator; +import org.libresonic.player.command.PasswordSettingsCommand; +import org.libresonic.player.controller.PasswordSettingsController; import org.springframework.stereotype.Component; -import org.springframework.validation.*; -import org.libresonic.player.command.*; -import org.libresonic.player.controller.*; +import org.springframework.validation.Errors; +import org.springframework.validation.Validator; /** * Validator for {@link PasswordSettingsController}. diff --git a/libresonic-main/src/main/java/org/libresonic/player/validator/UserSettingsValidator.java b/libresonic-main/src/main/java/org/libresonic/player/validator/UserSettingsValidator.java index 755ae0ea..57437a2c 100644 --- a/libresonic-main/src/main/java/org/libresonic/player/validator/UserSettingsValidator.java +++ b/libresonic-main/src/main/java/org/libresonic/player/validator/UserSettingsValidator.java @@ -19,11 +19,11 @@ */ package org.libresonic.player.validator; +import org.apache.commons.lang.StringUtils; import org.libresonic.player.command.UserSettingsCommand; import org.libresonic.player.controller.UserSettingsController; import org.libresonic.player.service.SecurityService; import org.libresonic.player.service.SettingsService; -import org.apache.commons.lang.StringUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; import org.springframework.validation.Errors; diff --git a/libresonic-main/src/test/java/org/libresonic/player/controller/HLSControllerTestCase.java b/libresonic-main/src/test/java/org/libresonic/player/controller/HLSControllerTestCase.java index 4090cd64..bdae0e5c 100644 --- a/libresonic-main/src/test/java/org/libresonic/player/controller/HLSControllerTestCase.java +++ b/libresonic-main/src/test/java/org/libresonic/player/controller/HLSControllerTestCase.java @@ -19,11 +19,11 @@ */ package org.libresonic.player.controller; -import java.awt.Dimension; - import junit.framework.TestCase; import org.libresonic.player.util.Pair; +import java.awt.*; + /** * @author Sindre Mehus * @version $Id: StreamControllerTestCase.java 3307 2013-01-04 13:48:49Z sindre_mehus $ diff --git a/libresonic-main/src/test/java/org/libresonic/player/controller/StreamControllerTestCase.java b/libresonic-main/src/test/java/org/libresonic/player/controller/StreamControllerTestCase.java index 6cf91393..4e412408 100644 --- a/libresonic-main/src/test/java/org/libresonic/player/controller/StreamControllerTestCase.java +++ b/libresonic-main/src/test/java/org/libresonic/player/controller/StreamControllerTestCase.java @@ -19,10 +19,10 @@ */ package org.libresonic.player.controller; -import java.awt.Dimension; - import junit.framework.TestCase; +import java.awt.*; + /** * @author Sindre Mehus * @version $Id$ diff --git a/libresonic-main/src/test/java/org/libresonic/player/dao/DaoTestCaseBase.java b/libresonic-main/src/test/java/org/libresonic/player/dao/DaoTestCaseBase.java index 99c75a3e..9024575a 100644 --- a/libresonic-main/src/test/java/org/libresonic/player/dao/DaoTestCaseBase.java +++ b/libresonic-main/src/test/java/org/libresonic/player/dao/DaoTestCaseBase.java @@ -1,6 +1,5 @@ package org.libresonic.player.dao; -import javax.sql.DataSource; import junit.framework.TestCase; import liquibase.exception.LiquibaseException; import org.libresonic.player.TestCaseUtils; @@ -10,9 +9,10 @@ import org.libresonic.player.util.FileUtil; import org.libresonic.player.util.Util; import org.springframework.core.io.DefaultResourceLoader; import org.springframework.jdbc.core.JdbcTemplate; -import org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate; import org.springframework.jdbc.datasource.DriverManagerDataSource; +import javax.sql.DataSource; + import java.io.File; import java.util.HashMap; import java.util.Map; diff --git a/libresonic-main/src/test/java/org/libresonic/player/domain/PlayQueueTestCase.java b/libresonic-main/src/test/java/org/libresonic/player/domain/PlayQueueTestCase.java index d7592d97..d730e464 100644 --- a/libresonic-main/src/test/java/org/libresonic/player/domain/PlayQueueTestCase.java +++ b/libresonic-main/src/test/java/org/libresonic/player/domain/PlayQueueTestCase.java @@ -19,14 +19,14 @@ */ package org.libresonic.player.domain; -import java.io.File; -import java.io.IOException; -import java.util.Arrays; - import junit.framework.TestCase; import org.libresonic.player.domain.PlayQueue.SortOrder; import org.libresonic.player.domain.PlayQueue.Status; +import java.io.File; +import java.io.IOException; +import java.util.Arrays; + /** * Unit test of {@link PlayQueue}. * diff --git a/libresonic-main/src/test/java/org/libresonic/player/domain/SortableArtistTestCase.java b/libresonic-main/src/test/java/org/libresonic/player/domain/SortableArtistTestCase.java index f897f0bd..acbefb6f 100644 --- a/libresonic-main/src/test/java/org/libresonic/player/domain/SortableArtistTestCase.java +++ b/libresonic-main/src/test/java/org/libresonic/player/domain/SortableArtistTestCase.java @@ -19,14 +19,14 @@ package org.libresonic.player.domain; +import junit.framework.TestCase; + import java.text.Collator; import java.util.ArrayList; import java.util.Collections; import java.util.List; import java.util.Locale; -import junit.framework.TestCase; - public class SortableArtistTestCase extends TestCase { private Collator collator; diff --git a/libresonic-main/src/test/java/org/libresonic/player/domain/TranscodeSchemeTestCase.java b/libresonic-main/src/test/java/org/libresonic/player/domain/TranscodeSchemeTestCase.java index 686cb1ce..5dc93bd4 100644 --- a/libresonic-main/src/test/java/org/libresonic/player/domain/TranscodeSchemeTestCase.java +++ b/libresonic-main/src/test/java/org/libresonic/player/domain/TranscodeSchemeTestCase.java @@ -20,6 +20,7 @@ package org.libresonic.player.domain; import junit.framework.TestCase; + import static org.libresonic.player.domain.TranscodeScheme.*; /** diff --git a/libresonic-main/src/test/java/org/libresonic/player/domain/VersionTestCase.java b/libresonic-main/src/test/java/org/libresonic/player/domain/VersionTestCase.java index ef63a772..15db0783 100644 --- a/libresonic-main/src/test/java/org/libresonic/player/domain/VersionTestCase.java +++ b/libresonic-main/src/test/java/org/libresonic/player/domain/VersionTestCase.java @@ -24,7 +24,7 @@ package org.libresonic.player.domain; * @author Sindre Mehus */ -import junit.framework.*; +import junit.framework.TestCase; public class VersionTestCase extends TestCase { diff --git a/libresonic-main/src/test/java/org/libresonic/player/io/RangeOutputStreamTestCase.java b/libresonic-main/src/test/java/org/libresonic/player/io/RangeOutputStreamTestCase.java index ae282797..9686d9df 100644 --- a/libresonic-main/src/test/java/org/libresonic/player/io/RangeOutputStreamTestCase.java +++ b/libresonic-main/src/test/java/org/libresonic/player/io/RangeOutputStreamTestCase.java @@ -22,11 +22,7 @@ package org.libresonic.player.io; import junit.framework.TestCase; import org.libresonic.player.util.HttpRange; -import java.io.ByteArrayInputStream; -import java.io.ByteArrayOutputStream; -import java.io.IOException; -import java.io.InputStream; -import java.io.OutputStream; +import java.io.*; /** * @author Sindre Mehus diff --git a/libresonic-main/src/test/java/org/libresonic/player/service/SecurityServiceTestCase.java b/libresonic-main/src/test/java/org/libresonic/player/service/SecurityServiceTestCase.java index 2bd4da2b..b3f9fd1d 100644 --- a/libresonic-main/src/test/java/org/libresonic/player/service/SecurityServiceTestCase.java +++ b/libresonic-main/src/test/java/org/libresonic/player/service/SecurityServiceTestCase.java @@ -19,7 +19,7 @@ */ package org.libresonic.player.service; -import junit.framework.*; +import junit.framework.TestCase; /** * Unit test of {@link SecurityService}. * diff --git a/libresonic-main/src/test/java/org/libresonic/player/service/SettingsServiceTestCase.java b/libresonic-main/src/test/java/org/libresonic/player/service/SettingsServiceTestCase.java index dec43c4f..71188940 100644 --- a/libresonic-main/src/test/java/org/libresonic/player/service/SettingsServiceTestCase.java +++ b/libresonic-main/src/test/java/org/libresonic/player/service/SettingsServiceTestCase.java @@ -19,14 +19,13 @@ */ package org.libresonic.player.service; +import junit.framework.TestCase; +import org.libresonic.player.TestCaseUtils; + import java.io.File; import java.util.Arrays; -import java.util.Date; import java.util.Locale; -import junit.framework.TestCase; -import org.libresonic.player.TestCaseUtils; - /** * Unit test of {@link SettingsService}. * diff --git a/libresonic-main/src/test/java/org/libresonic/player/service/metadata/MetaDataParserTestCase.java b/libresonic-main/src/test/java/org/libresonic/player/service/metadata/MetaDataParserTestCase.java index 9990bfa5..01339d51 100644 --- a/libresonic-main/src/test/java/org/libresonic/player/service/metadata/MetaDataParserTestCase.java +++ b/libresonic-main/src/test/java/org/libresonic/player/service/metadata/MetaDataParserTestCase.java @@ -19,11 +19,11 @@ */ package org.libresonic.player.service.metadata; -import java.io.File; - import junit.framework.TestCase; import org.libresonic.player.domain.MediaFile; +import java.io.File; + /** * Unit test of {@link MetaDataParser}. * diff --git a/libresonic-main/src/test/java/org/libresonic/player/util/FileUtils.java b/libresonic-main/src/test/java/org/libresonic/player/util/FileUtils.java index a0d62ad9..d56aad4f 100644 --- a/libresonic-main/src/test/java/org/libresonic/player/util/FileUtils.java +++ b/libresonic-main/src/test/java/org/libresonic/player/util/FileUtils.java @@ -2,13 +2,7 @@ package org.libresonic.player.util; import org.apache.commons.lang.StringUtils; -import java.io.File; -import java.io.FileInputStream; -import java.io.FileNotFoundException; -import java.io.FileOutputStream; -import java.io.IOException; -import java.io.InputStream; -import java.io.OutputStream; +import java.io.*; import java.net.JarURLConnection; import java.net.URL; import java.net.URLConnection; diff --git a/libresonic-main/src/test/java/org/libresonic/player/util/StringUtilTestCase.java b/libresonic-main/src/test/java/org/libresonic/player/util/StringUtilTestCase.java index 0f4d3f9b..dfc27569 100644 --- a/libresonic-main/src/test/java/org/libresonic/player/util/StringUtilTestCase.java +++ b/libresonic-main/src/test/java/org/libresonic/player/util/StringUtilTestCase.java @@ -19,13 +19,13 @@ */ package org.libresonic.player.util; +import junit.framework.TestCase; +import org.libresonic.player.domain.UrlRedirectType; + import java.net.MalformedURLException; import java.util.Arrays; import java.util.Locale; -import junit.framework.TestCase; -import org.libresonic.player.domain.UrlRedirectType; - /** * Unit test of {@link StringUtil}. * diff --git a/pom.xml b/pom.xml index ee8c42c9..3d179c94 100644 --- a/pom.xml +++ b/pom.xml @@ -148,6 +148,33 @@ false + + org.apache.maven.plugins + maven-checkstyle-plugin + 2.17 + + + com.puppycrawl.tools + checkstyle + 7.4 + + + + + validate + validate + + ${project.basedir}/../checkstyle.xml + UTF-8 + true + true + + + check + + + + From 9df2660d1e3a4a40a1a4e5b732bceaa441c95be7 Mon Sep 17 00:00:00 2001 From: Andrew DeMaria Date: Sat, 14 Jan 2017 07:57:52 -0700 Subject: [PATCH 2/3] Allow data source config type to be specified via system property Signed-off-by: Andrew DeMaria --- .../libresonic/player/boot/Application.java | 4 +- .../AdditionalPropertySourceConfigurer.java | 22 ---------- ...asourceProfileActivatorPropertySource.java | 40 ----------------- .../LibresonicPropertySourceConfigurer.java | 44 +++++++++++++++++++ 4 files changed, 46 insertions(+), 64 deletions(-) delete mode 100644 libresonic-main/src/main/java/org/libresonic/player/spring/AdditionalPropertySourceConfigurer.java delete mode 100644 libresonic-main/src/main/java/org/libresonic/player/spring/DatasourceProfileActivatorPropertySource.java create mode 100644 libresonic-main/src/main/java/org/libresonic/player/spring/LibresonicPropertySourceConfigurer.java diff --git a/libresonic-main/src/main/java/org/libresonic/player/boot/Application.java b/libresonic-main/src/main/java/org/libresonic/player/boot/Application.java index bd84a820..8d1fa8eb 100644 --- a/libresonic-main/src/main/java/org/libresonic/player/boot/Application.java +++ b/libresonic-main/src/main/java/org/libresonic/player/boot/Application.java @@ -3,7 +3,7 @@ package org.libresonic.player.boot; import net.sf.ehcache.constructs.web.ShutdownListener; import org.directwebremoting.servlet.DwrServlet; import org.libresonic.player.filter.*; -import org.libresonic.player.spring.AdditionalPropertySourceConfigurer; +import org.libresonic.player.spring.LibresonicPropertySourceConfigurer; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration; import org.springframework.boot.autoconfigure.jdbc.DataSourceTransactionManagerAutoConfiguration; @@ -155,7 +155,7 @@ public class Application extends SpringBootServletInitializer { // Customize the application or call application.sources(...) to add sources // Since our example is itself a @Configuration class (via @SpringBootApplication) // we actually don't need to override this method. - return application.sources(Application.class).web(true).initializers(new AdditionalPropertySourceConfigurer()); + return application.sources(Application.class).web(true).initializers(new LibresonicPropertySourceConfigurer()); } @Override diff --git a/libresonic-main/src/main/java/org/libresonic/player/spring/AdditionalPropertySourceConfigurer.java b/libresonic-main/src/main/java/org/libresonic/player/spring/AdditionalPropertySourceConfigurer.java deleted file mode 100644 index fff66516..00000000 --- a/libresonic-main/src/main/java/org/libresonic/player/spring/AdditionalPropertySourceConfigurer.java +++ /dev/null @@ -1,22 +0,0 @@ -package org.libresonic.player.spring; - -import org.apache.commons.configuration2.ImmutableConfiguration; -import org.libresonic.player.service.ApacheCommonsConfigurationService; -import org.springframework.context.ApplicationContextInitializer; -import org.springframework.core.env.PropertySource; -import org.springframework.web.context.ConfigurableWebApplicationContext; - -public class AdditionalPropertySourceConfigurer implements - ApplicationContextInitializer { - - public void initialize(ConfigurableWebApplicationContext ctx) { - - ApacheCommonsConfigurationService configurationService = new ApacheCommonsConfigurationService(); - ImmutableConfiguration snapshot = configurationService.getImmutableSnapshot(); - - PropertySource ps = new DatasourceProfileActivatorPropertySource(new CommonsConfigurationPropertySource( - "libresonic-pre-init-configs", - snapshot)); - ctx.getEnvironment().getPropertySources().addLast(ps); - } -} diff --git a/libresonic-main/src/main/java/org/libresonic/player/spring/DatasourceProfileActivatorPropertySource.java b/libresonic-main/src/main/java/org/libresonic/player/spring/DatasourceProfileActivatorPropertySource.java deleted file mode 100644 index cbfff912..00000000 --- a/libresonic-main/src/main/java/org/libresonic/player/spring/DatasourceProfileActivatorPropertySource.java +++ /dev/null @@ -1,40 +0,0 @@ -package org.libresonic.player.spring; - -import org.apache.commons.lang3.StringUtils; -import org.springframework.core.env.PropertySource; - -public class DatasourceProfileActivatorPropertySource extends PropertySource { - public static final String SPRING_PROFILES_ACTIVE = "spring.profiles.active"; - public static final String DATASOURCE_CONFIG_TYPE = "database.config.type"; - final PropertySource parent; - - public DatasourceProfileActivatorPropertySource(PropertySource parent) { - super(parent.getName()); - this.parent = parent; - } - - @Override - public Object getProperty(String name) { - if(StringUtils.equalsIgnoreCase(name, SPRING_PROFILES_ACTIVE)) { - String appendTo = ""; - Object existing = parent.getProperty(SPRING_PROFILES_ACTIVE); - if(existing != null && existing instanceof String) { - appendTo += (String) existing; - } - DataSourceConfigType dataSourceConfigType; - Object rawType = parent.getProperty(DATASOURCE_CONFIG_TYPE); - if(rawType != null && rawType instanceof String) { - dataSourceConfigType = DataSourceConfigType.valueOf(StringUtils.upperCase((String) rawType)); - } else { - dataSourceConfigType = DataSourceConfigType.LEGACY; - } - if(StringUtils.isNotBlank(appendTo)) { - appendTo += ","; - } - appendTo += StringUtils.lowerCase(dataSourceConfigType.name()); - return appendTo; - } else { - return parent.getProperty(name); - } - } -} diff --git a/libresonic-main/src/main/java/org/libresonic/player/spring/LibresonicPropertySourceConfigurer.java b/libresonic-main/src/main/java/org/libresonic/player/spring/LibresonicPropertySourceConfigurer.java new file mode 100644 index 00000000..1798dd0d --- /dev/null +++ b/libresonic-main/src/main/java/org/libresonic/player/spring/LibresonicPropertySourceConfigurer.java @@ -0,0 +1,44 @@ +package org.libresonic.player.spring; + +import com.google.common.collect.Lists; +import org.apache.commons.configuration2.ImmutableConfiguration; +import org.apache.commons.lang3.StringUtils; +import org.libresonic.player.service.ApacheCommonsConfigurationService; +import org.springframework.context.ApplicationContextInitializer; +import org.springframework.core.env.PropertySource; +import org.springframework.web.context.ConfigurableWebApplicationContext; + +import java.util.List; + +public class LibresonicPropertySourceConfigurer implements + ApplicationContextInitializer { + + public static final String DATASOURCE_CONFIG_TYPE = "database.config.type"; + + public void initialize(ConfigurableWebApplicationContext ctx) { + + ApacheCommonsConfigurationService configurationService = new ApacheCommonsConfigurationService(); + ImmutableConfiguration snapshot = configurationService.getImmutableSnapshot(); + + PropertySource ps = new CommonsConfigurationPropertySource("libresonic-pre-init-configs", snapshot); + + + ctx.getEnvironment().getPropertySources().addLast(ps); + + addDataSourceProfile(ctx); + } + + private void addDataSourceProfile(ConfigurableWebApplicationContext ctx) { + DataSourceConfigType dataSourceConfigType; + String rawType = ctx.getEnvironment().getProperty(DATASOURCE_CONFIG_TYPE); + if(StringUtils.isNotBlank(rawType)) { + dataSourceConfigType = DataSourceConfigType.valueOf(StringUtils.upperCase(rawType)); + } else { + dataSourceConfigType = DataSourceConfigType.LEGACY; + } + String dataSourceTypeProfile = StringUtils.lowerCase(dataSourceConfigType.name()); + List existingProfiles = Lists.newArrayList(ctx.getEnvironment().getActiveProfiles()); + existingProfiles.add(dataSourceTypeProfile); + ctx.getEnvironment().setActiveProfiles(existingProfiles.toArray(new String[0])); + } +} From 2948ae0f7850546ec4389c518edf0ffabbc684e5 Mon Sep 17 00:00:00 2001 From: Andrew DeMaria Date: Sun, 15 Jan 2017 14:09:47 -0700 Subject: [PATCH 3/3] Fix remember me Signed-off-by: Andrew DeMaria --- libresonic-main/src/main/webapp/WEB-INF/jsp/login.jsp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libresonic-main/src/main/webapp/WEB-INF/jsp/login.jsp b/libresonic-main/src/main/webapp/WEB-INF/jsp/login.jsp index 2a4bcfe4..8bb6b63f 100644 --- a/libresonic-main/src/main/webapp/WEB-INF/jsp/login.jsp +++ b/libresonic-main/src/main/webapp/WEB-INF/jsp/login.jsp @@ -38,7 +38,7 @@ " tabindex="4"> - +