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();
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);

@ -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);
}
}

@ -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);
}

@ -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());

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

@ -7,5 +7,7 @@ public class InternetRadioSource {
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.
*/
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 <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
*
* @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
*
* @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
*
* @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.

@ -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;
}

@ -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) {

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

@ -10,6 +10,11 @@
<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"/>
<!-- This is a temporary workaround until ^M line endings is added to upstream checkstyle -->
@ -39,6 +44,7 @@
<module name="EqualsHashCode"/>
<module name="Indentation"/>
<module name="InnerAssignment"/>
<module name="LeftCurly"/>
<module name="MethodParamPad"/>
<module name="MultipleVariableDeclarations"/>
<module name="NoWhitespaceBefore">
@ -50,8 +56,10 @@
<module name="ParenPadCheck"/>
<module name="RedundantImport"/>
<module name="RequireThis"/>
<module name="RightCurly"/>
<module name="SimplifyBooleanExpression"/>
<module name="SimplifyBooleanReturn"/>
<module name="SingleSpaceSeparator"/>
<module name="StringLiteralEquality"/>
<module name="SuperClone"/>
<module name="SuperFinalize"/>

Loading…
Cancel
Save