From 7f571b3c5287f288c21c8e3d7fadaad559a2edb7 Mon Sep 17 00:00:00 2001 From: Shams Ul Azeem Date: Mon, 25 Jan 2021 04:13:34 +0500 Subject: [PATCH] Fixing DL4J UI system property for getting port value (#9162) Signed-off-by: shamsulazeem --- .../src/main/java/org/deeplearning4j/ui/VertxUIServer.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/deeplearning4j/deeplearning4j-ui-parent/deeplearning4j-vertx/src/main/java/org/deeplearning4j/ui/VertxUIServer.java b/deeplearning4j/deeplearning4j-ui-parent/deeplearning4j-vertx/src/main/java/org/deeplearning4j/ui/VertxUIServer.java index 56a3f2e63..ddc8187e4 100644 --- a/deeplearning4j/deeplearning4j-ui-parent/deeplearning4j-vertx/src/main/java/org/deeplearning4j/ui/VertxUIServer.java +++ b/deeplearning4j/deeplearning4j-ui-parent/deeplearning4j-vertx/src/main/java/org/deeplearning4j/ui/VertxUIServer.java @@ -369,7 +369,7 @@ public class VertxUIServer extends AbstractVerticle implements UIServer { //Check port property int port = instancePort == null ? DEFAULT_UI_PORT : instancePort; - String portProp = System.getenv(DL4JSystemProperties.UI_SERVER_PORT_PROPERTY); + String portProp = System.getProperty(DL4JSystemProperties.UI_SERVER_PORT_PROPERTY); if(portProp != null && !portProp.isEmpty()){ try{ port = Integer.parseInt(portProp); @@ -378,6 +378,10 @@ public class VertxUIServer extends AbstractVerticle implements UIServer { } } + if (port < 0 || port > 0xFFFF) { + throw new IllegalStateException("Valid port range is 0 <= port <= 65535. The given port was " + port); + } + uiEventRoutingThread = new Thread(new StatsEventRouterRunnable()); uiEventRoutingThread.setDaemon(true); uiEventRoutingThread.start();