100% open-source IoT Platform - Integrate your devices, add intelligence, build custom apps
Java asset-managementbuildingdashboarddataplatformdevice-managementedge-computingenergyenergy-managementenergy-monitorfleet-managementfleet-telematicsiotiot-applicationiot-platformmodbusmqttmqtt-brokerota-updaterules-enginesmartcity
Fixes based on review comments
Rich Turner011a3cfedd34
diff --git a/manager/src/main/java/org/openremote/manager/gateway/GatewayConnector.java b/manager/src/main/java/org/openremote/manager/gateway/GatewayConnector.javaindex 789035c50..10f7dbd49 100644--- a/manager/src/main/java/org/openremote/manager/gateway/GatewayConnector.java+++ b/manager/src/main/java/org/openremote/manager/gateway/GatewayConnector.java@@ -188,8 +188,11 @@ public class GatewayConnector {this.sessionId.set(null);}- requestDisconnect.run();+ if (requestDisconnect != null) {+ requestDisconnect.run();+ }requestDisconnect = null;+LOG.info("Disconnected: " + getGatewayIdString());if (syncProcessorFuture != null) {LOG.finest("Aborting active sync process: " + getGatewayIdString());diff --git a/manager/src/main/java/org/openremote/manager/gateway/GatewayService.java b/manager/src/main/java/org/openremote/manager/gateway/GatewayService.javaindex d9495b68b..54d58c839 100644--- a/manager/src/main/java/org/openremote/manager/gateway/GatewayService.java+++ b/manager/src/main/java/org/openremote/manager/gateway/GatewayService.java@@ -810,15 +810,15 @@ public class GatewayService extends RouteBuilder implements ContainerService {String gatewayId = getGatewayIdFromClientId(gatewayClientId);GatewayConnector connector = gatewayConnectorMap.get(gatewayId.toLowerCase(Locale.ROOT));- try {- if (connector != null) {- // If a client is trying to cross realm boundaries do nothing- if (!Objects.equals(realm, connector.getRealm())) {- LOG.warning("Gateway disconnected with incorrect realm: GatewayID=" + gatewayId);- return;- }+ // If a client is trying to cross realm boundaries do nothing+ if (connector != null && !Objects.equals(realm, connector.getRealm())) {+ LOG.warning("Gateway disconnected with incorrect realm: GatewayID=" + gatewayId);+ return;+ }+ try {+ if (connector != null) {connector.disconnected(sessionId);}} finally {diff --git a/test/src/test/groovy/org/openremote/test/gateway/GatewayTest.groovy b/test/src/test/groovy/org/openremote/test/gateway/GatewayTest.groovyindex a1608ce44..26b91a5c0 100644--- a/test/src/test/groovy/org/openremote/test/gateway/GatewayTest.groovy+++ b/test/src/test/groovy/org/openremote/test/gateway/GatewayTest.groovy@@ -1554,7 +1554,7 @@ class GatewayTest extends Specification implements ManagerContainerTrait {and: "the building user then retrieves the list of tunnels for the fake gateway ID"def activeTunnels = gatewayResource.getGatewayActiveTunnelInfos(null, managerTestSetup.realmBuildingName, "fake-gateway-id")- then: "the smart city user should not be able to see any tunnels for the fake gateway ID in the building realm"+ then: "the building user should not be able to see any tunnels for the fake gateway ID in the smart city realm"assert activeTunnels.length == 0cleanup: "the fake tunnel is removed"