diff --git a/airsonic-main/src/main/java/org/airsonic/player/ajax/NowPlayingService.java b/airsonic-main/src/main/java/org/airsonic/player/ajax/NowPlayingService.java index 51ec6dc7..302b1aa4 100644 --- a/airsonic-main/src/main/java/org/airsonic/player/ajax/NowPlayingService.java +++ b/airsonic-main/src/main/java/org/airsonic/player/ajax/NowPlayingService.java @@ -78,7 +78,7 @@ public class NowPlayingService { * * @return Details about what all users are currently playing. */ - public List getNowPlaying() throws Exception { + public List getNowPlaying() { try { return convert(statusService.getPlayStatuses()); } catch (Throwable x) { diff --git a/airsonic-main/src/main/java/org/airsonic/player/ajax/PlayQueueService.java b/airsonic-main/src/main/java/org/airsonic/player/ajax/PlayQueueService.java index 1c461001..5a480a3a 100644 --- a/airsonic-main/src/main/java/org/airsonic/player/ajax/PlayQueueService.java +++ b/airsonic-main/src/main/java/org/airsonic/player/ajax/PlayQueueService.java @@ -423,7 +423,7 @@ public class PlayQueueService { return doPlay(request, player, songs).setStartPlayerAt(0); } - private PlayQueueInfo doPlay(HttpServletRequest request, Player player, List files) throws Exception { + private PlayQueueInfo doPlay(HttpServletRequest request, Player player, List 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 files = new ArrayList(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 convertInternetRadio(HttpServletRequest request, Player player) throws Exception { + private List convertInternetRadio(HttpServletRequest request, Player player) { PlayQueue playQueue = player.getPlayQueue(); InternetRadio radio = playQueue.getInternetRadio(); diff --git a/airsonic-main/src/main/java/org/airsonic/player/cache/CacheFactory.java b/airsonic-main/src/main/java/org/airsonic/player/cache/CacheFactory.java index e968474e..c2f05a19 100644 --- a/airsonic-main/src/main/java/org/airsonic/player/cache/CacheFactory.java +++ b/airsonic-main/src/main/java/org/airsonic/player/cache/CacheFactory.java @@ -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. diff --git a/airsonic-main/src/main/java/org/airsonic/player/controller/AdvancedSettingsController.java b/airsonic-main/src/main/java/org/airsonic/player/controller/AdvancedSettingsController.java index d1a56b66..3e5bd1f4 100644 --- a/airsonic-main/src/main/java/org/airsonic/player/controller/AdvancedSettingsController.java +++ b/airsonic-main/src/main/java/org/airsonic/player/controller/AdvancedSettingsController.java @@ -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); diff --git a/airsonic-main/src/main/java/org/airsonic/player/controller/AllmusicController.java b/airsonic-main/src/main/java/org/airsonic/player/controller/AllmusicController.java index d496580b..7182a98f 100644 --- a/airsonic-main/src/main/java/org/airsonic/player/controller/AllmusicController.java +++ b/airsonic-main/src/main/java/org/airsonic/player/controller/AllmusicController.java @@ -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; diff --git a/airsonic-main/src/main/java/org/airsonic/player/controller/AutoCoverDemo.java b/airsonic-main/src/main/java/org/airsonic/player/controller/AutoCoverDemo.java index 14fd31c6..1a987cf6 100644 --- a/airsonic-main/src/main/java/org/airsonic/player/controller/AutoCoverDemo.java +++ b/airsonic-main/src/main/java/org/airsonic/player/controller/AutoCoverDemo.java @@ -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)); diff --git a/airsonic-main/src/main/java/org/airsonic/player/controller/AvatarUploadController.java b/airsonic-main/src/main/java/org/airsonic/player/controller/AvatarUploadController.java index 0370888b..94dcdec8 100644 --- a/airsonic-main/src/main/java/org/airsonic/player/controller/AvatarUploadController.java +++ b/airsonic-main/src/main/java/org/airsonic/player/controller/AvatarUploadController.java @@ -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 map) throws IOException { + private void createAvatar(String fileName, byte[] data, String username, Map map) { BufferedImage image; try { diff --git a/airsonic-main/src/main/java/org/airsonic/player/controller/DLNASettingsController.java b/airsonic-main/src/main/java/org/airsonic/player/controller/DLNASettingsController.java index dc764220..d0b9c686 100644 --- a/airsonic-main/src/main/java/org/airsonic/player/controller/DLNASettingsController.java +++ b/airsonic-main/src/main/java/org/airsonic/player/controller/DLNASettingsController.java @@ -51,7 +51,7 @@ public class DLNASettingsController { private SettingsService settingsService; @GetMapping - public String handleGet(Model model) throws Exception { + public String handleGet(Model model) { Map map = new HashMap(); @@ -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"; diff --git a/airsonic-main/src/main/java/org/airsonic/player/controller/DatabaseSettingsController.java b/airsonic-main/src/main/java/org/airsonic/player/controller/DatabaseSettingsController.java index 2cbddfd6..e4e392bb 100644 --- a/airsonic-main/src/main/java/org/airsonic/player/controller/DatabaseSettingsController.java +++ b/airsonic-main/src/main/java/org/airsonic/player/controller/DatabaseSettingsController.java @@ -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()); diff --git a/airsonic-main/src/main/java/org/airsonic/player/controller/DownloadController.java b/airsonic-main/src/main/java/org/airsonic/player/controller/DownloadController.java index 6c2d3c31..3d8a0926 100644 --- a/airsonic-main/src/main/java/org/airsonic/player/controller/DownloadController.java +++ b/airsonic-main/src/main/java/org/airsonic/player/controller/DownloadController.java @@ -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'}; diff --git a/airsonic-main/src/main/java/org/airsonic/player/controller/ExternalPlayerController.java b/airsonic-main/src/main/java/org/airsonic/player/controller/ExternalPlayerController.java index 0d731ff8..48ce3633 100644 --- a/airsonic-main/src/main/java/org/airsonic/player/controller/ExternalPlayerController.java +++ b/airsonic-main/src/main/java/org/airsonic/player/controller/ExternalPlayerController.java @@ -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 getSongs(HttpServletRequest request, Share share, Player player) throws IOException { + private List getSongs(HttpServletRequest request, Share share, Player player) { Date expires = null; Authentication authentication = SecurityContextHolder.getContext().getAuthentication(); if (authentication instanceof JWTAuthenticationToken) { diff --git a/airsonic-main/src/main/java/org/airsonic/player/controller/GeneralSettingsController.java b/airsonic-main/src/main/java/org/airsonic/player/controller/GeneralSettingsController.java index 5ce194c4..052f96cb 100644 --- a/airsonic-main/src/main/java/org/airsonic/player/controller/GeneralSettingsController.java +++ b/airsonic-main/src/main/java/org/airsonic/player/controller/GeneralSettingsController.java @@ -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]; diff --git a/airsonic-main/src/main/java/org/airsonic/player/controller/HelpController.java b/airsonic-main/src/main/java/org/airsonic/player/controller/HelpController.java index 80245111..784ed935 100644 --- a/airsonic-main/src/main/java/org/airsonic/player/controller/HelpController.java +++ b/airsonic-main/src/main/java/org/airsonic/player/controller/HelpController.java @@ -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 map = new HashMap<>(); if (versionService.isNewFinalVersionAvailable()) { diff --git a/airsonic-main/src/main/java/org/airsonic/player/controller/HomeController.java b/airsonic-main/src/main/java/org/airsonic/player/controller/HomeController.java index c324f253..39fa2ada 100644 --- a/airsonic-main/src/main/java/org/airsonic/player/controller/HomeController.java +++ b/airsonic-main/src/main/java/org/airsonic/player/controller/HomeController.java @@ -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 getNewest(int offset, int count, List musicFolders) throws IOException { + private List getNewest(int offset, int count, List musicFolders) { List 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 getStarred(int offset, int count, String username, List musicFolders) throws IOException { + private List getStarred(int offset, int count, String username, List musicFolders) { List 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 getRandom(int count, List musicFolders) throws IOException { + private List getRandom(int count, List musicFolders) { List 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 getAlphabetical(int offset, int count, boolean byArtist, List musicFolders) throws IOException { + private List getAlphabetical(int offset, int count, boolean byArtist, List musicFolders) { List result = new ArrayList<>(); for (MediaFile file : mediaFileService.getAlphabeticalAlbums(offset, count, byArtist, musicFolders)) { result.add(createAlbum(file)); diff --git a/airsonic-main/src/main/java/org/airsonic/player/controller/ImportPlaylistController.java b/airsonic-main/src/main/java/org/airsonic/player/controller/ImportPlaylistController.java index 8e4e0ba7..5e055245 100644 --- a/airsonic-main/src/main/java/org/airsonic/player/controller/ImportPlaylistController.java +++ b/airsonic-main/src/main/java/org/airsonic/player/controller/ImportPlaylistController.java @@ -58,7 +58,7 @@ public class ImportPlaylistController { @PostMapping protected String handlePost(RedirectAttributes redirectAttributes, HttpServletRequest request - ) throws Exception { + ) { Map map = new HashMap(); try { diff --git a/airsonic-main/src/main/java/org/airsonic/player/controller/InternetRadioSettingsController.java b/airsonic-main/src/main/java/org/airsonic/player/controller/InternetRadioSettingsController.java index b9fa219a..6a5e12b6 100644 --- a/airsonic-main/src/main/java/org/airsonic/player/controller/InternetRadioSettingsController.java +++ b/airsonic-main/src/main/java/org/airsonic/player/controller/InternetRadioSettingsController.java @@ -50,7 +50,7 @@ public class InternetRadioSettingsController { private SettingsService settingsService; @GetMapping - public String doGet(Model model) throws Exception { + public String doGet(Model model) { Map 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 map = new HashMap<>(); diff --git a/airsonic-main/src/main/java/org/airsonic/player/controller/JAXBWriter.java b/airsonic-main/src/main/java/org/airsonic/player/controller/JAXBWriter.java index 33aa197f..5e0bd122 100644 --- a/airsonic-main/src/main/java/org/airsonic/player/controller/JAXBWriter.java +++ b/airsonic-main/src/main/java/org/airsonic/player/controller/JAXBWriter.java @@ -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); diff --git a/airsonic-main/src/main/java/org/airsonic/player/controller/LoginController.java b/airsonic-main/src/main/java/org/airsonic/player/controller/LoginController.java index 4569429f..6b2cf003 100644 --- a/airsonic-main/src/main/java/org/airsonic/player/controller/LoginController.java +++ b/airsonic-main/src/main/java/org/airsonic/player/controller/LoginController.java @@ -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"); diff --git a/airsonic-main/src/main/java/org/airsonic/player/controller/LyricsController.java b/airsonic-main/src/main/java/org/airsonic/player/controller/LyricsController.java index 99153217..d5720837 100644 --- a/airsonic-main/src/main/java/org/airsonic/player/controller/LyricsController.java +++ b/airsonic-main/src/main/java/org/airsonic/player/controller/LyricsController.java @@ -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 map = new HashMap<>(); map.put("artist", request.getParameter("artist")); diff --git a/airsonic-main/src/main/java/org/airsonic/player/controller/M3UController.java b/airsonic-main/src/main/java/org/airsonic/player/controller/M3UController.java index 0da153c3..a65ced49 100644 --- a/airsonic-main/src/main/java/org/airsonic/player/controller/M3UController.java +++ b/airsonic-main/src/main/java/org/airsonic/player/controller/M3UController.java @@ -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(); diff --git a/airsonic-main/src/main/java/org/airsonic/player/controller/MainController.java b/airsonic-main/src/main/java/org/airsonic/player/controller/MainController.java index e0a0fc0b..45e27f81 100644 --- a/airsonic-main/src/main/java/org/airsonic/player/controller/MainController.java +++ b/airsonic-main/src/main/java/org/airsonic/player/controller/MainController.java @@ -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 getMultiFolderChildren(List mediaFiles) throws IOException { + private List getMultiFolderChildren(List mediaFiles) { SortedSet 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 getAncestors(MediaFile dir) throws IOException { + private List getAncestors(MediaFile dir) { LinkedList result = new LinkedList<>(); try { diff --git a/airsonic-main/src/main/java/org/airsonic/player/controller/MusicFolderSettingsController.java b/airsonic-main/src/main/java/org/airsonic/player/controller/MusicFolderSettingsController.java index c8f5fafa..ec675ab6 100644 --- a/airsonic-main/src/main/java/org/airsonic/player/controller/MusicFolderSettingsController.java +++ b/airsonic-main/src/main/java/org/airsonic/player/controller/MusicFolderSettingsController.java @@ -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()) { diff --git a/airsonic-main/src/main/java/org/airsonic/player/controller/PasswordSettingsController.java b/airsonic-main/src/main/java/org/airsonic/player/controller/PasswordSettingsController.java index c8ac0175..740ac68a 100644 --- a/airsonic-main/src/main/java/org/airsonic/player/controller/PasswordSettingsController.java +++ b/airsonic-main/src/main/java/org/airsonic/player/controller/PasswordSettingsController.java @@ -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()); diff --git a/airsonic-main/src/main/java/org/airsonic/player/controller/PersonalSettingsController.java b/airsonic-main/src/main/java/org/airsonic/player/controller/PersonalSettingsController.java index b5167e67..56f3036b 100644 --- a/airsonic-main/src/main/java/org/airsonic/player/controller/PersonalSettingsController.java +++ b/airsonic-main/src/main/java/org/airsonic/player/controller/PersonalSettingsController.java @@ -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; diff --git a/airsonic-main/src/main/java/org/airsonic/player/controller/PlayerSettingsController.java b/airsonic-main/src/main/java/org/airsonic/player/controller/PlayerSettingsController.java index a19456f0..26e1a803 100644 --- a/airsonic-main/src/main/java/org/airsonic/player/controller/PlayerSettingsController.java +++ b/airsonic-main/src/main/java/org/airsonic/player/controller/PlayerSettingsController.java @@ -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()); diff --git a/airsonic-main/src/main/java/org/airsonic/player/controller/PlaylistsController.java b/airsonic-main/src/main/java/org/airsonic/player/controller/PlaylistsController.java index b84e94c5..6b8ade38 100644 --- a/airsonic-main/src/main/java/org/airsonic/player/controller/PlaylistsController.java +++ b/airsonic-main/src/main/java/org/airsonic/player/controller/PlaylistsController.java @@ -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 map = new HashMap<>(); User user = securityService.getCurrentUser(request); diff --git a/airsonic-main/src/main/java/org/airsonic/player/controller/PodcastChannelsController.java b/airsonic-main/src/main/java/org/airsonic/player/controller/PodcastChannelsController.java index 8411496f..3f86fcab 100644 --- a/airsonic-main/src/main/java/org/airsonic/player/controller/PodcastChannelsController.java +++ b/airsonic-main/src/main/java/org/airsonic/player/controller/PodcastChannelsController.java @@ -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 map = new HashMap<>(); ModelAndView result = new ModelAndView(); diff --git a/airsonic-main/src/main/java/org/airsonic/player/controller/PodcastController.java b/airsonic-main/src/main/java/org/airsonic/player/controller/PodcastController.java index 677aad89..813c5e52 100644 --- a/airsonic-main/src/main/java/org/airsonic/player/controller/PodcastController.java +++ b/airsonic-main/src/main/java/org/airsonic/player/controller/PodcastController.java @@ -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); diff --git a/airsonic-main/src/main/java/org/airsonic/player/controller/PodcastSettingsController.java b/airsonic-main/src/main/java/org/airsonic/player/controller/PodcastSettingsController.java index f4cd43be..4090205d 100644 --- a/airsonic-main/src/main/java/org/airsonic/player/controller/PodcastSettingsController.java +++ b/airsonic-main/src/main/java/org/airsonic/player/controller/PodcastSettingsController.java @@ -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())); diff --git a/airsonic-main/src/main/java/org/airsonic/player/controller/RecoverController.java b/airsonic-main/src/main/java/org/airsonic/player/controller/RecoverController.java index 28dc70ae..b8d5dfab 100644 --- a/airsonic-main/src/main/java/org/airsonic/player/controller/RecoverController.java +++ b/airsonic-main/src/main/java/org/airsonic/player/controller/RecoverController.java @@ -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 map = new HashMap(); String usernameOrEmail = StringUtils.trimToNull(request.getParameter("usernameOrEmail")); diff --git a/airsonic-main/src/main/java/org/airsonic/player/controller/RightController.java b/airsonic-main/src/main/java/org/airsonic/player/controller/RightController.java index b198bc8c..7b68ac15 100644 --- a/airsonic-main/src/main/java/org/airsonic/player/controller/RightController.java +++ b/airsonic-main/src/main/java/org/airsonic/player/controller/RightController.java @@ -51,7 +51,7 @@ public class RightController { private VersionService versionService; @GetMapping - protected ModelAndView handleRequestInternal(HttpServletRequest request) throws Exception { + protected ModelAndView handleRequestInternal(HttpServletRequest request) { Map map = new HashMap<>(); ModelAndView result = new ModelAndView("right"); diff --git a/airsonic-main/src/main/java/org/airsonic/player/controller/SearchController.java b/airsonic-main/src/main/java/org/airsonic/player/controller/SearchController.java index 49c06dae..231f05f0 100644 --- a/airsonic-main/src/main/java/org/airsonic/player/controller/SearchController.java +++ b/airsonic-main/src/main/java/org/airsonic/player/controller/SearchController.java @@ -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()); } diff --git a/airsonic-main/src/main/java/org/airsonic/player/controller/SettingsController.java b/airsonic-main/src/main/java/org/airsonic/player/controller/SettingsController.java index bdbb8901..80a102e5 100644 --- a/airsonic-main/src/main/java/org/airsonic/player/controller/SettingsController.java +++ b/airsonic-main/src/main/java/org/airsonic/player/controller/SettingsController.java @@ -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); diff --git a/airsonic-main/src/main/java/org/airsonic/player/controller/ShareSettingsController.java b/airsonic-main/src/main/java/org/airsonic/player/controller/ShareSettingsController.java index f1dd43e5..304be08a 100644 --- a/airsonic-main/src/main/java/org/airsonic/player/controller/ShareSettingsController.java +++ b/airsonic-main/src/main/java/org/airsonic/player/controller/ShareSettingsController.java @@ -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 map = new HashMap(); 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); diff --git a/airsonic-main/src/main/java/org/airsonic/player/controller/SonosSettingsController.java b/airsonic-main/src/main/java/org/airsonic/player/controller/SonosSettingsController.java index 9cfaf424..0919cb76 100644 --- a/airsonic-main/src/main/java/org/airsonic/player/controller/SonosSettingsController.java +++ b/airsonic-main/src/main/java/org/airsonic/player/controller/SonosSettingsController.java @@ -51,7 +51,7 @@ public class SonosSettingsController { private SonosService sonosService; @GetMapping - public String doGet(Model model) throws Exception { + public String doGet(Model model) { Map map = new HashMap(); @@ -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); diff --git a/airsonic-main/src/main/java/org/airsonic/player/controller/StatusController.java b/airsonic-main/src/main/java/org/airsonic/player/controller/StatusController.java index cc82965c..bd405813 100644 --- a/airsonic-main/src/main/java/org/airsonic/player/controller/StatusController.java +++ b/airsonic-main/src/main/java/org/airsonic/player/controller/StatusController.java @@ -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 map = new HashMap<>(); List streamStatuses = statusService.getAllStreamStatuses(); diff --git a/airsonic-main/src/main/java/org/airsonic/player/controller/SubsonicRESTController.java b/airsonic-main/src/main/java/org/airsonic/player/controller/SubsonicRESTController.java index 723d41d9..cde759ee 100644 --- a/airsonic-main/src/main/java/org/airsonic/player/controller/SubsonicRESTController.java +++ b/airsonic-main/src/main/java/org/airsonic/player/controller/SubsonicRESTController.java @@ -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 getVideoInfo() throws Exception { + public ResponseEntity 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); } diff --git a/airsonic-main/src/main/java/org/airsonic/player/controller/TopController.java b/airsonic-main/src/main/java/org/airsonic/player/controller/TopController.java index 6fdd108c..49aed542 100644 --- a/airsonic-main/src/main/java/org/airsonic/player/controller/TopController.java +++ b/airsonic-main/src/main/java/org/airsonic/player/controller/TopController.java @@ -50,7 +50,7 @@ public class TopController { private SecurityService securityService; @GetMapping - protected ModelAndView handleRequestInternal(HttpServletRequest request) throws Exception { + protected ModelAndView handleRequestInternal(HttpServletRequest request) { Map map = new HashMap<>(); User user = securityService.getCurrentUser(request); diff --git a/airsonic-main/src/main/java/org/airsonic/player/controller/TranscodingSettingsController.java b/airsonic-main/src/main/java/org/airsonic/player/controller/TranscodingSettingsController.java index d6f4662c..671e7cbf 100644 --- a/airsonic-main/src/main/java/org/airsonic/player/controller/TranscodingSettingsController.java +++ b/airsonic-main/src/main/java/org/airsonic/player/controller/TranscodingSettingsController.java @@ -51,7 +51,7 @@ public class TranscodingSettingsController { private SettingsService settingsService; @GetMapping - public String doGet(Model model) throws Exception { + public String doGet(Model model) { Map map = new HashMap(); @@ -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); diff --git a/airsonic-main/src/main/java/org/airsonic/player/controller/UploadController.java b/airsonic-main/src/main/java/org/airsonic/player/controller/UploadController.java index 3672e672..5256fb7d 100644 --- a/airsonic-main/src/main/java/org/airsonic/player/controller/UploadController.java +++ b/airsonic-main/src/main/java/org/airsonic/player/controller/UploadController.java @@ -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 map = new HashMap<>(); List uploadedFiles = new ArrayList<>(); diff --git a/airsonic-main/src/main/java/org/airsonic/player/controller/UserSettingsController.java b/airsonic-main/src/main/java/org/airsonic/player/controller/UserSettingsController.java index 5135b9d2..02038197 100644 --- a/airsonic-main/src/main/java/org/airsonic/player/controller/UserSettingsController.java +++ b/airsonic-main/src/main/java/org/airsonic/player/controller/UserSettingsController.java @@ -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()) { diff --git a/airsonic-main/src/main/java/org/airsonic/player/domain/PlayQueue.java b/airsonic-main/src/main/java/org/airsonic/player/domain/PlayQueue.java index a154a9c0..f6c05cd5 100644 --- a/airsonic-main/src/main/java/org/airsonic/player/domain/PlayQueue.java +++ b/airsonic-main/src/main/java/org/airsonic/player/domain/PlayQueue.java @@ -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 mediaFiles, int index) throws IOException { + public synchronized void addFilesAt(Iterable 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 mediaFiles) throws IOException { + public synchronized void addFiles(boolean append, Iterable 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)); } diff --git a/airsonic-main/src/main/java/org/airsonic/player/filter/MetricsFilter.java b/airsonic-main/src/main/java/org/airsonic/player/filter/MetricsFilter.java index 3b877d14..ecd01534 100644 --- a/airsonic-main/src/main/java/org/airsonic/player/filter/MetricsFilter.java +++ b/airsonic-main/src/main/java/org/airsonic/player/filter/MetricsFilter.java @@ -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 diff --git a/airsonic-main/src/main/java/org/airsonic/player/filter/RESTFilter.java b/airsonic-main/src/main/java/org/airsonic/player/filter/RESTFilter.java index 53cad862..686f079e 100644 --- a/airsonic-main/src/main/java/org/airsonic/player/filter/RESTFilter.java +++ b/airsonic-main/src/main/java/org/airsonic/player/filter/RESTFilter.java @@ -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", "*"); diff --git a/airsonic-main/src/main/java/org/airsonic/player/io/PlayQueueInputStream.java b/airsonic-main/src/main/java/org/airsonic/player/io/PlayQueueInputStream.java index af799c62..963dc582 100644 --- a/airsonic-main/src/main/java/org/airsonic/player/io/PlayQueueInputStream.java +++ b/airsonic-main/src/main/java/org/airsonic/player/io/PlayQueueInputStream.java @@ -132,7 +132,7 @@ public class PlayQueueInputStream extends InputStream { } } - private void populateRandomPlaylist(PlayQueue playQueue) throws IOException { + private void populateRandomPlaylist(PlayQueue playQueue) { List files = searchService.getRandomSongs(playQueue.getRandomSearchCriteria()); playQueue.addFiles(false, files); LOG.info("Recreated random playlist with " + playQueue.size() + " songs."); diff --git a/airsonic-main/src/main/java/org/airsonic/player/io/ShoutCastOutputStream.java b/airsonic-main/src/main/java/org/airsonic/player/io/ShoutCastOutputStream.java index 59437965..056ce4d9 100644 --- a/airsonic-main/src/main/java/org/airsonic/player/io/ShoutCastOutputStream.java +++ b/airsonic-main/src/main/java/org/airsonic/player/io/ShoutCastOutputStream.java @@ -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]; - } + previousStreamTitle = streamTitle; + bytes = createStreamTitle(streamTitle); } // 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("'", ""); diff --git a/airsonic-main/src/main/java/org/airsonic/player/io/TranscodeInputStream.java b/airsonic-main/src/main/java/org/airsonic/player/io/TranscodeInputStream.java index e5b9b41f..1439e66e 100644 --- a/airsonic-main/src/main/java/org/airsonic/player/io/TranscodeInputStream.java +++ b/airsonic-main/src/main/java/org/airsonic/player/io/TranscodeInputStream.java @@ -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); diff --git a/airsonic-main/src/main/java/org/airsonic/player/security/JWTRequestParameterProcessingFilter.java b/airsonic-main/src/main/java/org/airsonic/player/security/JWTRequestParameterProcessingFilter.java index 3ef2b209..faf59f68 100644 --- a/airsonic-main/src/main/java/org/airsonic/player/security/JWTRequestParameterProcessingFilter.java +++ b/airsonic-main/src/main/java/org/airsonic/player/security/JWTRequestParameterProcessingFilter.java @@ -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 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) { } diff --git a/airsonic-main/src/main/java/org/airsonic/player/security/RESTRequestParameterProcessingFilter.java b/airsonic-main/src/main/java/org/airsonic/player/security/RESTRequestParameterProcessingFilter.java index 40e7be6f..3a3191d4 100644 --- a/airsonic-main/src/main/java/org/airsonic/player/security/RESTRequestParameterProcessingFilter.java +++ b/airsonic-main/src/main/java/org/airsonic/player/security/RESTRequestParameterProcessingFilter.java @@ -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() { diff --git a/airsonic-main/src/main/java/org/airsonic/player/service/InternetRadioService.java b/airsonic-main/src/main/java/org/airsonic/player/service/InternetRadioService.java index 36a650c3..458d56b5 100644 --- a/airsonic-main/src/main/java/org/airsonic/player/service/InternetRadioService.java +++ b/airsonic-main/src/main/java/org/airsonic/player/service/InternetRadioService.java @@ -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) { } }); diff --git a/airsonic-main/src/main/java/org/airsonic/player/service/JukeboxJavaService.java b/airsonic-main/src/main/java/org/airsonic/player/service/JukeboxJavaService.java index f204522e..11cc8ffa 100644 --- a/airsonic-main/src/main/java/org/airsonic/player/service/JukeboxJavaService.java +++ b/airsonic-main/src/main/java/org/airsonic/player/service/JukeboxJavaService.java @@ -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); diff --git a/airsonic-main/src/main/java/org/airsonic/player/service/JukeboxLegacySubsonicService.java b/airsonic-main/src/main/java/org/airsonic/player/service/JukeboxLegacySubsonicService.java index ac974924..3592fb8c 100644 --- a/airsonic-main/src/main/java/org/airsonic/player/service/JukeboxLegacySubsonicService.java +++ b/airsonic-main/src/main/java/org/airsonic/player/service/JukeboxLegacySubsonicService.java @@ -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."); diff --git a/airsonic-main/src/main/java/org/airsonic/player/service/JukeboxService.java b/airsonic-main/src/main/java/org/airsonic/player/service/JukeboxService.java index defe2772..2c93455a 100644 --- a/airsonic-main/src/main/java/org/airsonic/player/service/JukeboxService.java +++ b/airsonic-main/src/main/java/org/airsonic/player/service/JukeboxService.java @@ -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); diff --git a/airsonic-main/src/main/java/org/airsonic/player/service/LastFmService.java b/airsonic-main/src/main/java/org/airsonic/player/service/LastFmService.java index 5999b1e8..01326847 100644 --- a/airsonic-main/src/main/java/org/airsonic/player/service/LastFmService.java +++ b/airsonic-main/src/main/java/org/airsonic/player/service/LastFmService.java @@ -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 getSimilarSongs(org.airsonic.player.domain.Artist artist, int count, - List musicFolders) throws IOException { + List musicFolders) { List similarSongs = new ArrayList(mediaFileDao.getSongsByArtist(artist.getName(), 0, 1000)); for (org.airsonic.player.domain.Artist similarArtist : getSimilarArtists(artist, 100, false, musicFolders)) { diff --git a/airsonic-main/src/main/java/org/airsonic/player/service/MediaFileService.java b/airsonic-main/src/main/java/org/airsonic/player/service/MediaFileService.java index 0984fe55..9ebbc6a8 100644 --- a/airsonic-main/src/main/java/org/airsonic/player/service/MediaFileService.java +++ b/airsonic-main/src/main/java/org/airsonic/player/service/MediaFileService.java @@ -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,13 +541,9 @@ 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); + File coverArt = findCoverArt(children); + if (coverArt != null) { + mediaFile.setCoverArtPath(coverArt.getPath()); } } else { @@ -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(".")) { diff --git a/airsonic-main/src/main/java/org/airsonic/player/service/MusicIndexService.java b/airsonic-main/src/main/java/org/airsonic/player/service/MusicIndexService.java index f603f33e..dd6cdaf7 100644 --- a/airsonic-main/src/main/java/org/airsonic/player/service/MusicIndexService.java +++ b/airsonic-main/src/main/java/org/airsonic/player/service/MusicIndexService.java @@ -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> getIndexedArtists(List folders, boolean refresh) throws IOException { + public SortedMap> getIndexedArtists(List folders, boolean refresh) { List artists = createSortableArtists(folders, refresh); return sortArtists(artists); } - public SortedMap> getIndexedArtists(List artists) throws IOException { + public SortedMap> getIndexedArtists(List artists) { List sortableArtists = createSortableArtists(artists); return sortArtists(sortableArtists); } - public MusicFolderContent getMusicFolderContent(List musicFoldersToUse, boolean refresh) throws Exception { + public MusicFolderContent getMusicFolderContent(List musicFoldersToUse, boolean refresh) { SortedMap> indexedArtists = getIndexedArtists(musicFoldersToUse, refresh); List singleSongs = getSingleSongs(musicFoldersToUse, refresh); return new MusicFolderContent(indexedArtists, singleSongs); } - private List getSingleSongs(List folders, boolean refresh) throws IOException { + private List getSingleSongs(List folders, boolean refresh) { List result = new ArrayList(); for (MusicFolder folder : folders) { MediaFile parent = mediaFileService.getMediaFile(folder.getPath(), !refresh); @@ -157,7 +155,7 @@ public class MusicIndexService { return result; } - private List createSortableArtists(List folders, boolean refresh) throws IOException { + private List createSortableArtists(List folders, boolean refresh) { String[] ignoredArticles = settingsService.getIgnoredArticlesAsArray(); String[] shortcuts = settingsService.getShortcutsAsArray(); SortedMap artistMap = new TreeMap(); diff --git a/airsonic-main/src/main/java/org/airsonic/player/service/PlaylistService.java b/airsonic-main/src/main/java/org/airsonic/player/service/PlaylistService.java index ea96d33a..86cc8b82 100644 --- a/airsonic-main/src/main/java/org/airsonic/player/service/PlaylistService.java +++ b/airsonic-main/src/main/java/org/airsonic/player/service/PlaylistService.java @@ -261,7 +261,7 @@ public class PlaylistService { } } - private void doImportPlaylists() throws Exception { + private void doImportPlaylists() { String playlistFolderPath = settingsService.getPlaylistFolder(); if (playlistFolderPath == null) { return; diff --git a/airsonic-main/src/main/java/org/airsonic/player/service/ShareService.java b/airsonic-main/src/main/java/org/airsonic/player/service/ShareService.java index e7fc3e90..34e08d51 100644 --- a/airsonic-main/src/main/java/org/airsonic/player/service/ShareService.java +++ b/airsonic-main/src/main/java/org/airsonic/player/service/ShareService.java @@ -96,7 +96,7 @@ public class ShareService { return result; } - public Share createShare(HttpServletRequest request, List files) throws Exception { + public Share createShare(HttpServletRequest request, List files) { Share share = new Share(); share.setName(RandomStringUtils.random(5, "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ")); diff --git a/airsonic-main/src/main/java/org/airsonic/player/service/UPnPService.java b/airsonic-main/src/main/java/org/airsonic/player/service/UPnPService.java index 70928c25..2c0cfbc6 100644 --- a/airsonic-main/src/main/java/org/airsonic/player/service/UPnPService.java +++ b/airsonic-main/src/main/java/org/airsonic/player/service/UPnPService.java @@ -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(contentDirectoryservice) { @Override - protected CustomContentDirectory createServiceInstance() throws Exception { + protected CustomContentDirectory createServiceInstance() { return dispatchingContentDirectory; } }); @@ -180,7 +180,7 @@ public class UPnPService { LocalService connetionManagerService = new AnnotationLocalServiceBinder().read(ConnectionManagerService.class); connetionManagerService.setManager(new DefaultServiceManager(connetionManagerService) { @Override - protected ConnectionManagerService createServiceInstance() throws Exception { + protected ConnectionManagerService createServiceInstance() { return new ConnectionManagerService(protocols, null); } }); diff --git a/airsonic-main/src/main/java/org/airsonic/player/service/jukebox/PlayerTest.java b/airsonic-main/src/main/java/org/airsonic/player/service/jukebox/PlayerTest.java index 78200b29..5f1179ac 100644 --- a/airsonic-main/src/main/java/org/airsonic/player/service/jukebox/PlayerTest.java +++ b/airsonic-main/src/main/java/org/airsonic/player/service/jukebox/PlayerTest.java @@ -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(); } diff --git a/airsonic-main/src/main/java/org/airsonic/player/service/playlist/DefaultPlaylistImportHandler.java b/airsonic-main/src/main/java/org/airsonic/player/service/playlist/DefaultPlaylistImportHandler.java index a56b5762..c34555b5 100644 --- a/airsonic-main/src/main/java/org/airsonic/player/service/playlist/DefaultPlaylistImportHandler.java +++ b/airsonic-main/src/main/java/org/airsonic/player/service/playlist/DefaultPlaylistImportHandler.java @@ -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) { } }); diff --git a/airsonic-main/src/main/java/org/airsonic/player/service/playlist/XspfPlaylistExportHandler.java b/airsonic-main/src/main/java/org/airsonic/player/service/playlist/XspfPlaylistExportHandler.java index 24e4dbb4..6a3eabb5 100644 --- a/airsonic-main/src/main/java/org/airsonic/player/service/playlist/XspfPlaylistExportHandler.java +++ b/airsonic-main/src/main/java/org/airsonic/player/service/playlist/XspfPlaylistExportHandler.java @@ -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); } diff --git a/airsonic-main/src/main/java/org/airsonic/player/service/upnp/AlbumUpnpProcessor.java b/airsonic-main/src/main/java/org/airsonic/player/service/upnp/AlbumUpnpProcessor.java index 5ffe9737..6a0d3198 100644 --- a/airsonic-main/src/main/java/org/airsonic/player/service/upnp/AlbumUpnpProcessor.java +++ b/airsonic-main/src/main/java/org/airsonic/player/service/upnp/AlbumUpnpProcessor.java @@ -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 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 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 return returnValue; } - public List getChildren(Album album) throws Exception { + public List getChildren(Album album) { List allFiles = getMediaFileDao().getSongsForAlbum(album.getArtist(), album.getName()); if (album.getId() == -1) { List albumList = null; @@ -136,17 +135,17 @@ public class AlbumUpnpProcessor extends UpnpContentProcessor } @Override - public int getAllItemsSize() throws Exception { + public int getAllItemsSize() { List 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(); } diff --git a/airsonic-main/src/main/java/org/airsonic/player/service/upnp/ArtistUpnpProcessor.java b/airsonic-main/src/main/java/org/airsonic/player/service/upnp/ArtistUpnpProcessor.java index d4af2c86..8fc64bea 100644 --- a/airsonic-main/src/main/java/org/airsonic/player/service/upnp/ArtistUpnpProcessor.java +++ b/airsonic-main/src/main/java/org/airsonic/player/service/upnp/ArtistUpnpProcessor.java @@ -69,7 +69,7 @@ public class ArtistUpnpProcessor extends UpnpContentProcessor { 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 { return allAlbums; } - public void addChild(DIDLContent didl, Album album) throws Exception { + public void addChild(DIDLContent didl, Album album) { didl.addContainer(getAlbumProcessor().createContainer(album)); } diff --git a/airsonic-main/src/main/java/org/airsonic/player/service/upnp/DispatchingContentDirectory.java b/airsonic-main/src/main/java/org/airsonic/player/service/upnp/DispatchingContentDirectory.java index 69eaecb9..10cbb4fc 100644 --- a/airsonic-main/src/main/java/org/airsonic/player/service/upnp/DispatchingContentDirectory.java +++ b/airsonic-main/src/main/java/org/airsonic/player/service/upnp/DispatchingContentDirectory.java @@ -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(); } diff --git a/airsonic-main/src/main/java/org/airsonic/player/service/upnp/FolderBasedContentDirectory.java b/airsonic-main/src/main/java/org/airsonic/player/service/upnp/FolderBasedContentDirectory.java index 44d360f5..4b72a474 100644 --- a/airsonic-main/src/main/java/org/airsonic/player/service/upnp/FolderBasedContentDirectory.java +++ b/airsonic-main/src/main/java/org/airsonic/player/service/upnp/FolderBasedContentDirectory.java @@ -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())) diff --git a/airsonic-main/src/main/java/org/airsonic/player/service/upnp/GenreUpnpProcessor.java b/airsonic-main/src/main/java/org/airsonic/player/service/upnp/GenreUpnpProcessor.java index 840d0bc8..40eec9fa 100644 --- a/airsonic-main/src/main/java/org/airsonic/player/service/upnp/GenreUpnpProcessor.java +++ b/airsonic-main/src/main/java/org/airsonic/player/service/upnp/GenreUpnpProcessor.java @@ -98,7 +98,7 @@ public class GenreUpnpProcessor extends UpnpContentProcessor 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)); } } diff --git a/airsonic-main/src/main/java/org/airsonic/player/service/upnp/MediaFileUpnpProcessor.java b/airsonic-main/src/main/java/org/airsonic/player/service/upnp/MediaFileUpnpProcessor.java index 2db09183..220458bb 100644 --- a/airsonic-main/src/main/java/org/airsonic/player/service/upnp/MediaFileUpnpProcessor.java +++ b/airsonic-main/src/main/java/org/airsonic/player/service/upnp/MediaFileUpnpProcessor.java @@ -62,7 +62,7 @@ public class MediaFileUpnpProcessor extends UpnpContentProcessor getAllItems() throws Exception { + public List getAllItems() { List allFolders = getDispatcher().getSettingsService().getAllMusicFolders(); List returnValue = new ArrayList(); if (allFolders.size() == 1) { @@ -102,7 +102,7 @@ public class MediaFileUpnpProcessor extends UpnpContentProcessor allFolders = getDispatchingContentDirectory().getSettingsService().getAllMusicFolders(); int allAlbumCount = getAlbumDao().getAlbumCount(allFolders); return Math.min(allAlbumCount, RECENT_COUNT); diff --git a/airsonic-main/src/main/java/org/airsonic/player/service/upnp/Router.java b/airsonic-main/src/main/java/org/airsonic/player/service/upnp/Router.java index 8fe0057b..ce10e298 100644 --- a/airsonic-main/src/main/java/org/airsonic/player/service/upnp/Router.java +++ b/airsonic-main/src/main/java/org/airsonic/player/service/upnp/Router.java @@ -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); } diff --git a/airsonic-main/src/main/java/org/airsonic/player/service/upnp/UpnpContentProcessor.java b/airsonic-main/src/main/java/org/airsonic/player/service/upnp/UpnpContentProcessor.java index ced6903f..a7220089 100644 --- a/airsonic-main/src/main/java/org/airsonic/player/service/upnp/UpnpContentProcessor.java +++ b/airsonic-main/src/main/java/org/airsonic/player/service/upnp/UpnpContentProcessor.java @@ -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 { 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 { 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 { return getAllItems().size(); } - public abstract Container createContainer(T item) throws Exception; + public abstract Container createContainer(T item); public abstract List getAllItems() throws Exception; - public abstract T getItemById(String id) throws Exception; + public abstract T getItemById(String id); public abstract List 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; diff --git a/airsonic-main/src/main/java/org/airsonic/player/taglib/EscapeJavaScriptTag.java b/airsonic-main/src/main/java/org/airsonic/player/taglib/EscapeJavaScriptTag.java index 4adaf5be..d7f7dbf8 100644 --- a/airsonic-main/src/main/java/org/airsonic/player/taglib/EscapeJavaScriptTag.java +++ b/airsonic-main/src/main/java/org/airsonic/player/taglib/EscapeJavaScriptTag.java @@ -51,7 +51,7 @@ public class EscapeJavaScriptTag extends BodyTagSupport { private String string; - public int doStartTag() throws JspException { + public int doStartTag() { return EVAL_BODY_BUFFERED; } diff --git a/airsonic-main/src/main/java/org/airsonic/player/taglib/FormatBytesTag.java b/airsonic-main/src/main/java/org/airsonic/player/taglib/FormatBytesTag.java index 2fb0a295..51591605 100644 --- a/airsonic-main/src/main/java/org/airsonic/player/taglib/FormatBytesTag.java +++ b/airsonic-main/src/main/java/org/airsonic/player/taglib/FormatBytesTag.java @@ -48,7 +48,7 @@ public class FormatBytesTag extends BodyTagSupport { private long bytes; - public int doStartTag() throws JspException { + public int doStartTag() { return EVAL_BODY_BUFFERED; } diff --git a/airsonic-main/src/main/java/org/airsonic/player/taglib/UrlTag.java b/airsonic-main/src/main/java/org/airsonic/player/taglib/UrlTag.java index a46510da..6a79e3b7 100644 --- a/airsonic-main/src/main/java/org/airsonic/player/taglib/UrlTag.java +++ b/airsonic-main/src/main/java/org/airsonic/player/taglib/UrlTag.java @@ -62,7 +62,7 @@ public class UrlTag extends BodyTagSupport { private String encoding = DEFAULT_ENCODING; private List parameters = new ArrayList(); - public int doStartTag() throws JspException { + public int doStartTag() { parameters.clear(); return EVAL_BODY_BUFFERED; } diff --git a/airsonic-main/src/main/java/org/airsonic/player/taglib/WikiTag.java b/airsonic-main/src/main/java/org/airsonic/player/taglib/WikiTag.java index c1bde539..0c51abda 100644 --- a/airsonic-main/src/main/java/org/airsonic/player/taglib/WikiTag.java +++ b/airsonic-main/src/main/java/org/airsonic/player/taglib/WikiTag.java @@ -43,7 +43,7 @@ public class WikiTag extends BodyTagSupport { private String text; - public int doStartTag() throws JspException { + public int doStartTag() { return EVAL_BODY_BUFFERED; } diff --git a/airsonic-main/src/test/java/org/airsonic/player/api/jukebox/AirsonicRestApiJukeboxLegacyIntTest.java b/airsonic-main/src/test/java/org/airsonic/player/api/jukebox/AirsonicRestApiJukeboxLegacyIntTest.java index 2cdee852..edfd95f5 100644 --- a/airsonic-main/src/test/java/org/airsonic/player/api/jukebox/AirsonicRestApiJukeboxLegacyIntTest.java +++ b/airsonic-main/src/test/java/org/airsonic/player/api/jukebox/AirsonicRestApiJukeboxLegacyIntTest.java @@ -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 { diff --git a/airsonic-main/src/test/java/org/airsonic/player/dao/InternetRadioDaoTestCase.java b/airsonic-main/src/test/java/org/airsonic/player/dao/InternetRadioDaoTestCase.java index 3013868f..2d3ac1b9 100644 --- a/airsonic-main/src/test/java/org/airsonic/player/dao/InternetRadioDaoTestCase.java +++ b/airsonic-main/src/test/java/org/airsonic/player/dao/InternetRadioDaoTestCase.java @@ -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"); } diff --git a/airsonic-main/src/test/java/org/airsonic/player/dao/MusicFolderDaoTestCase.java b/airsonic-main/src/test/java/org/airsonic/player/dao/MusicFolderDaoTestCase.java index d4879238..f8f97324 100644 --- a/airsonic-main/src/test/java/org/airsonic/player/dao/MusicFolderDaoTestCase.java +++ b/airsonic-main/src/test/java/org/airsonic/player/dao/MusicFolderDaoTestCase.java @@ -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"); } diff --git a/airsonic-main/src/test/java/org/airsonic/player/dao/PlayerDaoTestCase.java b/airsonic-main/src/test/java/org/airsonic/player/dao/PlayerDaoTestCase.java index 3cfa7aad..8d634b11 100644 --- a/airsonic-main/src/test/java/org/airsonic/player/dao/PlayerDaoTestCase.java +++ b/airsonic-main/src/test/java/org/airsonic/player/dao/PlayerDaoTestCase.java @@ -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"); } diff --git a/airsonic-main/src/test/java/org/airsonic/player/dao/PodcastDaoTestCase.java b/airsonic-main/src/test/java/org/airsonic/player/dao/PodcastDaoTestCase.java index 3e024b43..98b820ca 100644 --- a/airsonic-main/src/test/java/org/airsonic/player/dao/PodcastDaoTestCase.java +++ b/airsonic-main/src/test/java/org/airsonic/player/dao/PodcastDaoTestCase.java @@ -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"); } diff --git a/airsonic-main/src/test/java/org/airsonic/player/dao/TranscodingDaoTestCase.java b/airsonic-main/src/test/java/org/airsonic/player/dao/TranscodingDaoTestCase.java index 56f1178f..74c554ed 100644 --- a/airsonic-main/src/test/java/org/airsonic/player/dao/TranscodingDaoTestCase.java +++ b/airsonic-main/src/test/java/org/airsonic/player/dao/TranscodingDaoTestCase.java @@ -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"); } diff --git a/airsonic-main/src/test/java/org/airsonic/player/dao/UserDaoTestCase.java b/airsonic-main/src/test/java/org/airsonic/player/dao/UserDaoTestCase.java index 32cd674c..ca3a4410 100644 --- a/airsonic-main/src/test/java/org/airsonic/player/dao/UserDaoTestCase.java +++ b/airsonic-main/src/test/java/org/airsonic/player/dao/UserDaoTestCase.java @@ -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"); } diff --git a/airsonic-main/src/test/java/org/airsonic/player/domain/MediaFileComparatorTestCase.java b/airsonic-main/src/test/java/org/airsonic/player/domain/MediaFileComparatorTestCase.java index 1dc4034d..51725993 100644 --- a/airsonic-main/src/test/java/org/airsonic/player/domain/MediaFileComparatorTestCase.java +++ b/airsonic-main/src/test/java/org/airsonic/player/domain/MediaFileComparatorTestCase.java @@ -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); diff --git a/airsonic-main/src/test/java/org/airsonic/player/domain/PlayQueueTestCase.java b/airsonic-main/src/test/java/org/airsonic/player/domain/PlayQueueTestCase.java index 3ce683f1..4d5ad2d7 100644 --- a/airsonic-main/src/test/java/org/airsonic/player/domain/PlayQueueTestCase.java +++ b/airsonic-main/src/test/java/org/airsonic/player/domain/PlayQueueTestCase.java @@ -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.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)); diff --git a/airsonic-main/src/test/java/org/airsonic/player/domain/SortableArtistTestCase.java b/airsonic-main/src/test/java/org/airsonic/player/domain/SortableArtistTestCase.java index 851bc4fd..7a52648f 100644 --- a/airsonic-main/src/test/java/org/airsonic/player/domain/SortableArtistTestCase.java +++ b/airsonic-main/src/test/java/org/airsonic/player/domain/SortableArtistTestCase.java @@ -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 artists = new ArrayList(); 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 artists = new ArrayList(); 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 artists = new ArrayList(); artists.add(new TestSortableArtist("p\u00e9ch\u00e9")); diff --git a/airsonic-main/src/test/java/org/airsonic/player/service/InternetRadioServiceTest.java b/airsonic-main/src/test/java/org/airsonic/player/service/InternetRadioServiceTest.java index 70eae8d0..8dc44299 100644 --- a/airsonic-main/src/test/java/org/airsonic/player/service/InternetRadioServiceTest.java +++ b/airsonic-main/src/test/java/org/airsonic/player/service/InternetRadioServiceTest.java @@ -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 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 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 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 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 radioSources = internetRadioService.getInternetRadioSources(radioMoveLoop); // A PlaylistHasTooManyRedirects exception is thrown internally, diff --git a/airsonic-main/src/test/java/org/airsonic/player/service/JWTSecurityServiceTest.java b/airsonic-main/src/test/java/org/airsonic/player/service/JWTSecurityServiceTest.java index 149f7071..81395c23 100644 --- a/airsonic-main/src/test/java/org/airsonic/player/service/JWTSecurityServiceTest.java +++ b/airsonic-main/src/test/java/org/airsonic/player/service/JWTSecurityServiceTest.java @@ -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( diff --git a/airsonic-main/src/test/java/org/airsonic/player/service/JukeboxServiceUnitTest.java b/airsonic-main/src/test/java/org/airsonic/player/service/JukeboxServiceUnitTest.java index 43d5a528..751c4734 100644 --- a/airsonic-main/src/test/java/org/airsonic/player/service/JukeboxServiceUnitTest.java +++ b/airsonic-main/src/test/java/org/airsonic/player/service/JukeboxServiceUnitTest.java @@ -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 diff --git a/airsonic-main/src/test/java/org/airsonic/player/service/LegacyDatabaseStartupTestCase.java b/airsonic-main/src/test/java/org/airsonic/player/service/LegacyDatabaseStartupTestCase.java index 2f7b9f61..9fa04d33 100644 --- a/airsonic-main/src/test/java/org/airsonic/player/service/LegacyDatabaseStartupTestCase.java +++ b/airsonic-main/src/test/java/org/airsonic/player/service/LegacyDatabaseStartupTestCase.java @@ -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"); } diff --git a/airsonic-main/src/test/java/org/airsonic/player/service/MusicIndexServiceTestCase.java b/airsonic-main/src/test/java/org/airsonic/player/service/MusicIndexServiceTestCase.java index 81410c24..d88a3467 100644 --- a/airsonic-main/src/test/java/org/airsonic/player/service/MusicIndexServiceTestCase.java +++ b/airsonic-main/src/test/java/org/airsonic/player/service/MusicIndexServiceTestCase.java @@ -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 indexes = musicIndexService.createIndexesFromExpression("A B The X-Z(XYZ)"); assertEquals(4, indexes.size()); diff --git a/airsonic-main/src/test/java/org/airsonic/player/service/PlaylistServiceTestImport.java b/airsonic-main/src/test/java/org/airsonic/player/service/PlaylistServiceTestImport.java index 55aa1a1f..6d5262ac 100644 --- a/airsonic-main/src/test/java/org/airsonic/player/service/PlaylistServiceTestImport.java +++ b/airsonic-main/src/test/java/org/airsonic/player/service/PlaylistServiceTestImport.java @@ -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()); diff --git a/airsonic-main/src/test/java/org/airsonic/player/service/SettingsServiceTestCase.java b/airsonic-main/src/test/java/org/airsonic/player/service/SettingsServiceTestCase.java index 97a76ade..4eb148d0 100644 --- a/airsonic-main/src/test/java/org/airsonic/player/service/SettingsServiceTestCase.java +++ b/airsonic-main/src/test/java/org/airsonic/player/service/SettingsServiceTestCase.java @@ -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(); diff --git a/airsonic-main/src/test/java/org/airsonic/player/service/metadata/MediaFileTestCase.java b/airsonic-main/src/test/java/org/airsonic/player/service/metadata/MediaFileTestCase.java index e5b120a9..cd09c4d7 100644 --- a/airsonic-main/src/test/java/org/airsonic/player/service/metadata/MediaFileTestCase.java +++ b/airsonic-main/src/test/java/org/airsonic/player/service/metadata/MediaFileTestCase.java @@ -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"); diff --git a/airsonic-main/src/test/java/org/airsonic/player/service/metadata/MetaDataParserTestCase.java b/airsonic-main/src/test/java/org/airsonic/player/service/metadata/MetaDataParserTestCase.java index 48740186..9960dadc 100644 --- a/airsonic-main/src/test/java/org/airsonic/player/service/metadata/MetaDataParserTestCase.java +++ b/airsonic-main/src/test/java/org/airsonic/player/service/metadata/MetaDataParserTestCase.java @@ -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) { diff --git a/airsonic-main/src/test/java/org/airsonic/player/service/search/IndexManagerTestCase.java b/airsonic-main/src/test/java/org/airsonic/player/service/search/IndexManagerTestCase.java index 96744cb1..536813a6 100644 --- a/airsonic-main/src/test/java/org/airsonic/player/service/search/IndexManagerTestCase.java +++ b/airsonic-main/src/test/java/org/airsonic/player/service/search/IndexManagerTestCase.java @@ -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); diff --git a/airsonic-main/src/test/java/org/airsonic/player/service/search/SearchServiceSpecialGenreTestCase.java b/airsonic-main/src/test/java/org/airsonic/player/service/search/SearchServiceSpecialGenreTestCase.java index c8c9f10a..53fb5b55 100644 --- a/airsonic-main/src/test/java/org/airsonic/player/service/search/SearchServiceSpecialGenreTestCase.java +++ b/airsonic-main/src/test/java/org/airsonic/player/service/search/SearchServiceSpecialGenreTestCase.java @@ -40,7 +40,7 @@ public class SearchServiceSpecialGenreTestCase extends AbstractAirsonicHomeTest } @Before - public void setup() throws Exception { + public void setup() { populateDatabaseOnlyOnce(); } diff --git a/airsonic-main/src/test/java/org/airsonic/player/service/search/SearchServiceSpecialPathTestCase.java b/airsonic-main/src/test/java/org/airsonic/player/service/search/SearchServiceSpecialPathTestCase.java index 405f587f..44095d95 100644 --- a/airsonic-main/src/test/java/org/airsonic/player/service/search/SearchServiceSpecialPathTestCase.java +++ b/airsonic-main/src/test/java/org/airsonic/player/service/search/SearchServiceSpecialPathTestCase.java @@ -51,7 +51,7 @@ public class SearchServiceSpecialPathTestCase extends AbstractAirsonicHomeTest { } @Before - public void setup() throws Exception { + public void setup() { populateDatabaseOnlyOnce(); } diff --git a/airsonic-main/src/test/java/org/airsonic/player/service/search/SearchServiceStartWithStopwardsTestCase.java b/airsonic-main/src/test/java/org/airsonic/player/service/search/SearchServiceStartWithStopwardsTestCase.java index b7e750fb..f84eb4bf 100644 --- a/airsonic-main/src/test/java/org/airsonic/player/service/search/SearchServiceStartWithStopwardsTestCase.java +++ b/airsonic-main/src/test/java/org/airsonic/player/service/search/SearchServiceStartWithStopwardsTestCase.java @@ -41,7 +41,7 @@ public class SearchServiceStartWithStopwardsTestCase extends AbstractAirsonicHom } @Before - public void setup() throws Exception { + public void setup() { populateDatabaseOnlyOnce(); } diff --git a/airsonic-main/src/test/java/org/airsonic/player/service/search/SearchServiceTestCase.java b/airsonic-main/src/test/java/org/airsonic/player/service/search/SearchServiceTestCase.java index bede64ab..0989cc2c 100644 --- a/airsonic-main/src/test/java/org/airsonic/player/service/search/SearchServiceTestCase.java +++ b/airsonic-main/src/test/java/org/airsonic/player/service/search/SearchServiceTestCase.java @@ -43,7 +43,7 @@ public class SearchServiceTestCase extends AbstractAirsonicHomeTest { private SearchService searchService; @Before - public void setup() throws Exception { + public void setup() { populateDatabaseOnlyOnce(); } diff --git a/airsonic-main/src/test/java/org/airsonic/player/util/StringUtilTestCase.java b/airsonic-main/src/test/java/org/airsonic/player/util/StringUtilTestCase.java index 1d8a82d5..c45cd14b 100644 --- a/airsonic-main/src/test/java/org/airsonic/player/util/StringUtilTestCase.java +++ b/airsonic-main/src/test/java/org/airsonic/player/util/StringUtilTestCase.java @@ -31,7 +31,7 @@ import java.util.Locale; */ public class StringUtilTestCase extends TestCase { - public void testToHtml() throws Exception { + public void testToHtml() { assertEquals(null, StringUtil.toHtml(null)); assertEquals("", StringUtil.toHtml("")); assertEquals(" ", StringUtil.toHtml(" ")); @@ -57,7 +57,7 @@ public class StringUtilTestCase extends TestCase { assertEquals("Error in getMimeType().", "application/octet-stream", StringUtil.getMimeType(null)); } - public void testFormatBytes() throws Exception { + public void testFormatBytes() { Locale locale = Locale.ENGLISH; assertEquals("Error in formatBytes().", "918 B", StringUtil.formatBytes(918, locale)); assertEquals("Error in formatBytes().", "1023 B", StringUtil.formatBytes(1023, locale)); diff --git a/airsonic-main/src/test/java/org/airsonic/player/validator/PasswordSettingsValidatorTestCase.java b/airsonic-main/src/test/java/org/airsonic/player/validator/PasswordSettingsValidatorTestCase.java index 70e678cb..4a676869 100644 --- a/airsonic-main/src/test/java/org/airsonic/player/validator/PasswordSettingsValidatorTestCase.java +++ b/airsonic-main/src/test/java/org/airsonic/player/validator/PasswordSettingsValidatorTestCase.java @@ -11,7 +11,7 @@ public class PasswordSettingsValidatorTestCase extends TestCase { private PasswordSettingsCommand psc; @Before - public void setUp() throws Exception { + public void setUp() { psc = new PasswordSettingsCommand(); psc.setUsername("username"); psc.setPassword("1234");