From d91363e2a6b962277111471e81d1c930fa7788c9 Mon Sep 17 00:00:00 2001 From: Aaron Date: Thu, 17 Dec 2020 10:08:11 -0800 Subject: [PATCH] Checkpoint --- src/main/java/org/dsa/iot/haystack/Haystack.java | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/src/main/java/org/dsa/iot/haystack/Haystack.java b/src/main/java/org/dsa/iot/haystack/Haystack.java index ce7c4a3..151388a 100755 --- a/src/main/java/org/dsa/iot/haystack/Haystack.java +++ b/src/main/java/org/dsa/iot/haystack/Haystack.java @@ -145,18 +145,26 @@ public void editConnection(String url, boolean enabled) { LOGGER.info("Edit Server url={} user={} enabled={}", url, user, enabled); node.setRoConfig("lu", new Value(0)); + stop(); List list = new ArrayList<>(node.getChildren().keySet()); for (String name : list) { - Node tmp = node.getChild(name); + Node tmp = node.getChild(name, false); + if (tmp == null) { + tmp = node.getChild(name, true); + } + if (tmp == null) { + continue; + } if (tmp.getAction() != null) { continue; } if (tmp.getRoConfig("navId") != null) { - node.removeChild(name, false); + if (node.removeChild(name, false) == null) { + node.removeChild(name, true); + } } } if (!enabled) { - stop(); Utils.getStatusNode(node).setValue(new Value("Disabled")); } else { conn.editConnection(url, user, pass, connTimeout, readTimeout);