Change casing and extract constant

Signed-off-by: Andrew DeMaria <lostonamountain@gmail.com>
master
Andrew DeMaria 5 years ago
parent d626463060
commit 05222d502b
No known key found for this signature in database
GPG Key ID: 0A3F5E91F8364EDF
  1. 6
      airsonic-main/src/main/java/org/airsonic/player/service/SettingsService.java
  2. 4
      airsonic-main/src/main/java/org/airsonic/player/service/UPnPService.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)";
@ -290,8 +292,8 @@ public class SettingsService {
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() {

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

Loading…
Cancel
Save