Enable checkstyle OverloadMethodsDeclarationOrder

master
Evan Harris 5 years ago
parent 1acfacb4c6
commit 6e8ae8971c
No known key found for this signature in database
GPG Key ID: FF3BD4DA59FF9EDC
  1. 8
      airsonic-main/src/main/java/org/airsonic/player/dao/AlbumDao.java
  2. 45
      airsonic-main/src/main/java/org/airsonic/player/service/LastFmService.java
  3. 18
      airsonic-main/src/main/java/org/airsonic/player/service/MediaFileService.java
  4. 1
      checkstyle.xml

@ -47,6 +47,10 @@ public class AlbumDao extends AbstractDao {
private final RowMapper rowMapper = new AlbumMapper(); private final RowMapper rowMapper = new AlbumMapper();
public Album getAlbum(int id) {
return queryOne("select " + QUERY_COLUMNS + " from album where id=?", rowMapper, id);
}
/** /**
* Returns the album with the given artist and album name. * Returns the album with the given artist and album name.
* *
@ -90,10 +94,6 @@ public class AlbumDao extends AbstractDao {
return null; return null;
} }
public Album getAlbum(int id) {
return queryOne("select " + QUERY_COLUMNS + " from album where id=?", rowMapper, id);
}
public List<Album> getAlbumsForArtist(final String artist, final List<MusicFolder> musicFolders) { public List<Album> getAlbumsForArtist(final String artist, final List<MusicFolder> musicFolders) {
if (musicFolders.isEmpty()) { if (musicFolders.isEmpty()) {
return Collections.emptyList(); return Collections.emptyList();

@ -236,6 +236,28 @@ public class LastFmService {
return getArtistBio(getCanonicalArtistName(artist.getName()), locale); return getArtistBio(getCanonicalArtistName(artist.getName()), locale);
} }
private ArtistBio getArtistBio(String artistName, Locale locale) {
try {
if (artistName == null) {
return null;
}
Artist info = Artist.getInfo(artistName, locale, null /* username */, LAST_FM_KEY);
if (info == null) {
return null;
}
return new ArtistBio(processWikiText(info.getWikiSummary()),
info.getMbid(),
info.getUrl(),
info.getImageURL(ImageSize.MEDIUM),
info.getImageURL(ImageSize.LARGE),
info.getImageURL(ImageSize.MEGA));
} catch (Throwable x) {
LOG.warn("Failed to find artist bio for " + artistName, x);
return null;
}
}
/** /**
* Returns top songs for the given artist, using last.fm REST API. * Returns top songs for the given artist, using last.fm REST API.
* *
@ -368,29 +390,6 @@ public class LastFmService {
return imageUrl == null ? null : new LastFmCoverArt(imageUrl, album.getArtist(), album.getName()); return imageUrl == null ? null : new LastFmCoverArt(imageUrl, album.getArtist(), album.getName());
} }
private ArtistBio getArtistBio(String artistName, Locale locale) {
try {
if (artistName == null) {
return null;
}
Artist info = Artist.getInfo(artistName, locale, null /* username */, LAST_FM_KEY);
if (info == null) {
return null;
}
return new ArtistBio(processWikiText(info.getWikiSummary()),
info.getMbid(),
info.getUrl(),
info.getImageURL(ImageSize.MEDIUM),
info.getImageURL(ImageSize.LARGE),
info.getImageURL(ImageSize.MEGA));
} catch (Throwable x) {
LOG.warn("Failed to find artist bio for " + artistName, x);
return null;
}
}
private String getCanonicalArtistName(String artistName) { private String getCanonicalArtistName(String artistName) {
try { try {
if (artistName == null) { if (artistName == null) {

@ -118,15 +118,6 @@ public class MediaFileService {
return result; return result;
} }
private MediaFile checkLastModified(MediaFile mediaFile, boolean useFastCache) {
if (useFastCache || (mediaFile.getVersion() >= MediaFileDao.VERSION && mediaFile.getChanged().getTime() >= FileUtil.lastModified(mediaFile.getFile()))) {
return mediaFile;
}
mediaFile = createMediaFile(mediaFile.getFile());
mediaFileDao.createOrUpdateMediaFile(mediaFile);
return mediaFile;
}
/** /**
* Returns a media file instance for the given path name. If possible, a cached value is returned. * Returns a media file instance for the given path name. If possible, a cached value is returned.
* *
@ -159,6 +150,15 @@ public class MediaFileService {
return getMediaFile(mediaFile.getParentPath()); return getMediaFile(mediaFile.getParentPath());
} }
private MediaFile checkLastModified(MediaFile mediaFile, boolean useFastCache) {
if (useFastCache || (mediaFile.getVersion() >= MediaFileDao.VERSION && mediaFile.getChanged().getTime() >= FileUtil.lastModified(mediaFile.getFile()))) {
return mediaFile;
}
mediaFile = createMediaFile(mediaFile.getFile());
mediaFileDao.createOrUpdateMediaFile(mediaFile);
return mediaFile;
}
/** /**
* Returns all media files that are children of a given media file. * Returns all media files that are children of a given media file.
* *

@ -40,6 +40,7 @@
</module> </module>
<module name="OneStatementPerLine"/> <module name="OneStatementPerLine"/>
<module name="PackageDeclaration"/> <module name="PackageDeclaration"/>
<module name="OverloadMethodsDeclarationOrder"/>
<module name="ParenPadCheck"/> <module name="ParenPadCheck"/>
<module name="RedundantImport"/> <module name="RedundantImport"/>
<module name="RequireThis"/> <module name="RequireThis"/>

Loading…
Cancel
Save