From a30e9a6b2cc3eb7d203f6f9615d1434defaa7286 Mon Sep 17 00:00:00 2001 From: Roland Haeder Date: Fri, 14 Mar 2014 23:34:40 +0100 Subject: [PATCH] Added check for NULL + renamed XML nodes. Signed-off-by: Roland Haeder --- .../class_XmlDhtBootstrapTemplateEngine.php | 19 ++++++++++--------- .../template/class_BaseXmlTemplateEngine.php | 6 ++++++ .../templates/xml/dht_bootstrap/bootstrap.xml | 8 ++++---- 3 files changed, 20 insertions(+), 13 deletions(-) diff --git a/application/hub/main/template/bootstrap/class_XmlDhtBootstrapTemplateEngine.php b/application/hub/main/template/bootstrap/class_XmlDhtBootstrapTemplateEngine.php index 7c6810df3..ffe95da9d 100644 --- a/application/hub/main/template/bootstrap/class_XmlDhtBootstrapTemplateEngine.php +++ b/application/hub/main/template/bootstrap/class_XmlDhtBootstrapTemplateEngine.php @@ -26,12 +26,13 @@ class XmlDhtBootstrapTemplateEngine extends BaseXmlTemplateEngine implements Com /** * Some XML nodes must be available for later data extraction */ - const DHT_BOOTSTRAP_DATA_SESSION_ID = 'session-id'; - const DHT_BOOTSTRAP_DATA_NODE_STATUS = 'node-status'; - const DHT_BOOTSTRAP_DATA_NODE_MODE = 'node-mode'; - const DHT_BOOTSTRAP_DATA_EXTERNAL_IP = 'external-ip'; - const DHT_BOOTSTRAP_DATA_INTERNAL_IP = 'internal-ip'; - const DHT_BOOTSTRAP_DATA_LISTEN_PORT = 'listen-port'; + const DHT_BOOTSTRAP_DATA_BOOTSTRAP_DATA = 'dht-bootstrap-data'; + const DHT_BOOTSTRAP_DATA_SESSION_ID = 'session-id'; + const DHT_BOOTSTRAP_DATA_NODE_STATUS = 'node-status'; + const DHT_BOOTSTRAP_DATA_NODE_MODE = 'node-mode'; + const DHT_BOOTSTRAP_DATA_EXTERNAL_IP = 'external-ip'; + const DHT_BOOTSTRAP_DATA_INTERNAL_IP = 'internal-ip'; + const DHT_BOOTSTRAP_DATA_LISTEN_PORT = 'listen-port'; /** * Protected constructor @@ -44,7 +45,7 @@ class XmlDhtBootstrapTemplateEngine extends BaseXmlTemplateEngine implements Com // Init array $this->subNodes = array( - 'bootstrap-data', + self::DHT_BOOTSTRAP_DATA_BOOTSTRAP_DATA, 'listener', self::DHT_BOOTSTRAP_DATA_NODE_STATUS, self::DHT_BOOTSTRAP_DATA_NODE_MODE, @@ -118,7 +119,7 @@ class XmlDhtBootstrapTemplateEngine extends BaseXmlTemplateEngine implements Com */ protected function startBootstrap () { // Push the node name on the stacker - $this->getStackerInstance()->pushNamed('dht_bootstrap', 'bootstrap'); + $this->getStackerInstance()->pushNamed('dht_bootstrap', 'dht-bootstrap'); } /** @@ -128,7 +129,7 @@ class XmlDhtBootstrapTemplateEngine extends BaseXmlTemplateEngine implements Com */ protected function startBootstrapData () { // Push the node name on the stacker - $this->getStackerInstance()->pushNamed('dht_bootstrap', 'bootstrap-data'); + $this->getStackerInstance()->pushNamed('dht_bootstrap', self::DHT_BOOTSTRAP_DATA_BOOTSTRAP_DATA); } /** diff --git a/application/hub/main/template/class_BaseXmlTemplateEngine.php b/application/hub/main/template/class_BaseXmlTemplateEngine.php index a06023f1f..0f9ed2250 100644 --- a/application/hub/main/template/class_BaseXmlTemplateEngine.php +++ b/application/hub/main/template/class_BaseXmlTemplateEngine.php @@ -211,6 +211,12 @@ class BaseXmlTemplateEngine extends BaseTemplateEngine { // Read the variable $value = parent::readVariable($key, 'general'); + // Is this null? + if (is_null($value)) { + // Bah, needs fixing. + $this->debugInstance('key=' . $key . ' returns NULL'); + } // END - if + // Return value return $value; } diff --git a/application/hub/templates/xml/dht_bootstrap/bootstrap.xml b/application/hub/templates/xml/dht_bootstrap/bootstrap.xml index 3e6c48e6e..e3ca8e6b9 100644 --- a/application/hub/templates/xml/dht_bootstrap/bootstrap.xml +++ b/application/hub/templates/xml/dht_bootstrap/bootstrap.xml @@ -21,7 +21,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see //--> - + - + {?node_status?} @@ -49,5 +49,5 @@ along with this program. If not, see {?node_listen_port?} - - + + -- 2.39.5