From ac45a9b7dcdfad1fff3a519a9b8a538132a8ed00 Mon Sep 17 00:00:00 2001 From: Evan Harris Date: Fri, 6 Dec 2019 03:19:49 -0600 Subject: [PATCH] Added checkstyles for brace placement --- .../player/ajax/PlayQueueService.java | 4 +++- .../player/controller/CoverArtController.java | 6 ++--- .../controller/ShareManagementController.java | 8 ++----- .../controller/SubsonicRESTController.java | 3 +-- .../org/airsonic/player/dao/AbstractDao.java | 4 +++- .../player/domain/InternetRadioSource.java | 4 +++- .../org/airsonic/player/domain/PlayQueue.java | 24 ++++++++++++++----- .../JWTRequestParameterProcessingFilter.java | 10 +++----- .../player/service/InternetRadioService.java | 15 ++++++++---- .../player/service/MediaScannerService.java | 3 +-- checkstyle.xml | 2 ++ 11 files changed, 48 insertions(+), 35 deletions(-) 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 c95ae5e0..b24b03be 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 @@ -244,7 +244,9 @@ public class PlayQueueService { HttpServletRequest request = WebContextFactory.get().getHttpServletRequest(); InternetRadio radio = internetRadioDao.getInternetRadioById(id); - if (!radio.isEnabled()) { throw new Exception("Radio is not enabled"); } + if (!radio.isEnabled()) { + throw new Exception("Radio is not enabled"); + } Player player = resolvePlayer(); return doPlayInternetRadio(request, player, radio).setStartPlayerAt(0); diff --git a/airsonic-main/src/main/java/org/airsonic/player/controller/CoverArtController.java b/airsonic-main/src/main/java/org/airsonic/player/controller/CoverArtController.java index f6633fa1..cdb27e2c 100644 --- a/airsonic-main/src/main/java/org/airsonic/player/controller/CoverArtController.java +++ b/airsonic-main/src/main/java/org/airsonic/player/controller/CoverArtController.java @@ -385,13 +385,11 @@ public class CoverArtController implements LastModified { in = getImageInputStream(coverArt); if (in == null) { reason = "getImageInputStream"; - } - else { + } else { BufferedImage bimg = ImageIO.read(in); if (bimg == null) { reason = "ImageIO.read"; - } - else { + } else { return scale(bimg, size, size); } } diff --git a/airsonic-main/src/main/java/org/airsonic/player/controller/ShareManagementController.java b/airsonic-main/src/main/java/org/airsonic/player/controller/ShareManagementController.java index 31b083e7..c840c521 100644 --- a/airsonic-main/src/main/java/org/airsonic/player/controller/ShareManagementController.java +++ b/airsonic-main/src/main/java/org/airsonic/player/controller/ShareManagementController.java @@ -109,15 +109,11 @@ public class ShareManagementController { for (int index : indexes) { result.add(children.get(index)); } - } - - else if (playerId != null) { + } else if (playerId != null) { Player player = playerService.getPlayerById(playerId); PlayQueue playQueue = player.getPlayQueue(); result = playQueue.getFiles(); - } - - else if (playlistId != null) { + } else if (playlistId != null) { result = playlistService.getFilesInPlaylist(playlistId); } 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 daddb4ce..427c3904 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 @@ -2244,8 +2244,7 @@ public class SubsonicRESTController { private AlbumInfo getAlbumInfoInternal(AlbumNotes albumNotes) { AlbumInfo result = new AlbumInfo(); - if (albumNotes != null) - { + if (albumNotes != null) { result.setNotes(albumNotes.getNotes()); result.setMusicBrainzId(albumNotes.getMusicBrainzId()); result.setLastFmUrl(albumNotes.getLastFmUrl()); diff --git a/airsonic-main/src/main/java/org/airsonic/player/dao/AbstractDao.java b/airsonic-main/src/main/java/org/airsonic/player/dao/AbstractDao.java index 25dfe8f1..f412a60b 100644 --- a/airsonic-main/src/main/java/org/airsonic/player/dao/AbstractDao.java +++ b/airsonic-main/src/main/java/org/airsonic/player/dao/AbstractDao.java @@ -179,6 +179,8 @@ public class AbstractDao { this.daoHelper = daoHelper; } - public void checkpoint() { daoHelper.checkpoint(); } + public void checkpoint() { + daoHelper.checkpoint(); + } } diff --git a/airsonic-main/src/main/java/org/airsonic/player/domain/InternetRadioSource.java b/airsonic-main/src/main/java/org/airsonic/player/domain/InternetRadioSource.java index 5058dc4c..cd85f556 100644 --- a/airsonic-main/src/main/java/org/airsonic/player/domain/InternetRadioSource.java +++ b/airsonic-main/src/main/java/org/airsonic/player/domain/InternetRadioSource.java @@ -7,5 +7,7 @@ public class InternetRadioSource { this.streamUrl = streamUrl; } - public String getStreamUrl() { return streamUrl; } + public String getStreamUrl() { + return streamUrl; + } } 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 3b1deaa1..6de48bae 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 @@ -356,14 +356,18 @@ public class PlayQueue { * * @return Whether the play queue is a shuffle radio mode. */ - public synchronized boolean isShuffleRadioEnabled() { return this.randomSearchCriteria != null; } + public synchronized boolean isShuffleRadioEnabled() { + return this.randomSearchCriteria != null; + } /** * Returns whether the play queue is a internet radio mode. * * @return Whether the play queue is a internet radio mode. */ - public synchronized boolean isInternetRadioEnabled() { return this.internetRadio != null; } + public synchronized boolean isInternetRadioEnabled() { + return this.internetRadio != null; + } /** * Revert the last operation. @@ -405,28 +409,36 @@ public class PlayQueue { * * @param internetRadio An internet radio, or null if this is not an internet radio playlist */ - public void setInternetRadio(InternetRadio internetRadio) { this.internetRadio = internetRadio; } + public void setInternetRadio(InternetRadio internetRadio) { + this.internetRadio = internetRadio; + } /** * Gets the current internet radio * * @return The current internet radio, or null if this is not an internet radio playlist */ - public InternetRadio getInternetRadio() { return internetRadio; } + public InternetRadio getInternetRadio() { + return internetRadio; + } /** * Returns the criteria used to generate this random playlist * * @return The search criteria, or null if this is not a random playlist. */ - public synchronized RandomSearchCriteria getRandomSearchCriteria() { return randomSearchCriteria; } + public synchronized RandomSearchCriteria getRandomSearchCriteria() { + return randomSearchCriteria; + } /** * Sets the criteria used to generate this random playlist * * @param randomSearchCriteria The search criteria, or null if this is not a random playlist. */ - public synchronized void setRandomSearchCriteria(RandomSearchCriteria randomSearchCriteria) { this.randomSearchCriteria = randomSearchCriteria; } + public synchronized void setRandomSearchCriteria(RandomSearchCriteria randomSearchCriteria) { + this.randomSearchCriteria = randomSearchCriteria; + } /** * Returns the total length in bytes. 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 6cc9971a..97de2b24 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 @@ -76,19 +76,15 @@ public class JWTRequestParameterProcessingFilter implements Filter { // authentication return; } - } - catch (InternalAuthenticationServiceException failed) { + } catch (InternalAuthenticationServiceException failed) { LOG.error( "An internal error occurred while trying to authenticate the user.", failed); unsuccessfulAuthentication(request, response, failed); return; - } - catch (AuthenticationException failed) { - // Authentication failed - unsuccessfulAuthentication(request, response, failed); - + } catch (AuthenticationException e) { + unsuccessfulAuthentication(request, response, e); return; } 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 458d56b5..147075c3 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 @@ -43,14 +43,18 @@ public class InternetRadioService { * Generic exception class for playlists. */ private class PlaylistException extends Exception { - public PlaylistException(String message) { super(message); } + public PlaylistException(String message) { + super(message); + } } /** * Exception thrown when the remote playlist is too large to be parsed completely. */ private class PlaylistTooLarge extends PlaylistException { - public PlaylistTooLarge(String message) { super(message); } + public PlaylistTooLarge(String message) { + super(message); + } } /** @@ -66,7 +70,9 @@ public class InternetRadioService { * Exception thrown when too many redirects occurred when retrieving a remote playlist. */ private class PlaylistHasTooManyRedirects extends PlaylistException { - public PlaylistHasTooManyRedirects(String message) { super(message); } + public PlaylistHasTooManyRedirects(String message) { + super(message); + } } public InternetRadioService() { @@ -233,8 +239,7 @@ public class InternetRadioService { } else { playlist = SpecificPlaylistFactory.getInstance().readFrom(in, contentEncoding); } - } - finally { + } finally { urlConnection.disconnect(); } if (playlist == null) { diff --git a/airsonic-main/src/main/java/org/airsonic/player/service/MediaScannerService.java b/airsonic-main/src/main/java/org/airsonic/player/service/MediaScannerService.java index cdcb9c0c..b8c9265c 100644 --- a/airsonic-main/src/main/java/org/airsonic/player/service/MediaScannerService.java +++ b/airsonic-main/src/main/java/org/airsonic/player/service/MediaScannerService.java @@ -270,8 +270,7 @@ public class MediaScannerService { } if (file.isAlbum()) { genres.incrementAlbumCount(genre); - } - else if (file.isAudio()) { + } else if (file.isAudio()) { genres.incrementSongCount(genre); } } diff --git a/checkstyle.xml b/checkstyle.xml index d22d8162..f8b740d0 100644 --- a/checkstyle.xml +++ b/checkstyle.xml @@ -44,6 +44,7 @@ + @@ -55,6 +56,7 @@ +