Merge remote-tracking branch 'origin/pr/1434'

master
Andrew DeMaria 5 years ago
commit ec426fc1ed
No known key found for this signature in database
GPG Key ID: 0A3F5E91F8364EDF
  1. 4
      airsonic-main/src/main/java/org/airsonic/player/ajax/PlayQueueService.java
  2. 6
      airsonic-main/src/main/java/org/airsonic/player/controller/CoverArtController.java
  3. 8
      airsonic-main/src/main/java/org/airsonic/player/controller/ShareManagementController.java
  4. 3
      airsonic-main/src/main/java/org/airsonic/player/controller/SubsonicRESTController.java
  5. 4
      airsonic-main/src/main/java/org/airsonic/player/dao/AbstractDao.java
  6. 4
      airsonic-main/src/main/java/org/airsonic/player/domain/InternetRadioSource.java
  7. 24
      airsonic-main/src/main/java/org/airsonic/player/domain/PlayQueue.java
  8. 10
      airsonic-main/src/main/java/org/airsonic/player/security/JWTRequestParameterProcessingFilter.java
  9. 15
      airsonic-main/src/main/java/org/airsonic/player/service/InternetRadioService.java
  10. 3
      airsonic-main/src/main/java/org/airsonic/player/service/MediaScannerService.java
  11. 8
      checkstyle.xml

@ -244,7 +244,9 @@ public class PlayQueueService {
HttpServletRequest request = WebContextFactory.get().getHttpServletRequest(); HttpServletRequest request = WebContextFactory.get().getHttpServletRequest();
InternetRadio radio = internetRadioDao.getInternetRadioById(id); 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(); Player player = resolvePlayer();
return doPlayInternetRadio(request, player, radio).setStartPlayerAt(0); return doPlayInternetRadio(request, player, radio).setStartPlayerAt(0);

@ -385,13 +385,11 @@ public class CoverArtController implements LastModified {
in = getImageInputStream(coverArt); in = getImageInputStream(coverArt);
if (in == null) { if (in == null) {
reason = "getImageInputStream"; reason = "getImageInputStream";
} } else {
else {
BufferedImage bimg = ImageIO.read(in); BufferedImage bimg = ImageIO.read(in);
if (bimg == null) { if (bimg == null) {
reason = "ImageIO.read"; reason = "ImageIO.read";
} } else {
else {
return scale(bimg, size, size); return scale(bimg, size, size);
} }
} }

@ -109,15 +109,11 @@ public class ShareManagementController {
for (int index : indexes) { for (int index : indexes) {
result.add(children.get(index)); result.add(children.get(index));
} }
} } else if (playerId != null) {
else if (playerId != null) {
Player player = playerService.getPlayerById(playerId); Player player = playerService.getPlayerById(playerId);
PlayQueue playQueue = player.getPlayQueue(); PlayQueue playQueue = player.getPlayQueue();
result = playQueue.getFiles(); result = playQueue.getFiles();
} } else if (playlistId != null) {
else if (playlistId != null) {
result = playlistService.getFilesInPlaylist(playlistId); result = playlistService.getFilesInPlaylist(playlistId);
} }

@ -2244,8 +2244,7 @@ public class SubsonicRESTController {
private AlbumInfo getAlbumInfoInternal(AlbumNotes albumNotes) { private AlbumInfo getAlbumInfoInternal(AlbumNotes albumNotes) {
AlbumInfo result = new AlbumInfo(); AlbumInfo result = new AlbumInfo();
if (albumNotes != null) if (albumNotes != null) {
{
result.setNotes(albumNotes.getNotes()); result.setNotes(albumNotes.getNotes());
result.setMusicBrainzId(albumNotes.getMusicBrainzId()); result.setMusicBrainzId(albumNotes.getMusicBrainzId());
result.setLastFmUrl(albumNotes.getLastFmUrl()); result.setLastFmUrl(albumNotes.getLastFmUrl());

@ -179,6 +179,8 @@ public class AbstractDao {
this.daoHelper = daoHelper; this.daoHelper = daoHelper;
} }
public void checkpoint() { daoHelper.checkpoint(); } public void checkpoint() {
daoHelper.checkpoint();
}
} }

@ -7,5 +7,7 @@ public class InternetRadioSource {
this.streamUrl = streamUrl; this.streamUrl = streamUrl;
} }
public String getStreamUrl() { return streamUrl; } public String getStreamUrl() {
return streamUrl;
}
} }

@ -356,14 +356,18 @@ public class PlayQueue {
* *
* @return Whether the play queue is a shuffle radio mode. * @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. * Returns whether the play queue is a internet radio mode.
* *
* @return 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. * Revert the last operation.
@ -405,28 +409,36 @@ public class PlayQueue {
* *
* @param internetRadio An internet radio, or <code>null</code> if this is not an internet radio playlist * @param internetRadio An internet radio, or <code>null</code> 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 * Gets the current internet radio
* *
* @return The current internet radio, or <code>null</code> if this is not an internet radio playlist * @return The current internet radio, or <code>null</code> 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 * Returns the criteria used to generate this random playlist
* *
* @return The search criteria, or <code>null</code> if this is not a random playlist. * @return The search criteria, or <code>null</code> 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 * Sets the criteria used to generate this random playlist
* *
* @param randomSearchCriteria The search criteria, or <code>null</code> if this is not a random playlist. * @param randomSearchCriteria The search criteria, or <code>null</code> 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. * Returns the total length in bytes.

@ -76,19 +76,15 @@ public class JWTRequestParameterProcessingFilter implements Filter {
// authentication // authentication
return; return;
} }
} } catch (InternalAuthenticationServiceException failed) {
catch (InternalAuthenticationServiceException failed) {
LOG.error( LOG.error(
"An internal error occurred while trying to authenticate the user.", "An internal error occurred while trying to authenticate the user.",
failed); failed);
unsuccessfulAuthentication(request, response, failed); unsuccessfulAuthentication(request, response, failed);
return; return;
} } catch (AuthenticationException e) {
catch (AuthenticationException failed) { unsuccessfulAuthentication(request, response, e);
// Authentication failed
unsuccessfulAuthentication(request, response, failed);
return; return;
} }

@ -43,14 +43,18 @@ public class InternetRadioService {
* Generic exception class for playlists. * Generic exception class for playlists.
*/ */
private class PlaylistException extends Exception { 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. * Exception thrown when the remote playlist is too large to be parsed completely.
*/ */
private class PlaylistTooLarge extends PlaylistException { 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. * Exception thrown when too many redirects occurred when retrieving a remote playlist.
*/ */
private class PlaylistHasTooManyRedirects extends PlaylistException { private class PlaylistHasTooManyRedirects extends PlaylistException {
public PlaylistHasTooManyRedirects(String message) { super(message); } public PlaylistHasTooManyRedirects(String message) {
super(message);
}
} }
public InternetRadioService() { public InternetRadioService() {
@ -233,8 +239,7 @@ public class InternetRadioService {
} else { } else {
playlist = SpecificPlaylistFactory.getInstance().readFrom(in, contentEncoding); playlist = SpecificPlaylistFactory.getInstance().readFrom(in, contentEncoding);
} }
} } finally {
finally {
urlConnection.disconnect(); urlConnection.disconnect();
} }
if (playlist == null) { if (playlist == null) {

@ -270,8 +270,7 @@ public class MediaScannerService {
} }
if (file.isAlbum()) { if (file.isAlbum()) {
genres.incrementAlbumCount(genre); genres.incrementAlbumCount(genre);
} } else if (file.isAudio()) {
else if (file.isAudio()) {
genres.incrementSongCount(genre); genres.incrementSongCount(genre);
} }
} }

@ -10,6 +10,11 @@
<property name="fileExtensions" value="java, properties, xml"/> <property name="fileExtensions" value="java, properties, xml"/>
<module name="RegexpSingleline">
<property name="format" value="\s+$"/>
<property name="message" value="Unnecessary trailing whitespace"/>
</module>
<module name="FileTabCharacter"/> <module name="FileTabCharacter"/>
<!-- This is a temporary workaround until ^M line endings is added to upstream checkstyle --> <!-- This is a temporary workaround until ^M line endings is added to upstream checkstyle -->
@ -39,6 +44,7 @@
<module name="EqualsHashCode"/> <module name="EqualsHashCode"/>
<module name="Indentation"/> <module name="Indentation"/>
<module name="InnerAssignment"/> <module name="InnerAssignment"/>
<module name="LeftCurly"/>
<module name="MethodParamPad"/> <module name="MethodParamPad"/>
<module name="MultipleVariableDeclarations"/> <module name="MultipleVariableDeclarations"/>
<module name="NoWhitespaceBefore"> <module name="NoWhitespaceBefore">
@ -50,8 +56,10 @@
<module name="ParenPadCheck"/> <module name="ParenPadCheck"/>
<module name="RedundantImport"/> <module name="RedundantImport"/>
<module name="RequireThis"/> <module name="RequireThis"/>
<module name="RightCurly"/>
<module name="SimplifyBooleanExpression"/> <module name="SimplifyBooleanExpression"/>
<module name="SimplifyBooleanReturn"/> <module name="SimplifyBooleanReturn"/>
<module name="SingleSpaceSeparator"/>
<module name="StringLiteralEquality"/> <module name="StringLiteralEquality"/>
<module name="SuperClone"/> <module name="SuperClone"/>
<module name="SuperFinalize"/> <module name="SuperFinalize"/>

Loading…
Cancel
Save