Remove unnecessary exceptions and unused imports

Signed-off-by: Andrew DeMaria <lostonamountain@gmail.com>
master
jvoisin 5 years ago committed by Andrew DeMaria
parent 90e6c77563
commit e5404648a4
No known key found for this signature in database
GPG Key ID: 0A3F5E91F8364EDF
  1. 2
      airsonic-main/src/main/java/org/airsonic/player/ajax/NowPlayingService.java
  2. 14
      airsonic-main/src/main/java/org/airsonic/player/ajax/PlayQueueService.java
  3. 2
      airsonic-main/src/main/java/org/airsonic/player/cache/CacheFactory.java
  4. 4
      airsonic-main/src/main/java/org/airsonic/player/controller/AdvancedSettingsController.java
  5. 2
      airsonic-main/src/main/java/org/airsonic/player/controller/AllmusicController.java
  6. 3
      airsonic-main/src/main/java/org/airsonic/player/controller/AutoCoverDemo.java
  7. 3
      airsonic-main/src/main/java/org/airsonic/player/controller/AvatarUploadController.java
  8. 4
      airsonic-main/src/main/java/org/airsonic/player/controller/DLNASettingsController.java
  9. 6
      airsonic-main/src/main/java/org/airsonic/player/controller/DatabaseSettingsController.java
  10. 2
      airsonic-main/src/main/java/org/airsonic/player/controller/DownloadController.java
  11. 3
      airsonic-main/src/main/java/org/airsonic/player/controller/ExternalPlayerController.java
  12. 6
      airsonic-main/src/main/java/org/airsonic/player/controller/GeneralSettingsController.java
  13. 2
      airsonic-main/src/main/java/org/airsonic/player/controller/HelpController.java
  14. 9
      airsonic-main/src/main/java/org/airsonic/player/controller/HomeController.java
  15. 2
      airsonic-main/src/main/java/org/airsonic/player/controller/ImportPlaylistController.java
  16. 4
      airsonic-main/src/main/java/org/airsonic/player/controller/InternetRadioSettingsController.java
  17. 2
      airsonic-main/src/main/java/org/airsonic/player/controller/JAXBWriter.java
  18. 2
      airsonic-main/src/main/java/org/airsonic/player/controller/LoginController.java
  19. 2
      airsonic-main/src/main/java/org/airsonic/player/controller/LyricsController.java
  20. 5
      airsonic-main/src/main/java/org/airsonic/player/controller/M3UController.java
  21. 5
      airsonic-main/src/main/java/org/airsonic/player/controller/MainController.java
  22. 6
      airsonic-main/src/main/java/org/airsonic/player/controller/MusicFolderSettingsController.java
  23. 4
      airsonic-main/src/main/java/org/airsonic/player/controller/PasswordSettingsController.java
  24. 6
      airsonic-main/src/main/java/org/airsonic/player/controller/PersonalSettingsController.java
  25. 4
      airsonic-main/src/main/java/org/airsonic/player/controller/PlayerSettingsController.java
  26. 2
      airsonic-main/src/main/java/org/airsonic/player/controller/PlaylistsController.java
  27. 2
      airsonic-main/src/main/java/org/airsonic/player/controller/PodcastChannelsController.java
  28. 2
      airsonic-main/src/main/java/org/airsonic/player/controller/PodcastController.java
  29. 4
      airsonic-main/src/main/java/org/airsonic/player/controller/PodcastSettingsController.java
  30. 2
      airsonic-main/src/main/java/org/airsonic/player/controller/RecoverController.java
  31. 2
      airsonic-main/src/main/java/org/airsonic/player/controller/RightController.java
  32. 4
      airsonic-main/src/main/java/org/airsonic/player/controller/SearchController.java
  33. 2
      airsonic-main/src/main/java/org/airsonic/player/controller/SettingsController.java
  34. 4
      airsonic-main/src/main/java/org/airsonic/player/controller/ShareSettingsController.java
  35. 4
      airsonic-main/src/main/java/org/airsonic/player/controller/SonosSettingsController.java
  36. 2
      airsonic-main/src/main/java/org/airsonic/player/controller/StatusController.java
  37. 36
      airsonic-main/src/main/java/org/airsonic/player/controller/SubsonicRESTController.java
  38. 2
      airsonic-main/src/main/java/org/airsonic/player/controller/TopController.java
  39. 4
      airsonic-main/src/main/java/org/airsonic/player/controller/TranscodingSettingsController.java
  40. 2
      airsonic-main/src/main/java/org/airsonic/player/controller/UploadController.java
  41. 2
      airsonic-main/src/main/java/org/airsonic/player/controller/UserSettingsController.java
  42. 9
      airsonic-main/src/main/java/org/airsonic/player/domain/PlayQueue.java
  43. 2
      airsonic-main/src/main/java/org/airsonic/player/filter/MetricsFilter.java
  44. 4
      airsonic-main/src/main/java/org/airsonic/player/filter/RESTFilter.java
  45. 2
      airsonic-main/src/main/java/org/airsonic/player/io/PlayQueueInputStream.java
  46. 8
      airsonic-main/src/main/java/org/airsonic/player/io/ShoutCastOutputStream.java
  47. 2
      airsonic-main/src/main/java/org/airsonic/player/io/TranscodeInputStream.java
  48. 4
      airsonic-main/src/main/java/org/airsonic/player/security/JWTRequestParameterProcessingFilter.java
  49. 4
      airsonic-main/src/main/java/org/airsonic/player/security/RESTRequestParameterProcessingFilter.java
  50. 14
      airsonic-main/src/main/java/org/airsonic/player/service/InternetRadioService.java
  51. 5
      airsonic-main/src/main/java/org/airsonic/player/service/JukeboxJavaService.java
  52. 2
      airsonic-main/src/main/java/org/airsonic/player/service/JukeboxLegacySubsonicService.java
  53. 10
      airsonic-main/src/main/java/org/airsonic/player/service/JukeboxService.java
  54. 3
      airsonic-main/src/main/java/org/airsonic/player/service/LastFmService.java
  55. 7
      airsonic-main/src/main/java/org/airsonic/player/service/MediaFileService.java
  56. 12
      airsonic-main/src/main/java/org/airsonic/player/service/MusicIndexService.java
  57. 2
      airsonic-main/src/main/java/org/airsonic/player/service/PlaylistService.java
  58. 2
      airsonic-main/src/main/java/org/airsonic/player/service/ShareService.java
  59. 6
      airsonic-main/src/main/java/org/airsonic/player/service/UPnPService.java
  60. 4
      airsonic-main/src/main/java/org/airsonic/player/service/jukebox/PlayerTest.java
  61. 16
      airsonic-main/src/main/java/org/airsonic/player/service/playlist/DefaultPlaylistImportHandler.java
  62. 2
      airsonic-main/src/main/java/org/airsonic/player/service/playlist/XspfPlaylistExportHandler.java
  63. 13
      airsonic-main/src/main/java/org/airsonic/player/service/upnp/AlbumUpnpProcessor.java
  64. 4
      airsonic-main/src/main/java/org/airsonic/player/service/upnp/ArtistUpnpProcessor.java
  65. 5
      airsonic-main/src/main/java/org/airsonic/player/service/upnp/DispatchingContentDirectory.java
  66. 11
      airsonic-main/src/main/java/org/airsonic/player/service/upnp/FolderBasedContentDirectory.java
  67. 2
      airsonic-main/src/main/java/org/airsonic/player/service/upnp/GenreUpnpProcessor.java
  68. 12
      airsonic-main/src/main/java/org/airsonic/player/service/upnp/MediaFileUpnpProcessor.java
  69. 4
      airsonic-main/src/main/java/org/airsonic/player/service/upnp/NATPMPRouter.java
  70. 4
      airsonic-main/src/main/java/org/airsonic/player/service/upnp/PlaylistUpnpProcessor.java
  71. 2
      airsonic-main/src/main/java/org/airsonic/player/service/upnp/RecentAlbumUpnpProcessor.java
  72. 4
      airsonic-main/src/main/java/org/airsonic/player/service/upnp/Router.java
  73. 12
      airsonic-main/src/main/java/org/airsonic/player/service/upnp/UpnpContentProcessor.java
  74. 2
      airsonic-main/src/main/java/org/airsonic/player/taglib/EscapeJavaScriptTag.java
  75. 2
      airsonic-main/src/main/java/org/airsonic/player/taglib/FormatBytesTag.java
  76. 2
      airsonic-main/src/main/java/org/airsonic/player/taglib/UrlTag.java
  77. 2
      airsonic-main/src/main/java/org/airsonic/player/taglib/WikiTag.java
  78. 1
      airsonic-main/src/test/java/org/airsonic/player/api/jukebox/AirsonicRestApiJukeboxLegacyIntTest.java
  79. 2
      airsonic-main/src/test/java/org/airsonic/player/dao/InternetRadioDaoTestCase.java
  80. 2
      airsonic-main/src/test/java/org/airsonic/player/dao/MusicFolderDaoTestCase.java
  81. 2
      airsonic-main/src/test/java/org/airsonic/player/dao/PlayerDaoTestCase.java
  82. 2
      airsonic-main/src/test/java/org/airsonic/player/dao/PodcastDaoTestCase.java
  83. 2
      airsonic-main/src/test/java/org/airsonic/player/dao/TranscodingDaoTestCase.java
  84. 2
      airsonic-main/src/test/java/org/airsonic/player/dao/UserDaoTestCase.java
  85. 4
      airsonic-main/src/test/java/org/airsonic/player/domain/MediaFileComparatorTestCase.java
  86. 23
      airsonic-main/src/test/java/org/airsonic/player/domain/PlayQueueTestCase.java
  87. 8
      airsonic-main/src/test/java/org/airsonic/player/domain/SortableArtistTestCase.java
  88. 16
      airsonic-main/src/test/java/org/airsonic/player/service/InternetRadioServiceTest.java
  89. 2
      airsonic-main/src/test/java/org/airsonic/player/service/JWTSecurityServiceTest.java
  90. 18
      airsonic-main/src/test/java/org/airsonic/player/service/JukeboxServiceUnitTest.java
  91. 2
      airsonic-main/src/test/java/org/airsonic/player/service/LegacyDatabaseStartupTestCase.java
  92. 4
      airsonic-main/src/test/java/org/airsonic/player/service/MusicIndexServiceTestCase.java
  93. 4
      airsonic-main/src/test/java/org/airsonic/player/service/PlaylistServiceTestImport.java
  94. 2
      airsonic-main/src/test/java/org/airsonic/player/service/SettingsServiceTestCase.java
  95. 2
      airsonic-main/src/test/java/org/airsonic/player/service/metadata/MediaFileTestCase.java
  96. 2
      airsonic-main/src/test/java/org/airsonic/player/service/metadata/MetaDataParserTestCase.java
  97. 4
      airsonic-main/src/test/java/org/airsonic/player/service/search/IndexManagerTestCase.java
  98. 2
      airsonic-main/src/test/java/org/airsonic/player/service/search/SearchServiceSpecialGenreTestCase.java
  99. 2
      airsonic-main/src/test/java/org/airsonic/player/service/search/SearchServiceSpecialPathTestCase.java
  100. 2
      airsonic-main/src/test/java/org/airsonic/player/service/search/SearchServiceStartWithStopwardsTestCase.java
  101. Some files were not shown because too many files have changed in this diff Show More

@ -78,7 +78,7 @@ public class NowPlayingService {
*
* @return Details about what all users are currently playing.
*/
public List<NowPlayingInfo> getNowPlaying() throws Exception {
public List<NowPlayingInfo> getNowPlaying() {
try {
return convert(statusService.getPlayStatuses());
} catch (Throwable x) {

@ -423,7 +423,7 @@ public class PlayQueueService {
return doPlay(request, player, songs).setStartPlayerAt(0);
}
private PlayQueueInfo doPlay(HttpServletRequest request, Player player, List<MediaFile> files) throws Exception {
private PlayQueueInfo doPlay(HttpServletRequest request, Player player, List<MediaFile> files) {
if (player.isWeb()) {
mediaFileService.removeVideoFiles(files);
}
@ -436,7 +436,7 @@ public class PlayQueueService {
return convert(request, player, true);
}
private PlayQueueInfo doPlayInternetRadio(HttpServletRequest request, Player player, InternetRadio radio) throws Exception {
private PlayQueueInfo doPlayInternetRadio(HttpServletRequest request, Player player, InternetRadio radio) {
internetRadioService.clearInternetRadioSourceCache(radio.getId());
player.getPlayQueue().clear();
player.getPlayQueue().setRandomSearchCriteria(null);
@ -489,7 +489,7 @@ public class PlayQueueService {
/**
* TODO This method should be moved to a real PlayQueueService not dedicated to Ajax DWR.
*/
public PlayQueue addMediaFilesToPlayQueue(PlayQueue playQueue,int[] ids, Integer index, boolean removeVideoFiles) throws Exception {
public PlayQueue addMediaFilesToPlayQueue(PlayQueue playQueue,int[] ids, Integer index, boolean removeVideoFiles) {
List<MediaFile> files = new ArrayList<MediaFile>(ids.length);
for (int id : ids) {
MediaFile ancestor = mediaFileService.getMediaFile(id);
@ -521,7 +521,7 @@ public class PlayQueueService {
/**
* TODO This method should be moved to a real PlayQueueService not dedicated to Ajax DWR.
*/
public PlayQueue resetPlayQueue(PlayQueue playQueue,int[] ids, boolean removeVideoFiles) throws Exception {
public PlayQueue resetPlayQueue(PlayQueue playQueue,int[] ids, boolean removeVideoFiles) {
MediaFile currentFile = playQueue.getCurrentFile();
PlayQueue.Status status = playQueue.getStatus();
@ -658,11 +658,11 @@ public class PlayQueueService {
return convert(request, player, false);
}
private PlayQueueInfo convert(HttpServletRequest request, Player player, boolean serverSidePlaylist) throws Exception {
private PlayQueueInfo convert(HttpServletRequest request, Player player, boolean serverSidePlaylist) {
return convert(request, player, serverSidePlaylist, 0);
}
private PlayQueueInfo convert(HttpServletRequest request, Player player, boolean serverSidePlaylist, int offset) throws Exception {
private PlayQueueInfo convert(HttpServletRequest request, Player player, boolean serverSidePlaylist, int offset) {
String url = NetworkService.getBaseUrl(request);
Locale locale = RequestContextUtils.getLocale(request);
@ -722,7 +722,7 @@ public class PlayQueueService {
return entries;
}
private List<PlayQueueInfo.Entry> convertInternetRadio(HttpServletRequest request, Player player) throws Exception {
private List<PlayQueueInfo.Entry> convertInternetRadio(HttpServletRequest request, Player player) {
PlayQueue playQueue = player.getPlayQueue();
InternetRadio radio = playQueue.getInternetRadio();

@ -37,7 +37,7 @@ import java.io.File;
public class CacheFactory implements InitializingBean {
private CacheManager cacheManager;
public void afterPropertiesSet() throws Exception {
public void afterPropertiesSet() {
Configuration configuration = ConfigurationFactory.parseConfiguration();
// Override configuration to make sure cache is stored in Airsonic home dir.

@ -44,7 +44,7 @@ public class AdvancedSettingsController {
private SettingsService settingsService;
@GetMapping
protected String formBackingObject(Model model) throws Exception {
protected String formBackingObject(Model model) {
AdvancedSettingsCommand command = new AdvancedSettingsCommand();
command.setDownloadLimit(String.valueOf(settingsService.getDownloadBitrateLimit()));
command.setUploadLimit(String.valueOf(settingsService.getUploadBitrateLimit()));
@ -69,7 +69,7 @@ public class AdvancedSettingsController {
}
@PostMapping
protected String doSubmitAction(@ModelAttribute AdvancedSettingsCommand command, RedirectAttributes redirectAttributes) throws Exception {
protected String doSubmitAction(@ModelAttribute AdvancedSettingsCommand command, RedirectAttributes redirectAttributes) {
redirectAttributes.addFlashAttribute("settings_reload", false);
redirectAttributes.addFlashAttribute("settings_toast", true);

@ -37,7 +37,7 @@ import javax.servlet.http.HttpServletResponse;
public class AllmusicController {
@GetMapping
protected ModelAndView handleRequestInternal(HttpServletRequest request, HttpServletResponse response) throws Exception {
protected ModelAndView handleRequestInternal(HttpServletRequest request, HttpServletResponse response) {
ModelAndView result = new ModelAndView();
result.addObject("album", request.getParameter("album"));
return result;

@ -24,7 +24,6 @@ import org.apache.commons.lang.RandomStringUtils;
import javax.swing.*;
import java.awt.*;
import java.io.IOException;
/**
* @author Sindre Mehus
@ -32,7 +31,7 @@ import java.io.IOException;
*/
public class AutoCoverDemo {
public static void main(String[] args) throws IOException {
public static void main(String[] args) {
JFrame frame = new JFrame();
JPanel panel = new JPanel();
panel.add(new AlbumComponent(110, 110));

@ -43,7 +43,6 @@ import javax.servlet.http.HttpServletRequest;
import java.awt.image.BufferedImage;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
@ -104,7 +103,7 @@ public class AvatarUploadController {
return new ModelAndView("avatarUploadResult","model",map);
}
private void createAvatar(String fileName, byte[] data, String username, Map<String, Object> map) throws IOException {
private void createAvatar(String fileName, byte[] data, String username, Map<String, Object> map) {
BufferedImage image;
try {

@ -51,7 +51,7 @@ public class DLNASettingsController {
private SettingsService settingsService;
@GetMapping
public String handleGet(Model model) throws Exception {
public String handleGet(Model model) {
Map<String, Object> map = new HashMap<String, Object>();
@ -64,7 +64,7 @@ public class DLNASettingsController {
}
@PostMapping
public String handlePost(HttpServletRequest request, RedirectAttributes redirectAttributes) throws Exception {
public String handlePost(HttpServletRequest request, RedirectAttributes redirectAttributes) {
handleParameters(request);
redirectAttributes.addFlashAttribute("settings_toast", true);
return "redirect:dlnaSettings.view";

@ -41,12 +41,12 @@ public class DatabaseSettingsController {
private SettingsService settingsService;
@GetMapping
protected String displayForm() throws Exception {
protected String displayForm() {
return "databaseSettings";
}
@ModelAttribute
protected void formBackingObject(Model model) throws Exception {
protected void formBackingObject(Model model) {
DatabaseSettingsCommand command = new DatabaseSettingsCommand();
command.setConfigType(settingsService.getDatabaseConfigType());
command.setEmbedDriver(settingsService.getDatabaseConfigEmbedDriver());
@ -62,7 +62,7 @@ public class DatabaseSettingsController {
@PostMapping
protected String onSubmit(@ModelAttribute("command") @Validated DatabaseSettingsCommand command,
BindingResult bindingResult,
RedirectAttributes redirectAttributes) throws Exception {
RedirectAttributes redirectAttributes) {
if (!bindingResult.hasErrors()) {
settingsService.resetDatabaseToDefault();
settingsService.setDatabaseConfigType(command.getConfigType());

@ -177,7 +177,7 @@ public class DownloadController implements LastModified {
LOG.info("Downloaded '" + FileUtil.getShortPath(file) + "' to " + status.getPlayer());
}
private String encodeAsRFC5987(String string) throws UnsupportedEncodingException {
private String encodeAsRFC5987(String string) {
byte[] stringAsByteArray = string.getBytes(StandardCharsets.UTF_8);
char[] digits = {'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F'};
byte[] attrChar = {'!', '#', '$', '&', '+', '-', '.', '^', '_', '`', '|', '~', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z'};

@ -38,7 +38,6 @@ import org.springframework.web.util.UriComponentsBuilder;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.*;
import java.util.stream.Collectors;
@ -99,7 +98,7 @@ public class ExternalPlayerController {
return new ModelAndView("externalPlayer", "model", map);
}
private List<MediaFileWithUrlInfo> getSongs(HttpServletRequest request, Share share, Player player) throws IOException {
private List<MediaFileWithUrlInfo> getSongs(HttpServletRequest request, Share share, Player player) {
Date expires = null;
Authentication authentication = SecurityContextHolder.getContext().getAuthentication();
if (authentication instanceof JWTAuthenticationToken) {

@ -46,12 +46,12 @@ public class GeneralSettingsController {
private SettingsService settingsService;
@GetMapping
protected String displayForm() throws Exception {
protected String displayForm() {
return "generalSettings";
}
@ModelAttribute
protected void formBackingObject(Model model) throws Exception {
protected void formBackingObject(Model model) {
GeneralSettingsCommand command = new GeneralSettingsCommand();
command.setCoverArtFileTypes(settingsService.getCoverArtFileTypes());
command.setIgnoredArticles(settingsService.getIgnoredArticles());
@ -93,7 +93,7 @@ public class GeneralSettingsController {
}
@PostMapping
protected String doSubmitAction(@ModelAttribute("command") GeneralSettingsCommand command, RedirectAttributes redirectAttributes) throws Exception {
protected String doSubmitAction(@ModelAttribute("command") GeneralSettingsCommand command, RedirectAttributes redirectAttributes) {
int themeIndex = Integer.parseInt(command.getThemeIndex());
Theme theme = settingsService.getAvailableThemes()[themeIndex];

@ -62,7 +62,7 @@ public class HelpController {
private SecurityService securityService;
@GetMapping
protected ModelAndView handleRequestInternal(HttpServletRequest request, HttpServletResponse response) throws Exception {
protected ModelAndView handleRequestInternal(HttpServletRequest request, HttpServletResponse response) {
Map<String, Object> map = new HashMap<>();
if (versionService.isNewFinalVersionAvailable()) {

@ -30,7 +30,6 @@ import org.springframework.web.servlet.view.RedirectView;
import javax.servlet.http.HttpServletRequest;
import java.io.IOException;
import java.util.*;
import static org.springframework.web.bind.ServletRequestUtils.getIntParameter;
@ -168,7 +167,7 @@ public class HomeController {
return result;
}
private List<Album> getNewest(int offset, int count, List<MusicFolder> musicFolders) throws IOException {
private List<Album> getNewest(int offset, int count, List<MusicFolder> musicFolders) {
List<Album> result = new ArrayList<>();
for (MediaFile file : mediaFileService.getNewestAlbums(offset, count, musicFolders)) {
Album album = createAlbum(file);
@ -182,7 +181,7 @@ public class HomeController {
return result;
}
private List<Album> getStarred(int offset, int count, String username, List<MusicFolder> musicFolders) throws IOException {
private List<Album> getStarred(int offset, int count, String username, List<MusicFolder> musicFolders) {
List<Album> result = new ArrayList<>();
for (MediaFile file : mediaFileService.getStarredAlbums(offset, count, username, musicFolders)) {
result.add(createAlbum(file));
@ -190,7 +189,7 @@ public class HomeController {
return result;
}
private List<Album> getRandom(int count, List<MusicFolder> musicFolders) throws IOException {
private List<Album> getRandom(int count, List<MusicFolder> musicFolders) {
List<Album> result = new ArrayList<>();
for (MediaFile file : searchService.getRandomAlbums(count, musicFolders)) {
result.add(createAlbum(file));
@ -198,7 +197,7 @@ public class HomeController {
return result;
}
private List<Album> getAlphabetical(int offset, int count, boolean byArtist, List<MusicFolder> musicFolders) throws IOException {
private List<Album> getAlphabetical(int offset, int count, boolean byArtist, List<MusicFolder> musicFolders) {
List<Album> result = new ArrayList<>();
for (MediaFile file : mediaFileService.getAlphabeticalAlbums(offset, count, byArtist, musicFolders)) {
result.add(createAlbum(file));

@ -58,7 +58,7 @@ public class ImportPlaylistController {
@PostMapping
protected String handlePost(RedirectAttributes redirectAttributes,
HttpServletRequest request
) throws Exception {
) {
Map<String, Object> map = new HashMap<String, Object>();
try {

@ -50,7 +50,7 @@ public class InternetRadioSettingsController {
private SettingsService settingsService;
@GetMapping
public String doGet(Model model) throws Exception {
public String doGet(Model model) {
Map<String, Object> map = new HashMap<>();
@ -61,7 +61,7 @@ public class InternetRadioSettingsController {
}
@PostMapping
public String doPost(HttpServletRequest request, RedirectAttributes redirectAttributes) throws Exception {
public String doPost(HttpServletRequest request, RedirectAttributes redirectAttributes) {
String error = handleParameters(request);
Map<String, Object> map = new HashMap<>();

@ -157,7 +157,7 @@ public class JAXBWriter {
}
public void writeErrorResponse(HttpServletRequest request, HttpServletResponse response,
SubsonicRESTController.ErrorCode code, String message) throws Exception {
SubsonicRESTController.ErrorCode code, String message) {
Response res = createResponse(false);
Error error = new Error();
res.setError(error);

@ -31,7 +31,7 @@ public class LoginController {
private SettingsService settingsService;
@GetMapping
public ModelAndView login(HttpServletRequest request, HttpServletResponse response) throws Exception {
public ModelAndView login(HttpServletRequest request, HttpServletResponse response) {
// Auto-login if "user" and "password" parameters are given.
String username = request.getParameter("user");

@ -40,7 +40,7 @@ import java.util.Map;
public class LyricsController {
@GetMapping
protected ModelAndView handleRequestInternal(HttpServletRequest request, HttpServletResponse response) throws Exception {
protected ModelAndView handleRequestInternal(HttpServletRequest request, HttpServletResponse response) {
Map<String, Object> map = new HashMap<>();
map.put("artist", request.getParameter("artist"));

@ -36,7 +36,6 @@ 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;
@ -74,7 +73,7 @@ public class M3UController {
return null;
}
private void createClientSidePlaylist(PrintWriter out, Player player, String url) throws Exception {
private void createClientSidePlaylist(PrintWriter out, Player player, String url) {
if (player.isM3uBomEnabled()) {
out.print("\ufeff");
}
@ -97,7 +96,7 @@ public class M3UController {
}
}
private void createServerSidePlaylist(PrintWriter out, Player player, String url) throws IOException {
private void createServerSidePlaylist(PrintWriter out, Player player, String url) {
url += "player=" + player.getId();

@ -34,7 +34,6 @@ 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;
@ -251,7 +250,7 @@ public class MainController {
return null;
}
private List<MediaFile> getMultiFolderChildren(List<MediaFile> mediaFiles) throws IOException {
private List<MediaFile> getMultiFolderChildren(List<MediaFile> mediaFiles) {
SortedSet<MediaFile> result = new TreeSet<>(new MediaFileComparator(settingsService.isSortAlbumsByYear()));
for (MediaFile mediaFile : mediaFiles) {
if (mediaFile.isFile()) {
@ -262,7 +261,7 @@ public class MainController {
return new ArrayList<>(result);
}
private List<MediaFile> getAncestors(MediaFile dir) throws IOException {
private List<MediaFile> getAncestors(MediaFile dir) {
LinkedList<MediaFile> result = new LinkedList<>();
try {

@ -68,14 +68,14 @@ public class MusicFolderSettingsController {
private IndexManager indexManager;
@GetMapping
protected String displayForm() throws Exception {
protected String displayForm() {
return "musicFolderSettings";
}
@ModelAttribute
protected void formBackingObject(@RequestParam(value = "scanNow",required = false) String scanNow,
@RequestParam(value = "expunge",required = false) String expunge,
Model model) throws Exception {
Model model) {
MusicFolderSettingsCommand command = new MusicFolderSettingsCommand();
if (scanNow != null) {
@ -125,7 +125,7 @@ public class MusicFolderSettingsController {
}
@PostMapping
protected String onSubmit(@ModelAttribute("command") MusicFolderSettingsCommand command, RedirectAttributes redirectAttributes) throws Exception {
protected String onSubmit(@ModelAttribute("command") MusicFolderSettingsCommand command, RedirectAttributes redirectAttributes) {
for (MusicFolderSettingsCommand.MusicFolderInfo musicFolderInfo : command.getMusicFolders()) {
if (musicFolderInfo.isDelete()) {

@ -58,7 +58,7 @@ public class PasswordSettingsController {
@GetMapping
protected ModelAndView displayForm(HttpServletRequest request) throws Exception {
protected ModelAndView displayForm(HttpServletRequest request) {
PasswordSettingsCommand command = new PasswordSettingsCommand();
User user = securityService.getCurrentUser(request);
command.setUsername(user.getUsername());
@ -67,7 +67,7 @@ public class PasswordSettingsController {
}
@PostMapping
protected String doSubmitAction(@ModelAttribute("command") @Validated PasswordSettingsCommand command, BindingResult bindingResult, RedirectAttributes redirectAttributes) throws Exception {
protected String doSubmitAction(@ModelAttribute("command") @Validated PasswordSettingsCommand command, BindingResult bindingResult, RedirectAttributes redirectAttributes) {
if (!bindingResult.hasErrors()) {
User user = securityService.getUserByName(command.getUsername());
user.setPassword(command.getPassword());

@ -53,7 +53,7 @@ public class PersonalSettingsController {
private SecurityService securityService;
@ModelAttribute
protected void formBackingObject(HttpServletRequest request,Model model) throws Exception {
protected void formBackingObject(HttpServletRequest request,Model model) {
PersonalSettingsCommand command = new PersonalSettingsCommand();
User user = securityService.getCurrentUser(request);
@ -110,12 +110,12 @@ public class PersonalSettingsController {
}
@GetMapping
protected String displayForm() throws Exception {
protected String displayForm() {
return "personalSettings";
}
@PostMapping
protected String doSubmitAction(@ModelAttribute("command") PersonalSettingsCommand command, RedirectAttributes redirectAttributes) throws Exception {
protected String doSubmitAction(@ModelAttribute("command") PersonalSettingsCommand command, RedirectAttributes redirectAttributes) {
int localeIndex = Integer.parseInt(command.getLocaleIndex());
Locale locale = null;

@ -59,7 +59,7 @@ public class PlayerSettingsController {
private TranscodingService transcodingService;
@GetMapping
protected String displayForm() throws Exception {
protected String displayForm() {
return "playerSettings";
}
@ -114,7 +114,7 @@ public class PlayerSettingsController {
}
@PostMapping
protected String doSubmitAction(@ModelAttribute("command") PlayerSettingsCommand command, RedirectAttributes redirectAttributes) throws Exception {
protected String doSubmitAction(@ModelAttribute("command") PlayerSettingsCommand command, RedirectAttributes redirectAttributes) {
Player player = playerService.getPlayerById(command.getPlayerId());
if (player != null) {
player.setAutoControlEnabled(command.isAutoControlEnabled());

@ -50,7 +50,7 @@ public class PlaylistsController {
private PlaylistService playlistService;
@GetMapping
public String doGet(HttpServletRequest request, Model model) throws Exception {
public String doGet(HttpServletRequest request, Model model) {
Map<String, Object> map = new HashMap<>();
User user = securityService.getCurrentUser(request);

@ -54,7 +54,7 @@ public class PodcastChannelsController {
private SettingsService settingsService;
@GetMapping
protected ModelAndView handleRequestInternal(HttpServletRequest request, HttpServletResponse response) throws Exception {
protected ModelAndView handleRequestInternal(HttpServletRequest request, HttpServletResponse response) {
Map<String, Object> map = new HashMap<>();
ModelAndView result = new ModelAndView();

@ -56,7 +56,7 @@ public class PodcastController {
private SecurityService securityService;
@GetMapping
protected ModelAndView handleRequestInternal(HttpServletRequest request, HttpServletResponse response) throws Exception {
protected ModelAndView handleRequestInternal(HttpServletRequest request, HttpServletResponse response) {
String url = request.getRequestURL().toString();
String username = securityService.getCurrentUsername(request);

@ -46,7 +46,7 @@ public class PodcastSettingsController {
private PodcastService podcastService;
@GetMapping
protected String formBackingObject(Model model) throws Exception {
protected String formBackingObject(Model model) {
PodcastSettingsCommand command = new PodcastSettingsCommand();
command.setInterval(String.valueOf(settingsService.getPodcastUpdateInterval()));
@ -59,7 +59,7 @@ public class PodcastSettingsController {
}
@PostMapping
protected String doSubmitAction(@ModelAttribute PodcastSettingsCommand command, RedirectAttributes redirectAttributes) throws Exception {
protected String doSubmitAction(@ModelAttribute PodcastSettingsCommand command, RedirectAttributes redirectAttributes) {
settingsService.setPodcastUpdateInterval(Integer.parseInt(command.getInterval()));
settingsService.setPodcastEpisodeRetentionCount(Integer.parseInt(command.getEpisodeRetentionCount()));
settingsService.setPodcastEpisodeDownloadCount(Integer.parseInt(command.getEpisodeDownloadCount()));

@ -47,7 +47,7 @@ public class RecoverController {
private SecurityService securityService;
@RequestMapping(method = {RequestMethod.GET, RequestMethod.POST})
public ModelAndView recover(HttpServletRequest request, HttpServletResponse response) throws Exception {
public ModelAndView recover(HttpServletRequest request, HttpServletResponse response) {
Map<String, Object> map = new HashMap<String, Object>();
String usernameOrEmail = StringUtils.trimToNull(request.getParameter("usernameOrEmail"));

@ -51,7 +51,7 @@ public class RightController {
private VersionService versionService;
@GetMapping
protected ModelAndView handleRequestInternal(HttpServletRequest request) throws Exception {
protected ModelAndView handleRequestInternal(HttpServletRequest request) {
Map<String, Object> map = new HashMap<>();
ModelAndView result = new ModelAndView("right");

@ -61,12 +61,12 @@ public class SearchController {
private SearchService searchService;
@GetMapping
protected String displayForm() throws Exception {
protected String displayForm() {
return "search";
}
@ModelAttribute
protected void formBackingObject(HttpServletRequest request, Model model) throws Exception {
protected void formBackingObject(HttpServletRequest request, Model model) {
model.addAttribute("command",new SearchCommand());
}

@ -43,7 +43,7 @@ public class SettingsController {
private SecurityService securityService;
@GetMapping
protected ModelAndView handleRequestInternal(HttpServletRequest request) throws Exception {
protected ModelAndView handleRequestInternal(HttpServletRequest request) {
User user = securityService.getCurrentUser(request);

@ -61,7 +61,7 @@ public class ShareSettingsController {
@GetMapping
public String doGet(HttpServletRequest request, Model model) throws Exception {
public String doGet(HttpServletRequest request, Model model) {
Map<String, Object> map = new HashMap<String, Object>();
map.put("shareInfos", getShareInfos(request));
@ -72,7 +72,7 @@ public class ShareSettingsController {
}
@PostMapping
public String doPost(HttpServletRequest request, RedirectAttributes redirectAttributes) throws Exception {
public String doPost(HttpServletRequest request, RedirectAttributes redirectAttributes) {
handleParameters(request);
redirectAttributes.addFlashAttribute("settings_toast", true);

@ -51,7 +51,7 @@ public class SonosSettingsController {
private SonosService sonosService;
@GetMapping
public String doGet(Model model) throws Exception {
public String doGet(Model model) {
Map<String, Object> map = new HashMap<String, Object>();
@ -63,7 +63,7 @@ public class SonosSettingsController {
}
@PostMapping
public String doPost(HttpServletRequest request, RedirectAttributes redirectAttributes) throws Exception {
public String doPost(HttpServletRequest request, RedirectAttributes redirectAttributes) {
handleParameters(request);
redirectAttributes.addFlashAttribute("settings_toast", true);

@ -49,7 +49,7 @@ public class StatusController {
private StatusService statusService;
@GetMapping
protected ModelAndView handleRequestInternal(HttpServletRequest request, HttpServletResponse response) throws Exception {
protected ModelAndView handleRequestInternal(HttpServletRequest request, HttpServletResponse response) {
Map<String, Object> map = new HashMap<>();
List<TransferStatus> streamStatuses = statusService.getAllStreamStatuses();

@ -145,12 +145,12 @@ public class SubsonicRESTController {
@ExceptionHandler(MissingServletRequestParameterException.class)
public void handleMissingRequestParam(HttpServletRequest request,
HttpServletResponse response,
MissingServletRequestParameterException exception) throws Exception {
MissingServletRequestParameterException exception) {
error(request, response, ErrorCode.MISSING_PARAMETER, "Required param (" + exception.getParameterName() + ") is missing");
}
@RequestMapping("/ping")
public void ping(HttpServletRequest request, HttpServletResponse response) throws Exception {
public void ping(HttpServletRequest request, HttpServletResponse response) {
Response res = createResponse();
jaxbWriter.writeResponse(request, response, res);
}
@ -160,7 +160,7 @@ public class SubsonicRESTController {
* CAUTION : this method is required by mobile applications and must not be removed.
*/
@RequestMapping("/getLicense")
public void getLicense(HttpServletRequest request, HttpServletResponse response) throws Exception {
public void getLicense(HttpServletRequest request, HttpServletResponse response) {
request = wrapRequest(request);
License license = new License();
@ -179,7 +179,7 @@ public class SubsonicRESTController {
@RequestMapping("/getMusicFolders")
public void getMusicFolders(HttpServletRequest request, HttpServletResponse response) throws Exception {
public void getMusicFolders(HttpServletRequest request, HttpServletResponse response) {
request = wrapRequest(request);
MusicFolders musicFolders = new MusicFolders();
@ -266,7 +266,7 @@ public class SubsonicRESTController {
}
@RequestMapping("/getGenres")
public void getGenres(HttpServletRequest request, HttpServletResponse response) throws Exception {
public void getGenres(HttpServletRequest request, HttpServletResponse response) {
request = wrapRequest(request);
org.subsonic.restapi.Genres genres = new org.subsonic.restapi.Genres();
@ -306,7 +306,7 @@ public class SubsonicRESTController {
}
@RequestMapping("/getArtists")
public void getArtists(HttpServletRequest request, HttpServletResponse response) throws Exception {
public void getArtists(HttpServletRequest request, HttpServletResponse response) {
request = wrapRequest(request);
String username = securityService.getCurrentUsername(request);
@ -776,7 +776,7 @@ public class SubsonicRESTController {
}
@RequestMapping("/getPlaylists")
public void getPlaylists(HttpServletRequest request, HttpServletResponse response) throws Exception {
public void getPlaylists(HttpServletRequest request, HttpServletResponse response) {
request = wrapRequest(request);
org.airsonic.player.domain.User user = securityService.getCurrentUser(request);
@ -1200,7 +1200,7 @@ public class SubsonicRESTController {
}
@RequestMapping("/getNowPlaying")
public void getNowPlaying(HttpServletRequest request, HttpServletResponse response) throws Exception {
public void getNowPlaying(HttpServletRequest request, HttpServletResponse response) {
request = wrapRequest(request);
NowPlaying result = new NowPlaying();
@ -1439,16 +1439,16 @@ public class SubsonicRESTController {
}
@RequestMapping("/star")
public void star(HttpServletRequest request, HttpServletResponse response) throws Exception {
public void star(HttpServletRequest request, HttpServletResponse response) {
starOrUnstar(request, response, true);
}
@RequestMapping("/unstar")
public void unstar(HttpServletRequest request, HttpServletResponse response) throws Exception {
public void unstar(HttpServletRequest request, HttpServletResponse response) {
starOrUnstar(request, response, false);
}
private void starOrUnstar(HttpServletRequest request, HttpServletResponse response, boolean star) throws Exception {
private void starOrUnstar(HttpServletRequest request, HttpServletResponse response, boolean star) {
request = wrapRequest(request);
String username = securityService.getCurrentUser(request).getUsername();
@ -1614,7 +1614,7 @@ public class SubsonicRESTController {
}
@RequestMapping("/refreshPodcasts")
public void refreshPodcasts(HttpServletRequest request, HttpServletResponse response) throws Exception {
public void refreshPodcasts(HttpServletRequest request, HttpServletResponse response) {
request = wrapRequest(request);
org.airsonic.player.domain.User user = securityService.getCurrentUser(request);
if (!user.isPodcastRole()) {
@ -1688,7 +1688,7 @@ public class SubsonicRESTController {
}
@RequestMapping("/getInternetRadioStations")
public void getInternetRadioStations(HttpServletRequest request, HttpServletResponse response) throws Exception {
public void getInternetRadioStations(HttpServletRequest request, HttpServletResponse response) {
request = wrapRequest(request);
InternetRadioStations result = new InternetRadioStations();
@ -1987,7 +1987,7 @@ public class SubsonicRESTController {
}
@RequestMapping("/getUsers")
public void getUsers(HttpServletRequest request, HttpServletResponse response) throws Exception {
public void getUsers(HttpServletRequest request, HttpServletResponse response) {
request = wrapRequest(request);
org.airsonic.player.domain.User currentUser = securityService.getCurrentUser(request);
@ -2166,7 +2166,7 @@ public class SubsonicRESTController {
}
@RequestMapping("/getLyrics")
public void getLyrics(HttpServletRequest request, HttpServletResponse response) throws Exception {
public void getLyrics(HttpServletRequest request, HttpServletResponse response) {
request = wrapRequest(request);
String artist = request.getParameter("artist");
String title = request.getParameter("title");
@ -2256,7 +2256,7 @@ public class SubsonicRESTController {
}
@RequestMapping("/getVideoInfo")
public ResponseEntity<String> getVideoInfo() throws Exception {
public ResponseEntity<String> getVideoInfo() {
return ResponseEntity.status(HttpStatus.SC_NOT_IMPLEMENTED).body(NOT_YET_IMPLEMENTED);
}
@ -2327,11 +2327,11 @@ public class SubsonicRESTController {
return jaxbWriter.createResponse(true);
}
private void writeEmptyResponse(HttpServletRequest request, HttpServletResponse response) throws Exception {
private void writeEmptyResponse(HttpServletRequest request, HttpServletResponse response) {
jaxbWriter.writeResponse(request, response, createResponse());
}
public void error(HttpServletRequest request, HttpServletResponse response, ErrorCode code, String message) throws Exception {
public void error(HttpServletRequest request, HttpServletResponse response, ErrorCode code, String message) {
jaxbWriter.writeErrorResponse(request, response, code, message);
}

@ -50,7 +50,7 @@ public class TopController {
private SecurityService securityService;
@GetMapping
protected ModelAndView handleRequestInternal(HttpServletRequest request) throws Exception {
protected ModelAndView handleRequestInternal(HttpServletRequest request) {
Map<String, Object> map = new HashMap<>();
User user = securityService.getCurrentUser(request);

@ -51,7 +51,7 @@ public class TranscodingSettingsController {
private SettingsService settingsService;
@GetMapping
public String doGet(Model model) throws Exception {
public String doGet(Model model) {
Map<String, Object> map = new HashMap<String, Object>();
@ -66,7 +66,7 @@ public class TranscodingSettingsController {
}
@PostMapping
public String doPost(HttpServletRequest request, RedirectAttributes redirectAttributes) throws Exception {
public String doPost(HttpServletRequest request, RedirectAttributes redirectAttributes) {
String error = handleParameters(request, redirectAttributes);
if (error != null) {
redirectAttributes.addFlashAttribute("error", error);

@ -72,7 +72,7 @@ public class UploadController {
public static final String UPLOAD_STATUS = "uploadStatus";
@PostMapping
protected ModelAndView handleRequestInternal(HttpServletRequest request, HttpServletResponse response) throws Exception {
protected ModelAndView handleRequestInternal(HttpServletRequest request, HttpServletResponse response) {
Map<String, Object> map = new HashMap<>();
List<File> uploadedFiles = new ArrayList<>();

@ -130,7 +130,7 @@ public class UserSettingsController {
}
@PostMapping
protected String doSubmitAction(@ModelAttribute("command") @Validated UserSettingsCommand command, BindingResult bindingResult, RedirectAttributes redirectAttributes) throws Exception {
protected String doSubmitAction(@ModelAttribute("command") @Validated UserSettingsCommand command, BindingResult bindingResult, RedirectAttributes redirectAttributes) {
if (!bindingResult.hasErrors()) {
if (command.isDeleteUser()) {

@ -21,7 +21,6 @@ package org.airsonic.player.domain;
import org.apache.commons.lang.StringUtils;
import java.io.IOException;
import java.util.*;
/**
@ -167,9 +166,8 @@ public class PlayQueue {
*
* @param mediaFiles The music files to add.
* @param index Where to add them.
* @throws IOException If an I/O error occurs.
*/
public synchronized void addFilesAt(Iterable<MediaFile> mediaFiles, int index) throws IOException {
public synchronized void addFilesAt(Iterable<MediaFile> mediaFiles, int index) {
makeBackup();
for (MediaFile mediaFile : mediaFiles) {
files.add(index, mediaFile);
@ -183,9 +181,8 @@ public class PlayQueue {
*
* @param append Whether existing songs in the playlist should be kept.
* @param mediaFiles The music files to add.
* @throws IOException If an I/O error occurs.
*/
public synchronized void addFiles(boolean append, Iterable<MediaFile> mediaFiles) throws IOException {
public synchronized void addFiles(boolean append, Iterable<MediaFile> mediaFiles) {
makeBackup();
if (!append) {
index = 0;
@ -200,7 +197,7 @@ public class PlayQueue {
/**
* Convenience method, equivalent to {@link #addFiles(boolean, Iterable)}.
*/
public synchronized void addFiles(boolean append, MediaFile... mediaFiles) throws IOException {
public synchronized void addFiles(boolean append, MediaFile... mediaFiles) {
addFiles(append, Arrays.asList(mediaFiles));
}

@ -17,7 +17,7 @@ public class MetricsFilter implements Filter {
private MetricsManager metricsManager;
@Override
public void init(FilterConfig filterConfig) throws ServletException {
public void init(FilterConfig filterConfig) {
}
@Override

@ -30,8 +30,6 @@ import javax.servlet.*;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
/**
* Intercepts exceptions thrown by RESTController.
*
@ -46,7 +44,7 @@ public class RESTFilter implements Filter {
private final JAXBWriter jaxbWriter = new JAXBWriter();
public void doFilter(ServletRequest req, ServletResponse res, FilterChain chain) throws IOException, ServletException {
public void doFilter(ServletRequest req, ServletResponse res, FilterChain chain) {
try {
HttpServletResponse response = (HttpServletResponse) res;
response.setHeader("Access-Control-Allow-Origin", "*");

@ -132,7 +132,7 @@ public class PlayQueueInputStream extends InputStream {
}
}
private void populateRandomPlaylist(PlayQueue playQueue) throws IOException {
private void populateRandomPlaylist(PlayQueue playQueue) {
List<MediaFile> files = searchService.getRandomSongs(playQueue.getRandomSearchCriteria());
playQueue.addFiles(false, files);
LOG.info("Recreated random playlist with " + playQueue.size() + " songs.");

@ -28,7 +28,6 @@ import org.slf4j.LoggerFactory;
import java.io.IOException;
import java.io.OutputStream;
import java.io.UnsupportedEncodingException;
import java.nio.charset.StandardCharsets;
/**
@ -151,13 +150,8 @@ public class ShoutCastOutputStream extends OutputStream {
if (streamTitle.equals(previousStreamTitle)) {
bytes = new byte[0];
} else {
try {
previousStreamTitle = streamTitle;
bytes = createStreamTitle(streamTitle);
} catch (UnsupportedEncodingException x) {
LOG.warn("Failed to create SHOUTcast meta-data. Ignoring.", x);
bytes = new byte[0];
}
}
// Length in groups of 16 bytes.
@ -179,7 +173,7 @@ public class ShoutCastOutputStream extends OutputStream {
}
}
private byte[] createStreamTitle(String title) throws UnsupportedEncodingException {
private byte[] createStreamTitle(String title) {
// Remove any quotes from the title.
title = title.replaceAll("'", "");

@ -112,7 +112,7 @@ public class TranscodeInputStream extends InputStream {
/**
* @see InputStream#close()
*/
public void close() throws IOException {
public void close() {
FileUtil.closeQuietly(processInputStream);
FileUtil.closeQuietly(processOutputStream);

@ -31,7 +31,7 @@ public class JWTRequestParameterProcessingFilter implements Filter {
failureHandler = new SimpleUrlAuthenticationFailureHandler(failureUrl);
}
public Authentication attemptAuthentication(HttpServletRequest request, HttpServletResponse response) throws AuthenticationException, IOException, ServletException {
public Authentication attemptAuthentication(HttpServletRequest request, HttpServletResponse response) throws AuthenticationException {
Optional<JWTAuthenticationToken> token = findToken(request);
if (token.isPresent()) {
return authenticationManager.authenticate(token.get());
@ -48,7 +48,7 @@ public class JWTRequestParameterProcessingFilter implements Filter {
}
@Override
public void init(FilterConfig filterConfig) throws ServletException {
public void init(FilterConfig filterConfig) {
}

@ -191,7 +191,7 @@ public class RESTRequestParameterProcessingFilter implements Filter {
}
}
private void sendErrorXml(HttpServletRequest request, HttpServletResponse response, SubsonicRESTController.ErrorCode errorCode) throws IOException {
private void sendErrorXml(HttpServletRequest request, HttpServletResponse response, SubsonicRESTController.ErrorCode errorCode) {
try {
jaxbWriter.writeErrorResponse(request, response, errorCode, errorCode.getMessage());
} catch (Exception e) {
@ -199,7 +199,7 @@ public class RESTRequestParameterProcessingFilter implements Filter {
}
}
public void init(FilterConfig filterConfig) throws ServletException {
public void init(FilterConfig filterConfig) {
}
public void destroy() {

@ -159,32 +159,32 @@ public class InternetRadioService {
try {
inputPlaylist.toPlaylist().acceptDown(new PlaylistVisitor() {
@Override
public void beginVisitPlaylist(Playlist playlist) throws Exception {
public void beginVisitPlaylist(Playlist playlist) {
}
@Override
public void endVisitPlaylist(Playlist playlist) throws Exception {
public void endVisitPlaylist(Playlist playlist) {
}
@Override
public void beginVisitParallel(Parallel parallel) throws Exception {
public void beginVisitParallel(Parallel parallel) {
}
@Override
public void endVisitParallel(Parallel parallel) throws Exception {
public void endVisitParallel(Parallel parallel) {
}
@Override
public void beginVisitSequence(Sequence sequence) throws Exception {
public void beginVisitSequence(Sequence sequence) {
}
@Override
public void endVisitSequence(Sequence sequence) throws Exception {
public void endVisitSequence(Sequence sequence) {
}
@ -202,7 +202,7 @@ public class InternetRadioService {
}
@Override
public void endVisitMedia(Media media) throws Exception {
public void endVisitMedia(Media media) {
}
});

@ -10,7 +10,6 @@ import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Service;
import java.io.File;
import java.io.IOException;
import java.util.*;
@ -226,7 +225,7 @@ public class JukeboxJavaService {
audioPlayer.setPlayList(new PlayList() {
@Override
public File getNextAudioFile() throws IOException {
public File getNextAudioFile() {
airsonicPlayer.getPlayQueue().next();
return getCurrentAudioFile();
}
@ -288,7 +287,7 @@ public class JukeboxJavaService {
audioPlayer.pause();
}
public void skip(Player airsonicPlayer, int index, int offset) throws Exception {
public void skip(Player airsonicPlayer, int index, int offset) {
log.debug("begin skip jukebox : player = id:{};name:{}", airsonicPlayer.getId(), airsonicPlayer.getName());
com.github.biconou.AudioPlayer.api.Player audioPlayer = retrieveAudioPlayerForAirsonicPlayer(airsonicPlayer);

@ -68,7 +68,7 @@ public class JukeboxLegacySubsonicService implements AudioPlayer.Listener {
* @param player The player in question.
* @param offset Start playing after this many seconds into the track.
*/
public synchronized void updateJukebox(Player player, int offset) throws Exception {
public synchronized void updateJukebox(Player player, int offset) {
User user = securityService.getUserByName(player.getUsername());
if (!user.isJukeboxRole()) {
LOG.warn(user.getUsername() + " is not authorized for jukebox playback.");

@ -73,7 +73,7 @@ public class JukeboxService {
* This method should be removed when the jukebox is controlled only through rest api.
*/
@Deprecated
public void updateJukebox(Player airsonicPlayer, int offset) throws Exception {
public void updateJukebox(Player airsonicPlayer, int offset) {
if (airsonicPlayer.getTechnology().equals(PlayerTechnology.JUKEBOX)) {
jukeboxLegacySubsonicService.updateJukebox(airsonicPlayer,offset);
}
@ -92,7 +92,7 @@ public class JukeboxService {
/**
* Plays the playQueue of a jukebox player starting at the first item of the queue.
*/
public void play(Player airsonicPlayer) throws Exception {
public void play(Player airsonicPlayer) {
switch (airsonicPlayer.getTechnology()) {
case JUKEBOX:
jukeboxLegacySubsonicService.updateJukebox(airsonicPlayer,0);
@ -103,7 +103,7 @@ public class JukeboxService {
}
}
public void start(Player airsonicPlayer) throws Exception {
public void start(Player airsonicPlayer) {
switch (airsonicPlayer.getTechnology()) {
case JUKEBOX:
jukeboxLegacySubsonicService.updateJukebox(airsonicPlayer,0);
@ -114,7 +114,7 @@ public class JukeboxService {
}
}
public void stop(Player airsonicPlayer) throws Exception {
public void stop(Player airsonicPlayer) {
switch (airsonicPlayer.getTechnology()) {
case JUKEBOX:
jukeboxLegacySubsonicService.updateJukebox(airsonicPlayer,0);
@ -125,7 +125,7 @@ public class JukeboxService {
}
}
public void skip(Player airsonicPlayer,int index,int offset) throws Exception {
public void skip(Player airsonicPlayer,int index,int offset) {
switch (airsonicPlayer.getTechnology()) {
case JUKEBOX:
jukeboxLegacySubsonicService.updateJukebox(airsonicPlayer,offset);

@ -37,7 +37,6 @@ import org.springframework.stereotype.Service;
import javax.annotation.PostConstruct;
import java.io.File;
import java.io.IOException;
import java.util.*;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
@ -181,7 +180,7 @@ public class LastFmService {
* @return Songs from similar artists;
*/
public List<MediaFile> getSimilarSongs(org.airsonic.player.domain.Artist artist, int count,
List<MusicFolder> musicFolders) throws IOException {
List<MusicFolder> musicFolders) {
List<MediaFile> similarSongs = new ArrayList<MediaFile>(mediaFileDao.getSongsByArtist(artist.getName(), 0, 1000));
for (org.airsonic.player.domain.Artist similarArtist : getSimilarArtists(artist, 100, false, musicFolders)) {

@ -37,7 +37,6 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.io.File;
import java.io.IOException;
import java.nio.file.Files;
import java.util.*;
@ -542,14 +541,10 @@ public class MediaFileService {
}
// Look for cover art.
try {
File coverArt = findCoverArt(children);
if (coverArt != null) {
mediaFile.setCoverArtPath(coverArt.getPath());
}
} catch (IOException x) {
LOG.error("Failed to find cover art.", x);
}
} else {
mediaFile.setArtist(file.getName());
@ -616,7 +611,7 @@ public class MediaFileService {
/**
* Finds a cover art image for the given directory, by looking for it on the disk.
*/
private File findCoverArt(File[] candidates) throws IOException {
private File findCoverArt(File[] candidates) {
for (String mask : settingsService.getCoverArtFileTypesAsArray()) {
for (File candidate : candidates) {
if (candidate.isFile() && candidate.getName().toUpperCase().endsWith(mask.toUpperCase()) && !candidate.getName().startsWith(".")) {

@ -26,7 +26,6 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.io.File;
import java.io.IOException;
import java.io.Serializable;
import java.text.Collator;
import java.util.*;
@ -50,25 +49,24 @@ public class MusicIndexService {
* @param folders The music folders.
* @param refresh Whether to look for updates by checking the last-modified timestamp of the music folders.
* @return A map from music indexes to sets of artists that are direct children of this music file.
* @throws IOException If an I/O error occurs.
*/
public SortedMap<MusicIndex, List<MusicIndex.SortableArtistWithMediaFiles>> getIndexedArtists(List<MusicFolder> folders, boolean refresh) throws IOException {
public SortedMap<MusicIndex, List<MusicIndex.SortableArtistWithMediaFiles>> getIndexedArtists(List<MusicFolder> folders, boolean refresh) {
List<MusicIndex.SortableArtistWithMediaFiles> artists = createSortableArtists(folders, refresh);
return sortArtists(artists);
}
public SortedMap<MusicIndex, List<MusicIndex.SortableArtistWithArtist>> getIndexedArtists(List<Artist> artists) throws IOException {
public SortedMap<MusicIndex, List<MusicIndex.SortableArtistWithArtist>> getIndexedArtists(List<Artist> artists) {
List<MusicIndex.SortableArtistWithArtist> sortableArtists = createSortableArtists(artists);
return sortArtists(sortableArtists);
}
public MusicFolderContent getMusicFolderContent(List<MusicFolder> musicFoldersToUse, boolean refresh) throws Exception {
public MusicFolderContent getMusicFolderContent(List<MusicFolder> musicFoldersToUse, boolean refresh) {
SortedMap<MusicIndex, List<MusicIndex.SortableArtistWithMediaFiles>> indexedArtists = getIndexedArtists(musicFoldersToUse, refresh);
List<MediaFile> singleSongs = getSingleSongs(musicFoldersToUse, refresh);
return new MusicFolderContent(indexedArtists, singleSongs);
}
private List<MediaFile> getSingleSongs(List<MusicFolder> folders, boolean refresh) throws IOException {
private List<MediaFile> getSingleSongs(List<MusicFolder> folders, boolean refresh) {
List<MediaFile> result = new ArrayList<MediaFile>();
for (MusicFolder folder : folders) {
MediaFile parent = mediaFileService.getMediaFile(folder.getPath(), !refresh);
@ -157,7 +155,7 @@ public class MusicIndexService {
return result;
}
private List<MusicIndex.SortableArtistWithMediaFiles> createSortableArtists(List<MusicFolder> folders, boolean refresh) throws IOException {
private List<MusicIndex.SortableArtistWithMediaFiles> createSortableArtists(List<MusicFolder> folders, boolean refresh) {
String[] ignoredArticles = settingsService.getIgnoredArticlesAsArray();
String[] shortcuts = settingsService.getShortcutsAsArray();
SortedMap<String, MusicIndex.SortableArtistWithMediaFiles> artistMap = new TreeMap<String, MusicIndex.SortableArtistWithMediaFiles>();

@ -261,7 +261,7 @@ public class PlaylistService {
}
}
private void doImportPlaylists() throws Exception {
private void doImportPlaylists() {
String playlistFolderPath = settingsService.getPlaylistFolder();
if (playlistFolderPath == null) {
return;

@ -96,7 +96,7 @@ public class ShareService {
return result;
}
public Share createShare(HttpServletRequest request, List<MediaFile> files) throws Exception {
public Share createShare(HttpServletRequest request, List<MediaFile> files) {
Share share = new Share();
share.setName(RandomStringUtils.random(5, "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"));

@ -118,7 +118,7 @@ public class UPnPService {
}
}
private synchronized void createService() throws Exception {
private synchronized void createService() {
upnpService = new UpnpServiceImpl(new ApacheUpnpServiceConfiguration());
// Asynch search for other devices (most importantly UPnP-enabled routers for port-mapping)
@ -160,7 +160,7 @@ public class UPnPService {
contentDirectoryservice.setManager(new DefaultServiceManager<CustomContentDirectory>(contentDirectoryservice) {
@Override
protected CustomContentDirectory createServiceInstance() throws Exception {
protected CustomContentDirectory createServiceInstance() {
return dispatchingContentDirectory;
}
});
@ -180,7 +180,7 @@ public class UPnPService {
LocalService<ConnectionManagerService> connetionManagerService = new AnnotationLocalServiceBinder().read(ConnectionManagerService.class);
connetionManagerService.setManager(new DefaultServiceManager<ConnectionManagerService>(connetionManagerService) {
@Override
protected ConnectionManagerService createServiceInstance() throws Exception {
protected ConnectionManagerService createServiceInstance() {
return new ConnectionManagerService(protocols, null);
}
});

@ -13,7 +13,7 @@ public class PlayerTest implements AudioPlayer.Listener {
private AudioPlayer player;
public PlayerTest() throws Exception {
public PlayerTest() {
createGUI();
}
@ -57,7 +57,7 @@ public class PlayerTest implements AudioPlayer.Listener {
}
}
public static void main(String[] args) throws Exception {
public static void main(String[] args) {
new PlayerTest();
}

@ -33,37 +33,37 @@ public class DefaultPlaylistImportHandler implements PlaylistImportHandler {
try {
inputSpecificPlaylist.toPlaylist().acceptDown(new PlaylistVisitor() {
@Override
public void beginVisitPlaylist(Playlist playlist) throws Exception {
public void beginVisitPlaylist(Playlist playlist) {
}
@Override
public void endVisitPlaylist(Playlist playlist) throws Exception {
public void endVisitPlaylist(Playlist playlist) {
}
@Override
public void beginVisitParallel(Parallel parallel) throws Exception {
public void beginVisitParallel(Parallel parallel) {
}
@Override
public void endVisitParallel(Parallel parallel) throws Exception {
public void endVisitParallel(Parallel parallel) {
}
@Override
public void beginVisitSequence(Sequence sequence) throws Exception {
public void beginVisitSequence(Sequence sequence) {
}
@Override
public void endVisitSequence(Sequence sequence) throws Exception {
public void endVisitSequence(Sequence sequence) {
}
@Override
public void beginVisitMedia(Media media) throws Exception {
public void beginVisitMedia(Media media) {
try {
URI uri = media.getSource().getURI();
File file = new File(uri);
@ -79,7 +79,7 @@ public class DefaultPlaylistImportHandler implements PlaylistImportHandler {
}
@Override
public void endVisitMedia(Media media) throws Exception {
public void endVisitMedia(Media media) {
}
});

@ -30,7 +30,7 @@ public class XspfPlaylistExportHandler implements PlaylistExportHandler {
}
@Override
public SpecificPlaylist handle(int id, SpecificPlaylistProvider provider) throws Exception {
public SpecificPlaylist handle(int id, SpecificPlaylistProvider provider) {
return createXsfpPlaylistFromDBId(id);
}

@ -37,7 +37,6 @@ import org.springframework.stereotype.Service;
import org.springframework.web.util.UriComponentsBuilder;
import java.net.URI;
import java.net.URISyntaxException;
import java.util.ArrayList;
import java.util.List;
@ -76,7 +75,7 @@ public class AlbumUpnpProcessor extends UpnpContentProcessor <Album, MediaFile>
return createBrowseResult(didl, (int) didl.getCount(), getAllItemsSize());
}
public Container createContainer(Album album) throws Exception {
public Container createContainer(Album album) {
MusicAlbum container = new MusicAlbum();
if (album.getId() == -1) {
@ -100,7 +99,7 @@ public class AlbumUpnpProcessor extends UpnpContentProcessor <Album, MediaFile>
return getAlbumDao().getAlphabeticalAlbums(0, Integer.MAX_VALUE, false, true, allFolders);
}
public Album getItemById(String id) throws Exception {
public Album getItemById(String id) {
Album returnValue = null;
if (id.startsWith(ALL_BY_ARTIST) || id.equalsIgnoreCase(ALL_RECENT)) {
returnValue = new Album();
@ -112,7 +111,7 @@ public class AlbumUpnpProcessor extends UpnpContentProcessor <Album, MediaFile>
return returnValue;
}
public List<MediaFile> getChildren(Album album) throws Exception {
public List<MediaFile> getChildren(Album album) {
List<MediaFile> allFiles = getMediaFileDao().getSongsForAlbum(album.getArtist(), album.getName());
if (album.getId() == -1) {
List<Album> albumList = null;
@ -136,17 +135,17 @@ public class AlbumUpnpProcessor extends UpnpContentProcessor <Album, MediaFile>
}
@Override
public int getAllItemsSize() throws Exception {
public int getAllItemsSize() {
List<MusicFolder> allFolders = getDispatchingContentDirectory().getSettingsService().getAllMusicFolders();
return getAlbumDao().getAlbumCount(allFolders);
}
public void addChild(DIDLContent didl, MediaFile child) throws Exception {
public void addChild(DIDLContent didl, MediaFile child) {
didl.addItem(getDispatcher().getMediaFileProcessor().createItem(child));
}
public URI getAlbumArtURI(int albumId) throws URISyntaxException {
public URI getAlbumArtURI(int albumId) {
return getDispatcher().getJwtSecurityService().addJWTToken(UriComponentsBuilder.fromUriString(getDispatcher().getBaseUrl() + "/ext/coverArt.view").queryParam("id", albumId).queryParam("size", CoverArtScheme.LARGE.getSize())).build().encode().toUri();
}

@ -69,7 +69,7 @@ public class ArtistUpnpProcessor extends UpnpContentProcessor <Artist, Album> {
return allArtists;
}
public Artist getItemById(String id) throws Exception {
public Artist getItemById(String id) {
return getArtistDao().getArtist(Integer.parseInt(id));
}
@ -88,7 +88,7 @@ public class ArtistUpnpProcessor extends UpnpContentProcessor <Artist, Album> {
return allAlbums;
}
public void addChild(DIDLContent didl, Album album) throws Exception {
public void addChild(DIDLContent didl, Album album) {
didl.addContainer(getAlbumProcessor().createContainer(album));
}

@ -34,7 +34,6 @@ import org.springframework.stereotype.Service;
import org.springframework.web.util.UriComponentsBuilder;
import java.net.URI;
import java.net.URISyntaxException;
import java.util.Arrays;
/**
@ -171,7 +170,7 @@ public class DispatchingContentDirectory extends CustomContentDirectory {
return null;
}
public Item createItem(MediaFile song) throws Exception {
public Item createItem(MediaFile song) {
MediaFile parent = mediaFileService.getParentOf(song);
MusicTrack item = new MusicTrack();
item.setId(String.valueOf(song.getId()));
@ -196,7 +195,7 @@ public class DispatchingContentDirectory extends CustomContentDirectory {
return item;
}
public URI getAlbumArtUrl(int id) throws URISyntaxException {
public URI getAlbumArtUrl(int id) {
return jwtSecurityService.addJWTToken(UriComponentsBuilder.fromUriString(getBaseUrl() + "/ext/coverArt.view").queryParam("id", id).queryParam("size", CoverArtScheme.LARGE.getSize())).build().encode().toUri();
}

@ -39,7 +39,6 @@ import org.springframework.stereotype.Service;
import org.springframework.web.util.UriComponentsBuilder;
import java.net.URI;
import java.net.URISyntaxException;
import java.util.Arrays;
import java.util.List;
@ -181,7 +180,7 @@ public class FolderBasedContentDirectory extends CustomContentDirectory {
return createBrowseResult(didl, selectedChildren.size(), allChildren.size());
}
private void addContainerOrItem(DIDLContent didl, MediaFile mediaFile) throws Exception {
private void addContainerOrItem(DIDLContent didl, MediaFile mediaFile) {
if (mediaFile.isFile()) {
didl.addItem(createItem(mediaFile));
} else {
@ -189,7 +188,7 @@ public class FolderBasedContentDirectory extends CustomContentDirectory {
}
}
private Item createItem(MediaFile song) throws Exception {
private Item createItem(MediaFile song) {
MediaFile parent = mediaFileService.getParentOf(song);
MusicTrack item = new MusicTrack();
item.setId(String.valueOf(song.getId()));
@ -214,7 +213,7 @@ public class FolderBasedContentDirectory extends CustomContentDirectory {
return item;
}
private Container createContainer(MediaFile mediaFile) throws Exception {
private Container createContainer(MediaFile mediaFile) {
Container container = mediaFile.isAlbum() ? createAlbumContainer(mediaFile) : new MusicAlbum();
container.setId(CONTAINER_ID_FOLDER_PREFIX + mediaFile.getId());
container.setTitle(mediaFile.getName());
@ -231,7 +230,7 @@ public class FolderBasedContentDirectory extends CustomContentDirectory {
return container;
}
private Container createAlbumContainer(MediaFile album) throws Exception {
private Container createAlbumContainer(MediaFile album) {
MusicAlbum container = new MusicAlbum();
container.setAlbumArtURIs(new URI[]{getAlbumArtUrl(album)});
@ -266,7 +265,7 @@ public class FolderBasedContentDirectory extends CustomContentDirectory {
return container;
}
private URI getAlbumArtUrl(MediaFile album) throws URISyntaxException {
private URI getAlbumArtUrl(MediaFile album) {
return jwtSecurityService.addJWTToken(UriComponentsBuilder.fromUriString(getBaseUrl() + "/ext/coverArt.view")
.queryParam("id", album.getId())
.queryParam("size", CoverArtScheme.LARGE.getSize()))

@ -98,7 +98,7 @@ public class GenreUpnpProcessor extends UpnpContentProcessor <Genre, MediaFile>
return getDispatcher().getMediaFileProcessor().getMediaFileDao().getSongsByGenre(item.getName(), 0, Integer.MAX_VALUE, allFolders);
}
public void addChild(DIDLContent didl, MediaFile child) throws Exception {
public void addChild(DIDLContent didl, MediaFile child) {
didl.addItem(getDispatcher().getMediaFileProcessor().createItem(child));
}
}

@ -62,7 +62,7 @@ public class MediaFileUpnpProcessor extends UpnpContentProcessor <MediaFile, Med
return createBrowseResult(didl, 1, 1);
}
public Container createContainer(MediaFile item) throws Exception {
public Container createContainer(MediaFile item) {
MusicAlbum container = new MusicAlbum();
if (item.isAlbum()) {
container.setAlbumArtURIs(new URI[] { getDispatcher().getAlbumProcessor().getAlbumArtURI(item.getId())});
@ -88,7 +88,7 @@ public class MediaFileUpnpProcessor extends UpnpContentProcessor <MediaFile, Med
return container;
}
public List<MediaFile> getAllItems() throws Exception {
public List<MediaFile> getAllItems() {
List<MusicFolder> allFolders = getDispatcher().getSettingsService().getAllMusicFolders();
List<MediaFile> returnValue = new ArrayList<MediaFile>();
if (allFolders.size() == 1) {
@ -102,7 +102,7 @@ public class MediaFileUpnpProcessor extends UpnpContentProcessor <MediaFile, Med
return returnValue;
}
public MediaFile getItemById(String id) throws Exception {
public MediaFile getItemById(String id) {
return getMediaFileService().getMediaFile(Integer.parseInt(id));
}
@ -112,7 +112,7 @@ public class MediaFileUpnpProcessor extends UpnpContentProcessor <MediaFile, Med
return children;
}
public void addItem(DIDLContent didl, MediaFile item) throws Exception {
public void addItem(DIDLContent didl, MediaFile item) {
if (item.isFile()) {
didl.addItem(createItem(item));
} else {
@ -120,7 +120,7 @@ public class MediaFileUpnpProcessor extends UpnpContentProcessor <MediaFile, Med
}
}
public void addChild(DIDLContent didl, MediaFile child) throws Exception {
public void addChild(DIDLContent didl, MediaFile child) {
if (child.isFile()) {
didl.addItem(createItem(child));
} else {
@ -128,7 +128,7 @@ public class MediaFileUpnpProcessor extends UpnpContentProcessor <MediaFile, Med
}
}
public Item createItem(MediaFile song) throws Exception {
public Item createItem(MediaFile song) {
MediaFile parent = getMediaFileService().getParentOf(song);
MusicTrack item = new MusicTrack();
item.setId(String.valueOf(song.getId()));

@ -42,7 +42,7 @@ public class NATPMPRouter implements Router {
}
}
public void addPortMapping(int externalPort, int internalPort, int leaseDuration) throws Exception {
public void addPortMapping(int externalPort, int internalPort, int leaseDuration) {
// Use one week if lease duration is "forever".
if (leaseDuration == 0) {
@ -54,7 +54,7 @@ public class NATPMPRouter implements Router {
device.waitUntilQueueEmpty();
}
public void deletePortMapping(int externalPort, int internalPort) throws Exception {
public void deletePortMapping(int externalPort, int internalPort) {
MapRequestMessage map = new MapRequestMessage(true, internalPort, externalPort, 0, null);
device.enqueueMessage(map);
device.waitUntilQueueEmpty();

@ -59,7 +59,7 @@ public class PlaylistUpnpProcessor extends UpnpContentProcessor <Playlist, Media
return getPlaylistService().getAllPlaylists();
}
public Playlist getItemById(String id) throws Exception {
public Playlist getItemById(String id) {
return getDispatcher().getPlaylistService().getPlaylist(Integer.parseInt(id));
}
@ -67,7 +67,7 @@ public class PlaylistUpnpProcessor extends UpnpContentProcessor <Playlist, Media
return getPlaylistService().getFilesInPlaylist(item.getId());
}
public void addChild(DIDLContent didl, MediaFile child) throws Exception {
public void addChild(DIDLContent didl, MediaFile child) {
didl.addItem(getDispatchingContentDirectory().createItem(child));
}

@ -80,7 +80,7 @@ public class RecentAlbumUpnpProcessor extends AlbumUpnpProcessor {
}
@Override
public int getAllItemsSize() throws Exception {
public int getAllItemsSize() {
List<MusicFolder> allFolders = getDispatchingContentDirectory().getSettingsService().getAllMusicFolders();
int allAlbumCount = getAlbumDao().getAlbumCount(allFolders);
return Math.min(allAlbumCount, RECENT_COUNT);

@ -32,7 +32,7 @@ public interface Router {
* @param internalPort The internal client port where data should be redirected.
* @param leaseDuration Seconds the lease duration in seconds, or 0 for an infinite time.
*/
void addPortMapping(int externalPort, int internalPort, int leaseDuration) throws Exception;
void addPortMapping(int externalPort, int internalPort, int leaseDuration);
/**
* Deletes a NAT entry on the UPNP device.
@ -40,5 +40,5 @@ public interface Router {
* @param externalPort The external port of the NAT entry to delete.
* @param internalPort The internal port of the NAT entry to delete.
*/
void deletePortMapping(int externalPort, int internalPort) throws Exception;
void deletePortMapping(int externalPort, int internalPort);
}

@ -22,7 +22,6 @@ package org.airsonic.player.service.upnp;
import org.airsonic.player.domain.MusicFolder;
import org.airsonic.player.domain.ParamSearchResult;
import org.airsonic.player.util.Util;
import org.fourthline.cling.support.contentdirectory.ContentDirectoryException;
import org.fourthline.cling.support.contentdirectory.DIDLParser;
import org.fourthline.cling.support.model.BrowseResult;
import org.fourthline.cling.support.model.DIDLContent;
@ -123,8 +122,7 @@ public abstract class UpnpContentProcessor<T extends Object, U extends Object> {
public BrowseResult searchByName(String name,
long firstResult, long maxResults,
SortCriterion[] orderBy)
throws ContentDirectoryException {
SortCriterion[] orderBy) {
DIDLContent didl = new DIDLContent();
Class clazz = (Class) ((ParameterizedType) getClass().getGenericSuperclass()).getActualTypeArguments()[0];
@ -153,7 +151,7 @@ public abstract class UpnpContentProcessor<T extends Object, U extends Object> {
return getDispatchingContentDirectory();
}
public void addItem(DIDLContent didl, T item) throws Exception {
public void addItem(DIDLContent didl, T item) {
didl.addContainer(createContainer(item));
}
@ -162,15 +160,15 @@ public abstract class UpnpContentProcessor<T extends Object, U extends Object> {
return getAllItems().size();
}
public abstract Container createContainer(T item) throws Exception;
public abstract Container createContainer(T item);
public abstract List<T> getAllItems() throws Exception;
public abstract T getItemById(String id) throws Exception;
public abstract T getItemById(String id);
public abstract List<U> getChildren(T item) throws Exception;
public abstract void addChild(DIDLContent didl, U child) throws Exception;
public abstract void addChild(DIDLContent didl, U child);
public String getRootTitle() {
return rootTitle;

@ -51,7 +51,7 @@ public class EscapeJavaScriptTag extends BodyTagSupport {
private String string;
public int doStartTag() throws JspException {
public int doStartTag() {
return EVAL_BODY_BUFFERED;
}

@ -48,7 +48,7 @@ public class FormatBytesTag extends BodyTagSupport {
private long bytes;
public int doStartTag() throws JspException {
public int doStartTag() {
return EVAL_BODY_BUFFERED;
}

@ -62,7 +62,7 @@ public class UrlTag extends BodyTagSupport {
private String encoding = DEFAULT_ENCODING;
private List<Parameter> parameters = new ArrayList<Parameter>();
public int doStartTag() throws JspException {
public int doStartTag() {
parameters.clear();
return EVAL_BODY_BUFFERED;
}

@ -43,7 +43,7 @@ public class WikiTag extends BodyTagSupport {
private String text;
public int doStartTag() throws JspException {
public int doStartTag() {
return EVAL_BODY_BUFFERED;
}

@ -11,7 +11,6 @@ import org.springframework.boot.test.mock.mockito.MockBean;
import org.springframework.boot.test.mock.mockito.SpyBean;
import org.springframework.security.test.context.support.WithMockUser;
import static org.mockito.Matchers.any;
import static org.mockito.Mockito.*;
public class AirsonicRestApiJukeboxLegacyIntTest extends AirsonicRestApiJukeboxIntTest {

@ -20,7 +20,7 @@ public class InternetRadioDaoTestCase extends DaoTestCaseBean2 {
InternetRadioDao internetRadioDao;
@Before
public void setUp() throws Exception {
public void setUp() {
getJdbcTemplate().execute("delete from internet_radio");
}

@ -40,7 +40,7 @@ public class MusicFolderDaoTestCase extends DaoTestCaseBean2 {
MusicFolderDao musicFolderDao;
@Before
public void setUp() throws Exception {
public void setUp() {
getJdbcTemplate().execute("delete from music_folder");
}

@ -24,7 +24,7 @@ public class PlayerDaoTestCase extends DaoTestCaseBean2 {
PlayerDao playerDao;
@Before
public void setUp() throws Exception {
public void setUp() {
getJdbcTemplate().execute("delete from player");
}

@ -23,7 +23,7 @@ public class PodcastDaoTestCase extends DaoTestCaseBean2 {
PodcastDao podcastDao;
@Before
public void setUp() throws Exception {
public void setUp() {
getJdbcTemplate().execute("delete from podcast_channel");
}

@ -24,7 +24,7 @@ public class TranscodingDaoTestCase extends DaoTestCaseBean2 {
PlayerDao playerDao;
@Before
public void setUp() throws Exception {
public void setUp() {
getJdbcTemplate().execute("delete from transcoding2");
}

@ -25,7 +25,7 @@ public class UserDaoTestCase extends DaoTestCaseBean2 {
UserDao userDao;
@Before
public void setUp() throws Exception {
public void setUp() {
getJdbcTemplate().execute("delete from user_role");
getJdbcTemplate().execute("delete from user");
}

@ -29,7 +29,7 @@ public class MediaFileComparatorTestCase extends TestCase {
private final MediaFileComparator comparator = new MediaFileComparator(true);
public void testCompareAlbums() throws Exception {
public void testCompareAlbums() {
MediaFile albumA2012 = new MediaFile();
albumA2012.setMediaType(MediaFile.MediaType.ALBUM);
@ -65,7 +65,7 @@ public class MediaFileComparatorTestCase extends TestCase {
assertEquals(1, comparator.compare(albumB2012, albumA2012));
}
public void testCompareDiscNumbers() throws Exception {
public void testCompareDiscNumbers() {
MediaFile discXtrack1 = new MediaFile();
discXtrack1.setMediaType(MediaFile.MediaType.MUSIC);

@ -22,7 +22,6 @@ package org.airsonic.player.domain;
import junit.framework.TestCase;
import java.io.File;
import java.io.IOException;
import java.util.Arrays;
/**
@ -40,7 +39,7 @@ public class PlayQueueTestCase extends TestCase {
assertNull(playQueue.getCurrentFile());
}
public void testStatus() throws Exception {
public void testStatus() {
PlayQueue playQueue = new PlayQueue();
assertEquals(PlayQueue.Status.PLAYING, playQueue.getStatus());
@ -54,7 +53,7 @@ public class PlayQueueTestCase extends TestCase {
assertEquals(PlayQueue.Status.PLAYING, playQueue.getStatus());
}
public void testMoveUp() throws Exception {
public void testMoveUp() {
PlayQueue playQueue = createPlaylist(0, "A", "B", "C", "D");
playQueue.moveUp(0);
assertPlaylistEquals(playQueue, 0, "A", "B", "C", "D");
@ -72,7 +71,7 @@ public class PlayQueueTestCase extends TestCase {
assertPlaylistEquals(playQueue, 2, "A", "B", "D", "C");
}
public void testMoveDown() throws Exception {
public void testMoveDown() {
PlayQueue playQueue = createPlaylist(0, "A", "B", "C", "D");
playQueue.moveDown(0);
assertPlaylistEquals(playQueue, 1, "B", "A", "C", "D");
@ -90,7 +89,7 @@ public class PlayQueueTestCase extends TestCase {
assertPlaylistEquals(playQueue, 3, "A", "B", "C", "D");
}
public void testRemove() throws Exception {
public void testRemove() {
PlayQueue playQueue = createPlaylist(0, "A", "B", "C", "D");
playQueue.removeFileAt(0);
assertPlaylistEquals(playQueue, 0, "B", "C", "D");
@ -116,7 +115,7 @@ public class PlayQueueTestCase extends TestCase {
assertPlaylistEquals(playQueue, -1);
}
public void testNext() throws Exception {
public void testNext() {
PlayQueue playQueue = createPlaylist(0, "A", "B", "C");
assertFalse(playQueue.isRepeatEnabled());
playQueue.next();
@ -137,7 +136,7 @@ public class PlayQueueTestCase extends TestCase {
assertPlaylistEquals(playQueue, 0, "A", "B", "C");
}
public void testPlayAfterEndReached() throws Exception {
public void testPlayAfterEndReached() {
PlayQueue playQueue = createPlaylist(2, "A", "B", "C");
playQueue.setStatus(PlayQueue.Status.PLAYING);
playQueue.next();
@ -150,7 +149,7 @@ public class PlayQueueTestCase extends TestCase {
assertEquals("A", playQueue.getCurrentFile().getName());
}
public void testPlayLast() throws Exception {
public void testPlayLast() {
PlayQueue playQueue = createPlaylist(1, "A", "B", "C");
playQueue.addFiles(true, new TestMediaFile("D"));
@ -160,7 +159,7 @@ public class PlayQueueTestCase extends TestCase {
assertPlaylistEquals(playQueue, 0, "E");
}
public void testAddFilesAt() throws Exception {
public void testAddFilesAt() {
PlayQueue playQueue = createPlaylist(0);
playQueue.addFilesAt(Arrays.<MediaFile>asList(new TestMediaFile("A"), new TestMediaFile("B"), new TestMediaFile("C")), 0);
@ -174,7 +173,7 @@ public class PlayQueueTestCase extends TestCase {
}
public void testUndo() throws Exception {
public void testUndo() {
PlayQueue playQueue = createPlaylist(0, "A", "B", "C");
playQueue.setIndex(2);
playQueue.undo();
@ -201,7 +200,7 @@ public class PlayQueueTestCase extends TestCase {
assertPlaylistEquals(playQueue, 0, "A", "B", "C");
}
public void testOrder() throws IOException {
public void testOrder() {
PlayQueue playQueue = new PlayQueue();
playQueue.addFiles(true, new TestMediaFile(2, "Artist A", "Album B"));
playQueue.addFiles(true, new TestMediaFile(1, "Artist C", "Album C"));
@ -248,7 +247,7 @@ public class PlayQueueTestCase extends TestCase {
}
}
private PlayQueue createPlaylist(int index, String... songs) throws Exception {
private PlayQueue createPlaylist(int index, String... songs) {
PlayQueue playQueue = new PlayQueue();
for (String song : songs) {
playQueue.addFiles(true, new TestMediaFile(song));

@ -32,11 +32,11 @@ public class SortableArtistTestCase extends TestCase {
private Collator collator;
@Override
public void setUp() throws Exception {
public void setUp() {
collator = Collator.getInstance(Locale.US);
}
public void testSorting() throws Exception {
public void testSorting() {
List<TestSortableArtist> artists = new ArrayList<TestSortableArtist>();
artists.add(new TestSortableArtist("ABBA"));
@ -52,7 +52,7 @@ public class SortableArtistTestCase extends TestCase {
assertEquals("[abba, Abba, ABBA, abc, ABC, acdc, ACDC, ACDC]", artists.toString());
}
public void testSortingWithAccents() throws Exception {
public void testSortingWithAccents() {
List<TestSortableArtist> artists = new ArrayList<TestSortableArtist>();
TestSortableArtist a1 = new TestSortableArtist("Sea");
@ -94,7 +94,7 @@ public class SortableArtistTestCase extends TestCase {
assertEquals("[Sea, Seb, SEB, S\u00e9b, Sed, See]", artists.toString());
}
public void testCollation() throws Exception {
public void testCollation() {
List<TestSortableArtist> artists = new ArrayList<TestSortableArtist>();
artists.add(new TestSortableArtist("p\u00e9ch\u00e9"));

@ -10,14 +10,12 @@ import org.mockito.*;
import org.mockito.runners.MockitoJUnitRunner;
import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.net.HttpURLConnection;
import java.net.URL;
import java.util.Date;
import java.util.List;
import static org.mockito.Matchers.any;
import static org.mockito.Mockito.*;
@RunWith(MockitoJUnitRunner.class)
@ -99,7 +97,7 @@ public class InternetRadioServiceTest {
InputStream mockURLInputStreamLarge = new InputStream() {
private long pos = 0;
@Override
public int read() throws IOException {
public int read() {
return TEST_STREAM_PLAYLIST_CONTENTS_2.charAt((int)(pos++ % TEST_STREAM_PLAYLIST_CONTENTS_2.length()));
}
};
@ -112,7 +110,7 @@ public class InternetRadioServiceTest {
InputStream mockURLInputStreamLarge2 = new InputStream() {
private long pos = 0;
@Override
public int read() throws IOException {
public int read() {
return 0x41;
}
};
@ -129,7 +127,7 @@ public class InternetRadioServiceTest {
}
@Test
public void testParseSimplePlaylist() throws Exception {
public void testParseSimplePlaylist() {
List<InternetRadioSource> radioSources = internetRadioService.getInternetRadioSources(radio1);
Assert.assertEquals(2, radioSources.size());
@ -138,7 +136,7 @@ public class InternetRadioServiceTest {
}
@Test
public void testRedirects() throws Exception {
public void testRedirects() {
List<InternetRadioSource> radioSources = internetRadioService.getInternetRadioSources(radioMove);
Assert.assertEquals(2, radioSources.size());
@ -147,7 +145,7 @@ public class InternetRadioServiceTest {
}
@Test
public void testLargeInput() throws Exception {
public void testLargeInput() {
List<InternetRadioSource> radioSources = internetRadioService.getInternetRadioSources(radioLarge);
// A PlaylistTooLarge exception is thrown internally, and the
@ -157,7 +155,7 @@ public class InternetRadioServiceTest {
}
@Test
public void testLargeInputURL() throws Exception {
public void testLargeInputURL() {
List<InternetRadioSource> radioSources = internetRadioService.getInternetRadioSources(radioLarge2);
// A PlaylistTooLarge exception is thrown internally, and the
@ -167,7 +165,7 @@ public class InternetRadioServiceTest {
}
@Test
public void testRedirectLoop() throws Exception {
public void testRedirectLoop() {
List<InternetRadioSource> radioSources = internetRadioService.getInternetRadioSources(radioMoveLoop);
// A PlaylistHasTooManyRedirects exception is thrown internally,

@ -40,7 +40,7 @@ public class JWTSecurityServiceTest {
@Test
public void addJWTToken() throws Exception {
public void addJWTToken() {
UriComponentsBuilder builder = UriComponentsBuilder.fromUriString(uriString);
String actualUri = service.addJWTToken(builder).build().toUriString();
String jwtToken = UriComponentsBuilder.fromUriString(actualUri).build().getQueryParams().getFirst(

@ -92,7 +92,7 @@ public class JukeboxServiceUnitTest {
}
@Test
public void updateJukebox() throws Exception {
public void updateJukebox() {
// When
jukeboxService.updateJukebox(legacyJukeboxPlayer, 0);
// Then
@ -140,7 +140,7 @@ public class JukeboxServiceUnitTest {
}
@Test
public void startWithJukeboxPlayer() throws Exception {
public void startWithJukeboxPlayer() {
// When
jukeboxService.start(jukeboxPlayer);
// Then
@ -148,7 +148,7 @@ public class JukeboxServiceUnitTest {
}
@Test
public void startWithLegacyJukeboxPlayer() throws Exception {
public void startWithLegacyJukeboxPlayer() {
// When
jukeboxService.start(legacyJukeboxPlayer);
@ -157,7 +157,7 @@ public class JukeboxServiceUnitTest {
}
@Test
public void playWithJukeboxPlayer() throws Exception {
public void playWithJukeboxPlayer() {
// When
jukeboxService.play(jukeboxPlayer);
// Then
@ -165,7 +165,7 @@ public class JukeboxServiceUnitTest {
}
@Test
public void playWithLegacyJukeboxPlayer() throws Exception {
public void playWithLegacyJukeboxPlayer() {
// When
jukeboxService.play(legacyJukeboxPlayer);
// Then
@ -173,7 +173,7 @@ public class JukeboxServiceUnitTest {
}
@Test
public void stopWithJukeboxPlayer() throws Exception {
public void stopWithJukeboxPlayer() {
// When
jukeboxService.stop(jukeboxPlayer);
// Then
@ -181,7 +181,7 @@ public class JukeboxServiceUnitTest {
}
@Test
public void stopWithLegacyJukeboxPlayer() throws Exception {
public void stopWithLegacyJukeboxPlayer() {
// When
jukeboxService.stop(legacyJukeboxPlayer);
// Then
@ -190,7 +190,7 @@ public class JukeboxServiceUnitTest {
@Test
public void skipWithJukeboxPlayer() throws Exception {
public void skipWithJukeboxPlayer() {
// When
jukeboxService.skip(jukeboxPlayer, 0, 1);
// Then
@ -198,7 +198,7 @@ public class JukeboxServiceUnitTest {
}
@Test
public void skipWithLegacyJukeboxPlayer() throws Exception {
public void skipWithLegacyJukeboxPlayer() {
// When
jukeboxService.skip(legacyJukeboxPlayer, 0, 1);
// Then

@ -47,7 +47,7 @@ public class LegacyDatabaseStartupTestCase {
public final SpringMethodRule springMethodRule = new SpringMethodRule();
@Test
public void testStartup() throws Exception {
public void testStartup() {
System.out.println("Successful startup");
}

@ -33,7 +33,7 @@ public class MusicIndexServiceTestCase extends TestCase {
private final MusicIndexService musicIndexService = new MusicIndexService();
public void testCreateIndexFromExpression() throws Exception {
public void testCreateIndexFromExpression() {
MusicIndex index = musicIndexService.createIndexFromExpression("A");
assertEquals("A", index.getIndex());
assertEquals(1, index.getPrefixes().size());
@ -52,7 +52,7 @@ public class MusicIndexServiceTestCase extends TestCase {
assertEquals("Z", index.getPrefixes().get(2));
}
public void testCreateIndexesFromExpression() throws Exception {
public void testCreateIndexesFromExpression() {
List<MusicIndex> indexes = musicIndexService.createIndexesFromExpression("A B The X-Z(XYZ)");
assertEquals(4, indexes.size());

@ -189,7 +189,7 @@ public class PlaylistServiceTestImport {
}
@Override
public Object answer(InvocationOnMock invocationOnMock) throws Throwable {
public Object answer(InvocationOnMock invocationOnMock) {
Playlist playlist = invocationOnMock.getArgumentAt(0, Playlist.class);
playlist.setId(id);
return null;
@ -199,7 +199,7 @@ public class PlaylistServiceTestImport {
private class MediaFileHasEverything implements Answer {
@Override
public Object answer(InvocationOnMock invocationOnMock) throws Throwable {
public Object answer(InvocationOnMock invocationOnMock) {
File file = invocationOnMock.getArgumentAt(0, File.class);
MediaFile mediaFile = new MediaFile();
mediaFile.setPath(file.getPath());

@ -36,7 +36,7 @@ public class SettingsServiceTestCase extends TestCase {
private SettingsService settingsService;
@Override
protected void setUp() throws Exception {
protected void setUp() {
String airsonicHome = TestCaseUtils.airsonicHomePathForTest();
System.setProperty("airsonic.home", airsonicHome);
new File(airsonicHome, "airsonic.properties").delete();

@ -29,7 +29,7 @@ import org.airsonic.player.domain.MediaFile;
*/
public class MediaFileTestCase extends TestCase {
public void testGetDurationAsString() throws Exception {
public void testGetDurationAsString() {
doTestGetDurationAsString(0, "0:00");
doTestGetDurationAsString(1, "0:01");
doTestGetDurationAsString(10, "0:10");

@ -32,7 +32,7 @@ import java.io.File;
*/
public class MetaDataParserTestCase extends TestCase {
public void testRemoveTrackNumberFromTitle() throws Exception {
public void testRemoveTrackNumberFromTitle() {
MetaDataParser parser = new MetaDataParser() {
public MetaData getRawMetaData(File file) {

@ -64,7 +64,7 @@ public class IndexManagerTestCase extends AbstractAirsonicHomeTest {
}
@Before
public void setup() throws Exception {
public void setup() {
populateDatabaseOnlyOnce();
}
@ -84,7 +84,7 @@ public class IndexManagerTestCase extends AbstractAirsonicHomeTest {
ResourceLoader resourceLoader;
@Test
public void testExpunge() throws InterruptedException {
public void testExpunge() {
SearchCriteria criteria = new SearchCriteria();
criteria.setOffset(0);

@ -40,7 +40,7 @@ public class SearchServiceSpecialGenreTestCase extends AbstractAirsonicHomeTest
}
@Before
public void setup() throws Exception {
public void setup() {
populateDatabaseOnlyOnce();
}

@ -51,7 +51,7 @@ public class SearchServiceSpecialPathTestCase extends AbstractAirsonicHomeTest {
}
@Before
public void setup() throws Exception {
public void setup() {
populateDatabaseOnlyOnce();
}

@ -41,7 +41,7 @@ public class SearchServiceStartWithStopwardsTestCase extends AbstractAirsonicHom
}
@Before
public void setup() throws Exception {
public void setup() {
populateDatabaseOnlyOnce();
}

Some files were not shown because too many files have changed in this diff Show More

Loading…
Cancel
Save