From def5f854fbf13bdbe29dea35850452ef3898e328 Mon Sep 17 00:00:00 2001 From: jvoisin Date: Sat, 8 Jun 2019 15:47:15 +0200 Subject: [PATCH] Inline some variables MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit There is no point in `Type a = …; return a;` --- .../java/org/airsonic/player/domain/TransferStatus.java | 3 +-- .../player/service/playlist/XspfPlaylistExportHandler.java | 3 +-- .../airsonic/player/service/upnp/PlaylistUpnpProcessor.java | 3 +-- .../src/test/java/org/airsonic/player/TestCaseUtils.java | 6 ++---- .../java/org/airsonic/player/dao/MusicFolderTestData.java | 3 +-- 5 files changed, 6 insertions(+), 12 deletions(-) diff --git a/airsonic-main/src/main/java/org/airsonic/player/domain/TransferStatus.java b/airsonic-main/src/main/java/org/airsonic/player/domain/TransferStatus.java index a21e6792..bb54599d 100644 --- a/airsonic-main/src/main/java/org/airsonic/player/domain/TransferStatus.java +++ b/airsonic-main/src/main/java/org/airsonic/player/domain/TransferStatus.java @@ -281,9 +281,8 @@ public class TransferStatus { @Override public String toString() { - String builder = "TransferStatus-" + hashCode() + " [player: " + player.getId() + ", file: " + + return "TransferStatus-" + hashCode() + " [player: " + player.getId() + ", file: " + file + ", terminated: " + terminated + ", active: " + active + "]"; - return builder; } /** diff --git a/airsonic-main/src/main/java/org/airsonic/player/service/playlist/XspfPlaylistExportHandler.java b/airsonic-main/src/main/java/org/airsonic/player/service/playlist/XspfPlaylistExportHandler.java index 04240222..24e4dbb4 100644 --- a/airsonic-main/src/main/java/org/airsonic/player/service/playlist/XspfPlaylistExportHandler.java +++ b/airsonic-main/src/main/java/org/airsonic/player/service/playlist/XspfPlaylistExportHandler.java @@ -31,8 +31,7 @@ public class XspfPlaylistExportHandler implements PlaylistExportHandler { @Override public SpecificPlaylist handle(int id, SpecificPlaylistProvider provider) throws Exception { - chameleon.playlist.xspf.Playlist playlist = createXsfpPlaylistFromDBId(id); - return playlist; + return createXsfpPlaylistFromDBId(id); } chameleon.playlist.xspf.Playlist createXsfpPlaylistFromDBId(int id) { diff --git a/airsonic-main/src/main/java/org/airsonic/player/service/upnp/PlaylistUpnpProcessor.java b/airsonic-main/src/main/java/org/airsonic/player/service/upnp/PlaylistUpnpProcessor.java index d0871a7a..a0a2f50f 100644 --- a/airsonic-main/src/main/java/org/airsonic/player/service/upnp/PlaylistUpnpProcessor.java +++ b/airsonic-main/src/main/java/org/airsonic/player/service/upnp/PlaylistUpnpProcessor.java @@ -56,8 +56,7 @@ public class PlaylistUpnpProcessor extends UpnpContentProcessor getAllItems() { - List playlists = getPlaylistService().getAllPlaylists(); - return playlists; + return getPlaylistService().getAllPlaylists(); } public Playlist getItemById(String id) throws Exception { diff --git a/airsonic-main/src/test/java/org/airsonic/player/TestCaseUtils.java b/airsonic-main/src/test/java/org/airsonic/player/TestCaseUtils.java index 50c8b5d0..99e17336 100644 --- a/airsonic-main/src/test/java/org/airsonic/player/TestCaseUtils.java +++ b/airsonic-main/src/test/java/org/airsonic/player/TestCaseUtils.java @@ -79,11 +79,9 @@ public class TestCaseUtils { "from information_schema.system_tables " + "where table_name not like 'SYSTEM%'" , String.class); - Map nbRecords = - tableNames.stream() - .collect(Collectors.toMap(table -> table, table -> recordsInTable(table,daoHelper))); - return nbRecords; + return tableNames.stream() + .collect(Collectors.toMap(table -> table, table -> recordsInTable(table,daoHelper))); } /** diff --git a/airsonic-main/src/test/java/org/airsonic/player/dao/MusicFolderTestData.java b/airsonic-main/src/test/java/org/airsonic/player/dao/MusicFolderTestData.java index 9a789b1f..b2c03870 100644 --- a/airsonic-main/src/test/java/org/airsonic/player/dao/MusicFolderTestData.java +++ b/airsonic-main/src/test/java/org/airsonic/player/dao/MusicFolderTestData.java @@ -12,8 +12,7 @@ public class MusicFolderTestData { private static String baseResources = "/MEDIAS/"; public static String resolveBaseMediaPath() { - String baseDir = MusicFolderTestData.class.getResource(baseResources).toString().replace("file:",""); - return baseDir; + return MusicFolderTestData.class.getResource(baseResources).toString().replace("file:",""); } public static String resolveMusicFolderPath() {