From 05222d502bf30ce0d6af44c1dc1299da0969e5da Mon Sep 17 00:00:00 2001 From: Andrew DeMaria Date: Sat, 23 Nov 2019 14:32:46 -0700 Subject: [PATCH] Change casing and extract constant Signed-off-by: Andrew DeMaria --- .../java/org/airsonic/player/service/SettingsService.java | 8 +++++--- .../java/org/airsonic/player/service/UPnPService.java | 4 ++-- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/airsonic-main/src/main/java/org/airsonic/player/service/SettingsService.java b/airsonic-main/src/main/java/org/airsonic/player/service/SettingsService.java index b4fb4564..23e7d320 100644 --- a/airsonic-main/src/main/java/org/airsonic/player/service/SettingsService.java +++ b/airsonic-main/src/main/java/org/airsonic/player/service/SettingsService.java @@ -131,6 +131,8 @@ public class SettingsService { private static final String KEY_DATABASE_MYSQL_VARCHAR_MAXLENGTH = "DatabaseMysqlMaxlength"; private static final String KEY_DATABASE_USERTABLE_QUOTE = "DatabaseUsertableQuote"; + private static final String KEY_UPNP_PORT = "UPNP_PORT"; + // Default values. private static final String DEFAULT_JWT_KEY = null; private static final String DEFAULT_INDEX_STRING = "A B C D E F G H I J K L M N O P Q R S T U V W X-Z(XYZ)"; @@ -289,9 +291,9 @@ public class SettingsService { public static String getDefaultJDBCUrl() { return "jdbc:hsqldb:file:" + getAirsonicHome().getPath() + "/db/" + getFileSystemAppName(); } - - public static int getDefaultUPnpPort() { - return Optional.ofNullable(System.getProperty("UPNP_PORT")).map(x -> Integer.parseInt(x)).orElse(DEFAULT_UPNP_PORT); + + public static int getDefaultUPnPPort() { + return Optional.ofNullable(System.getProperty(KEY_UPNP_PORT)).map(x -> Integer.parseInt(x)).orElse(DEFAULT_UPNP_PORT); } public static File getLogFile() { diff --git a/airsonic-main/src/main/java/org/airsonic/player/service/UPnPService.java b/airsonic-main/src/main/java/org/airsonic/player/service/UPnPService.java index 827decd6..c5e857d1 100644 --- a/airsonic-main/src/main/java/org/airsonic/player/service/UPnPService.java +++ b/airsonic-main/src/main/java/org/airsonic/player/service/UPnPService.java @@ -115,14 +115,14 @@ public class UPnPService { try { LOG.info("Starting UPnP service..."); createService(); - LOG.info("Successfully started UPnP service on port {}!", SettingsService.getDefaultUPnpPort()); + LOG.info("Successfully started UPnP service on port {}!", SettingsService.getDefaultUPnPPort()); } catch (Throwable x) { LOG.error("Failed to start UPnP service: " + x, x); } } private synchronized void createService() { - upnpService = new UpnpServiceImpl(new DefaultUpnpServiceConfiguration(SettingsService.getDefaultUPnpPort())); + upnpService = new UpnpServiceImpl(new DefaultUpnpServiceConfiguration(SettingsService.getDefaultUPnPPort())); // Asynch search for other devices (most importantly UPnP-enabled routers for port-mapping) upnpService.getControlPoint().search();