mirror of
https://github.com/antebudimir/tempus.git
synced 2026-01-01 09:53:33 +00:00
Fixed a lot of possible issues raised by a code inspection
This commit is contained in:
parent
39ff821aee
commit
042bf3077f
76 changed files with 148 additions and 225 deletions
|
|
@ -20,8 +20,8 @@ public class Subsonic {
|
|||
|
||||
private final Context context;
|
||||
|
||||
private Version apiVersion = API_MAX_VERSION;
|
||||
private SubsonicPreferences preferences;
|
||||
private final Version apiVersion = API_MAX_VERSION;
|
||||
private final SubsonicPreferences preferences;
|
||||
|
||||
private SystemClient systemClient;
|
||||
private BrowsingClient browsingClient;
|
||||
|
|
|
|||
|
|
@ -1,5 +1,7 @@
|
|||
package com.cappielloantonio.play.subsonic.base;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
|
||||
public class Version implements Comparable<Version> {
|
||||
|
||||
private static final String VERSION_PATTERN = "[0-9]+(\\.[0-9]+)*";
|
||||
|
|
@ -49,6 +51,7 @@ public class Version implements Comparable<Version> {
|
|||
return 0;
|
||||
}
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
public String toString() {
|
||||
return versionString;
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@ public class AlbumList {
|
|||
*/
|
||||
public List<Child> getAlbums() {
|
||||
if (albums == null) {
|
||||
albums = new ArrayList<Child>();
|
||||
albums = new ArrayList<>();
|
||||
}
|
||||
return this.albums;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@ public class ArtistInfo extends ArtistInfoBase {
|
|||
*/
|
||||
public List<Artist> getSimilarArtists() {
|
||||
if (similarArtists == null) {
|
||||
similarArtists = new ArrayList<Artist>();
|
||||
similarArtists = new ArrayList<>();
|
||||
}
|
||||
return this.similarArtists;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,7 +1,6 @@
|
|||
package com.cappielloantonio.play.subsonic.models;
|
||||
|
||||
import com.tickaroo.tikxml.annotation.Element;
|
||||
import com.tickaroo.tikxml.annotation.ElementNameMatcher;
|
||||
import com.tickaroo.tikxml.annotation.Xml;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@ public class Bookmarks {
|
|||
*/
|
||||
public List<Bookmark> getBookmarks() {
|
||||
if (bookmarks == null) {
|
||||
bookmarks = new ArrayList<Bookmark>();
|
||||
bookmarks = new ArrayList<>();
|
||||
}
|
||||
return this.bookmarks;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@ public class ChatMessages {
|
|||
*/
|
||||
public List<ChatMessage> getChatMessages() {
|
||||
if (chatMessages == null) {
|
||||
chatMessages = new ArrayList<ChatMessage>();
|
||||
chatMessages = new ArrayList<>();
|
||||
}
|
||||
return this.chatMessages;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -36,7 +36,7 @@ public class Directory {
|
|||
*/
|
||||
public List<Child> getchildren() {
|
||||
if (children == null) {
|
||||
children = new ArrayList<Child>();
|
||||
children = new ArrayList<>();
|
||||
}
|
||||
return this.children;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ public class ErrorCode {
|
|||
public static int TRIAL_PERIOD_OVER = 60;
|
||||
public static int DATA_NOT_FOUND = 70;
|
||||
|
||||
private int value;
|
||||
private final int value;
|
||||
|
||||
public ErrorCode(int value) {
|
||||
this.value = value;
|
||||
|
|
|
|||
|
|
@ -29,7 +29,7 @@ public class Index {
|
|||
*/
|
||||
public List<Artist> getArtists() {
|
||||
if (artists == null) {
|
||||
artists = new ArrayList<Artist>();
|
||||
artists = new ArrayList<>();
|
||||
}
|
||||
return this.artists;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -32,7 +32,7 @@ public class Indexes {
|
|||
*/
|
||||
public List<Artist> getShortcuts() {
|
||||
if (shortcuts == null) {
|
||||
shortcuts = new ArrayList<Artist>();
|
||||
shortcuts = new ArrayList<>();
|
||||
}
|
||||
return this.shortcuts;
|
||||
}
|
||||
|
|
@ -59,7 +59,7 @@ public class Indexes {
|
|||
*/
|
||||
public List<Index> getIndices() {
|
||||
if (indices == null) {
|
||||
indices = new ArrayList<Index>();
|
||||
indices = new ArrayList<>();
|
||||
}
|
||||
return this.indices;
|
||||
}
|
||||
|
|
@ -86,7 +86,7 @@ public class Indexes {
|
|||
*/
|
||||
public List<Child> getchildren() {
|
||||
if (children == null) {
|
||||
children = new ArrayList<Child>();
|
||||
children = new ArrayList<>();
|
||||
}
|
||||
return this.children;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@ public class InternetRadioStations {
|
|||
*/
|
||||
public List<InternetRadioStation> getInternetRadioStations() {
|
||||
if (internetRadioStations == null) {
|
||||
internetRadioStations = new ArrayList<InternetRadioStation>();
|
||||
internetRadioStations = new ArrayList<>();
|
||||
}
|
||||
return this.internetRadioStations;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@ public class JukeboxPlaylist extends JukeboxStatus {
|
|||
*/
|
||||
public List<Child> getEntries() {
|
||||
if (entries == null) {
|
||||
entries = new ArrayList<Child>();
|
||||
entries = new ArrayList<>();
|
||||
}
|
||||
return this.entries;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@ public class NewestPodcasts {
|
|||
*/
|
||||
public List<PodcastEpisode> getEpisodes() {
|
||||
if (episodes == null) {
|
||||
episodes = new ArrayList<PodcastEpisode>();
|
||||
episodes = new ArrayList<>();
|
||||
}
|
||||
return this.episodes;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@ public class NowPlaying {
|
|||
*/
|
||||
public List<NowPlayingEntry> getEntries() {
|
||||
if (entries == null) {
|
||||
entries = new ArrayList<NowPlayingEntry>();
|
||||
entries = new ArrayList<>();
|
||||
}
|
||||
return this.entries;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -34,7 +34,7 @@ public class PlayQueue {
|
|||
*/
|
||||
public List<Child> getEntries() {
|
||||
if (entries == null) {
|
||||
entries = new ArrayList<Child>();
|
||||
entries = new ArrayList<>();
|
||||
}
|
||||
return this.entries;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -36,7 +36,7 @@ public class PodcastChannel {
|
|||
*/
|
||||
public List<PodcastEpisode> getEpisodes() {
|
||||
if (episodes == null) {
|
||||
episodes = new ArrayList<PodcastEpisode>();
|
||||
episodes = new ArrayList<>();
|
||||
}
|
||||
return this.episodes;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@ public class Podcasts {
|
|||
*/
|
||||
public List<PodcastChannel> getChannels() {
|
||||
if (channels == null) {
|
||||
channels = new ArrayList<PodcastChannel>();
|
||||
channels = new ArrayList<>();
|
||||
}
|
||||
return this.channels;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ public class ResponseStatus {
|
|||
public static String OK = "ok";
|
||||
public static String FAILED = "failed";
|
||||
|
||||
private String value;
|
||||
private final String value;
|
||||
|
||||
public ResponseStatus(@Attribute String value) {
|
||||
this.value = value;
|
||||
|
|
|
|||
|
|
@ -30,7 +30,7 @@ public class SearchResult {
|
|||
*/
|
||||
public List<Child> getMatches() {
|
||||
if (matches == null) {
|
||||
matches = new ArrayList<Child>();
|
||||
matches = new ArrayList<>();
|
||||
}
|
||||
return this.matches;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -37,7 +37,7 @@ public class Share {
|
|||
*/
|
||||
public List<Child> getEntries() {
|
||||
if (entries == null) {
|
||||
entries = new ArrayList<Child>();
|
||||
entries = new ArrayList<>();
|
||||
}
|
||||
return this.entries;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@ public class Shares {
|
|||
*/
|
||||
public List<Share> getShares() {
|
||||
if (shares == null) {
|
||||
shares = new ArrayList<Share>();
|
||||
shares = new ArrayList<>();
|
||||
}
|
||||
return this.shares;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,9 +2,6 @@ package com.cappielloantonio.play.subsonic.models;
|
|||
|
||||
import com.tickaroo.tikxml.annotation.Attribute;
|
||||
import com.tickaroo.tikxml.annotation.Xml;
|
||||
import com.tickaroo.tikxml.converters.date.rfc3339.DateRfc3339TypeConverter;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
@Xml(name = "similarArtist")
|
||||
public class SimilarArtistID3 {
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@ public class SimilarSongs {
|
|||
*/
|
||||
public List<Child> getSongs() {
|
||||
if (songs == null) {
|
||||
songs = new ArrayList<Child>();
|
||||
songs = new ArrayList<>();
|
||||
}
|
||||
return this.songs;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -30,7 +30,7 @@ public class Starred {
|
|||
*/
|
||||
public List<Artist> getArtists() {
|
||||
if (artists == null) {
|
||||
artists = new ArrayList<Artist>();
|
||||
artists = new ArrayList<>();
|
||||
}
|
||||
return this.artists;
|
||||
}
|
||||
|
|
@ -57,7 +57,7 @@ public class Starred {
|
|||
*/
|
||||
public List<Child> getAlbums() {
|
||||
if (albums == null) {
|
||||
albums = new ArrayList<Child>();
|
||||
albums = new ArrayList<>();
|
||||
}
|
||||
return this.albums;
|
||||
}
|
||||
|
|
@ -84,7 +84,7 @@ public class Starred {
|
|||
*/
|
||||
public List<Child> getSongs() {
|
||||
if (songs == null) {
|
||||
songs = new ArrayList<Child>();
|
||||
songs = new ArrayList<>();
|
||||
}
|
||||
return this.songs;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -46,7 +46,7 @@ public class User {
|
|||
*/
|
||||
public List<Integer> getFolders() {
|
||||
if (folders == null) {
|
||||
folders = new ArrayList<Integer>();
|
||||
folders = new ArrayList<>();
|
||||
}
|
||||
return this.folders;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@ public class Users {
|
|||
*/
|
||||
public List<User> getUsers() {
|
||||
if (users == null) {
|
||||
users = new ArrayList<User>();
|
||||
users = new ArrayList<>();
|
||||
}
|
||||
return this.users;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -31,7 +31,7 @@ public class VideoInfo {
|
|||
*/
|
||||
public List<Captions> getCaptions() {
|
||||
if (captions == null) {
|
||||
captions = new ArrayList<Captions>();
|
||||
captions = new ArrayList<>();
|
||||
}
|
||||
return this.captions;
|
||||
}
|
||||
|
|
@ -58,7 +58,7 @@ public class VideoInfo {
|
|||
*/
|
||||
public List<AudioTrack> getAudioTracks() {
|
||||
if (audioTracks == null) {
|
||||
audioTracks = new ArrayList<AudioTrack>();
|
||||
audioTracks = new ArrayList<>();
|
||||
}
|
||||
return this.audioTracks;
|
||||
}
|
||||
|
|
@ -85,7 +85,7 @@ public class VideoInfo {
|
|||
*/
|
||||
public List<VideoConversion> getConversions() {
|
||||
if (conversions == null) {
|
||||
conversions = new ArrayList<VideoConversion>();
|
||||
conversions = new ArrayList<>();
|
||||
}
|
||||
return this.conversions;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@ public class Videos {
|
|||
*/
|
||||
public List<Child> getVideos() {
|
||||
if (videos == null) {
|
||||
videos = new ArrayList<Child>();
|
||||
videos = new ArrayList<>();
|
||||
}
|
||||
return this.videos;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -9,13 +9,13 @@ public class StringUtil {
|
|||
try {
|
||||
MessageDigest digest = java.security.MessageDigest.getInstance(MD5);
|
||||
digest.update(s.getBytes());
|
||||
byte messageDigest[] = digest.digest();
|
||||
byte[] messageDigest = digest.digest();
|
||||
|
||||
StringBuilder hexString = new StringBuilder();
|
||||
for (byte aMessageDigest : messageDigest) {
|
||||
String h = Integer.toHexString(0xFF & aMessageDigest);
|
||||
StringBuilder h = new StringBuilder(Integer.toHexString(0xFF & aMessageDigest));
|
||||
while (h.length() < 2) {
|
||||
h = "0" + h;
|
||||
h.insert(0, "0");
|
||||
}
|
||||
hexString.append(h);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@ import com.tickaroo.tikxml.TypeConverter;
|
|||
public class ErrorCodeConverter implements TypeConverter<ErrorCode> {
|
||||
@Override
|
||||
public ErrorCode read(String value) throws Exception {
|
||||
return new ErrorCode(Integer.valueOf(value));
|
||||
return new ErrorCode(Integer.parseInt(value));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue