From 7756c313e101f012af9c3ccfc378308f4f03f603 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Roland=20H=C3=A4der?= Date: Thu, 25 Jul 2013 02:21:20 +0000 Subject: [PATCH] Added exceptions + some code: - Added two more exceptions for DHT database wrapper - Added some code that will check for correct conditions in registerNode() and updateNode() and makes use of above mentioned exceptions - Converted more double-quotes to single --- .gitattributes | 3 ++ application/hub/class_ApplicationHelper.php | 2 +- ...class_AnnouncementNotAcceptedException.php | 2 +- ...class_NoAnnouncementAttemptedException.php | 2 +- .../class_InvalidConnectionTypeException.php | 2 +- .../ids/class_InvalidSessionIdException.php | 2 +- .../lists/class_InvalidListHashException.php | 2 +- .../class_ListGroupAlreadyAddedException.php | 2 +- .../lists/class_NoListGroupException.php | 2 +- .../class_NodeAlreadyAnnouncedException.php | 2 +- ...lass_NodeSessionIdVerficationException.php | 2 +- .../class_FinalChunkVerificationException.php | 2 +- .../class_InvalidDataChecksumException.php | 2 +- ...class_UnexpectedPackageStatusException.php | 2 +- ...UnsupportedPackageCodeHandlerException.php | 2 +- .../class_PeerAlreadyRegisteredException.php | 2 +- .../class_NoValidHostnameException.php | 2 +- .../state/class_InvalidStateException.php | 2 +- .../tags/class_InvalidTagException.php | 2 +- .../tasks/class_InvalidTaskException.php | 2 +- application/hub/exceptions/wrapper/.htaccess | 1 + .../class_NodeAlreadyRegisteredException.php | 48 +++++++++++++++++++ .../class_NodeDataMissingException.php | 48 +++++++++++++++++++ ...odeDistributedHashTableDatabaseWrapper.php | 23 ++++++++- .../connection/class_BaseConnectionHelper.php | 2 +- .../registry/socket/class_SocketRegistry.php | 2 +- .../class_BaseXmlAnswerTemplateEngine.php | 2 +- index.php | 2 +- 28 files changed, 144 insertions(+), 25 deletions(-) create mode 100644 application/hub/exceptions/wrapper/.htaccess create mode 100644 application/hub/exceptions/wrapper/class_NodeAlreadyRegisteredException.php create mode 100644 application/hub/exceptions/wrapper/class_NodeDataMissingException.php diff --git a/.gitattributes b/.gitattributes index 166d3d5b6..f632eae55 100644 --- a/.gitattributes +++ b/.gitattributes @@ -42,6 +42,9 @@ application/hub/exceptions/tags/.htaccess -text svneol=unset#text/plain application/hub/exceptions/tags/class_InvalidTagException.php svneol=native#text/plain application/hub/exceptions/tasks/.htaccess -text svneol=unset#text/plain application/hub/exceptions/tasks/class_InvalidTaskException.php svneol=native#text/plain +application/hub/exceptions/wrapper/.htaccess -text svneol=unset#text/plain +application/hub/exceptions/wrapper/class_NodeAlreadyRegisteredException.php svneol=native#text/plain +application/hub/exceptions/wrapper/class_NodeDataMissingException.php svneol=native#text/plain application/hub/init.php svneol=native#text/plain application/hub/interfaces/.htaccess -text svneol=unset#text/plain application/hub/interfaces/apt-proxy/.htaccess svneol=native#text/plain diff --git a/application/hub/class_ApplicationHelper.php b/application/hub/class_ApplicationHelper.php index 6c1f8858b..afadcc1b0 100644 --- a/application/hub/class_ApplicationHelper.php +++ b/application/hub/class_ApplicationHelper.php @@ -176,7 +176,7 @@ class ApplicationHelper extends BaseFrameworkSystem implements ManageableApplica } // END - if // ... and a new response object - $responseClass = sprintf("%sResponse", $this->convertToClassName($response)); + $responseClass = sprintf('%sResponse', $this->convertToClassName($response)); $responseInstance = ObjectFactory::createObjectByName($responseClass, array($this)); // Remember response instance here diff --git a/application/hub/exceptions/announcement/class_AnnouncementNotAcceptedException.php b/application/hub/exceptions/announcement/class_AnnouncementNotAcceptedException.php index 6524cb036..2fbbde8ab 100644 --- a/application/hub/exceptions/announcement/class_AnnouncementNotAcceptedException.php +++ b/application/hub/exceptions/announcement/class_AnnouncementNotAcceptedException.php @@ -32,7 +32,7 @@ class AnnouncementNotAcceptedException extends FrameworkException { */ public function __construct (array $messageArray, $code) { // Construct the message - $message = sprintf("[%s:%d] This node (%s) is not accepting announcements, but got one from session-id=%s,ip=%s/%s,listen port=%s,status=%s,mode=%s", + $message = sprintf('[%s:%d] This node (%s) is not accepting announcements, but got one from session-id=%s,ip=%s/%s,listen port=%s,status=%s,mode=%s', $messageArray[0]->__toString(), $this->getLine(), $messageArray[1]->__toString(), diff --git a/application/hub/exceptions/announcement/class_NoAnnouncementAttemptedException.php b/application/hub/exceptions/announcement/class_NoAnnouncementAttemptedException.php index 13a9f29f7..3cc4a1d6e 100644 --- a/application/hub/exceptions/announcement/class_NoAnnouncementAttemptedException.php +++ b/application/hub/exceptions/announcement/class_NoAnnouncementAttemptedException.php @@ -32,7 +32,7 @@ class NoAnnouncementAttemptedException extends FrameworkException { */ public function __construct (array $messageArray, $code) { // Construct the message - $message = sprintf("[%s:%d] This node (%s) has not attempted to announce itself, but got an answer from session-id=%s,ip=%s/%s,listen port=%s,status=%s.", + $message = sprintf('[%s:%d] This node (%s) has not attempted to announce itself, but got an answer from session-id=%s,ip=%s/%s,listen port=%s,status=%s.', $messageArray[0]->__toString(), $this->getLine(), $messageArray[1]->__toString(), diff --git a/application/hub/exceptions/connection/class_InvalidConnectionTypeException.php b/application/hub/exceptions/connection/class_InvalidConnectionTypeException.php index 1c508bd9e..325a48eae 100644 --- a/application/hub/exceptions/connection/class_InvalidConnectionTypeException.php +++ b/application/hub/exceptions/connection/class_InvalidConnectionTypeException.php @@ -31,7 +31,7 @@ class InvalidConnectionTypeException extends FrameworkException { */ public function __construct (array $messageArray, $code) { // Construct the message - $message = sprintf("[%s:%d] Connection type %s is invalid.", + $message = sprintf('[%s:%d] Connection type %s is invalid.', $messageArray[0]->__toString(), $this->getLine(), $messageArray[1] diff --git a/application/hub/exceptions/ids/class_InvalidSessionIdException.php b/application/hub/exceptions/ids/class_InvalidSessionIdException.php index 65ae417a8..7cc1a49d4 100644 --- a/application/hub/exceptions/ids/class_InvalidSessionIdException.php +++ b/application/hub/exceptions/ids/class_InvalidSessionIdException.php @@ -31,7 +31,7 @@ class InvalidSessionIdException extends FrameworkException { */ public function __construct ($sessionId, $code) { // Construct the message - $message = sprintf("Session id %s is invalid.", + $message = sprintf('Session id %s is invalid.', $sessionId ); diff --git a/application/hub/exceptions/lists/class_InvalidListHashException.php b/application/hub/exceptions/lists/class_InvalidListHashException.php index 30eb3503b..a4d89cf33 100644 --- a/application/hub/exceptions/lists/class_InvalidListHashException.php +++ b/application/hub/exceptions/lists/class_InvalidListHashException.php @@ -31,7 +31,7 @@ class InvalidListHashException extends FrameworkException { */ public function __construct (array $messageArray, $code) { // Construct the message - $message = sprintf("[%s:%d] Hash %s with key %s is invalid.", + $message = sprintf('[%s:%d] Hash %s with key %s is invalid.', $messageArray[0]->__toString(), $this->getLine(), $messageArray[1], diff --git a/application/hub/exceptions/lists/class_ListGroupAlreadyAddedException.php b/application/hub/exceptions/lists/class_ListGroupAlreadyAddedException.php index b9ecfc0a3..85321a7a5 100644 --- a/application/hub/exceptions/lists/class_ListGroupAlreadyAddedException.php +++ b/application/hub/exceptions/lists/class_ListGroupAlreadyAddedException.php @@ -31,7 +31,7 @@ class ListGroupAlreadyAddedException extends FrameworkException { */ public function __construct (array $messageArray, $code) { // Construct the message - $message = sprintf("[%s:%d] List group %s has already been added.", + $message = sprintf('[%s:%d] List group %s has already been added.', $messageArray[0]->__toString(), $this->getLine(), $messageArray[1] diff --git a/application/hub/exceptions/lists/class_NoListGroupException.php b/application/hub/exceptions/lists/class_NoListGroupException.php index 55766b261..fac04d721 100644 --- a/application/hub/exceptions/lists/class_NoListGroupException.php +++ b/application/hub/exceptions/lists/class_NoListGroupException.php @@ -31,7 +31,7 @@ class NoListGroupException extends FrameworkException { */ public function __construct (array $messageArray, $code) { // Construct the message - $message = sprintf("[%s:%d] List group %s was not found.", + $message = sprintf('[%s:%d] List group %s was not found.', $messageArray[0]->__toString(), $this->getLine(), $messageArray[1] diff --git a/application/hub/exceptions/node/class_NodeAlreadyAnnouncedException.php b/application/hub/exceptions/node/class_NodeAlreadyAnnouncedException.php index c0b970438..ccb9fbe49 100644 --- a/application/hub/exceptions/node/class_NodeAlreadyAnnouncedException.php +++ b/application/hub/exceptions/node/class_NodeAlreadyAnnouncedException.php @@ -31,7 +31,7 @@ class NodeAlreadyAnnouncedException extends FrameworkException { */ public function __construct (NodeHelper $nodeInstance, $code) { // Construct the message - $message = sprintf("[%s:%d] This node is already announced. Please fix this.", + $message = sprintf('[%s:%d] This node is already announced. Please fix this.', $nodeInstance->__toString(), $this->getLine() ); diff --git a/application/hub/exceptions/node/class_NodeSessionIdVerficationException.php b/application/hub/exceptions/node/class_NodeSessionIdVerficationException.php index 7f4e20646..f145dfbe9 100644 --- a/application/hub/exceptions/node/class_NodeSessionIdVerficationException.php +++ b/application/hub/exceptions/node/class_NodeSessionIdVerficationException.php @@ -33,7 +33,7 @@ class NodeSessionIdVerficationException extends FrameworkException { */ public function __construct (array $messageArray, $code) { // Construct the message - $message = sprintf("[%s:%d] Session id %s cannot be verfied. ip=%s/%s,listen port=%s,status=%s.", + $message = sprintf('[%s:%d] Session id %s cannot be verfied. ip=%s/%s,listen port=%s,status=%s.', $messageArray[0]->__toString(), $this->getLine(), $messageArray[1][XmlAnnouncementAnswerTemplateEngine::ANNOUNCEMENT_DATA_SESSION_ID], diff --git a/application/hub/exceptions/package/class_FinalChunkVerificationException.php b/application/hub/exceptions/package/class_FinalChunkVerificationException.php index 5fb73545c..d889fe3fd 100644 --- a/application/hub/exceptions/package/class_FinalChunkVerificationException.php +++ b/application/hub/exceptions/package/class_FinalChunkVerificationException.php @@ -32,7 +32,7 @@ class FinalChunkVerificationException extends FrameworkException { */ public function __construct (array $messageArray, $code) { // Construct the message - $message = sprintf("[%s:%d] The final chunk %s is not a valid EOP (%s) chunk. Total chunks: %s, cause: %s", + $message = sprintf('[%s:%d] The final chunk %s is not a valid EOP (%s) chunk. Total chunks: %s, cause: %s', $messageArray[0]->__toString(), $this->getLine(), $messageArray[1][count($messageArray[1]) - 1], diff --git a/application/hub/exceptions/package/class_InvalidDataChecksumException.php b/application/hub/exceptions/package/class_InvalidDataChecksumException.php index a861b9443..5bb084dac 100644 --- a/application/hub/exceptions/package/class_InvalidDataChecksumException.php +++ b/application/hub/exceptions/package/class_InvalidDataChecksumException.php @@ -32,7 +32,7 @@ class InvalidDataChecksumException extends FrameworkException { */ public function __construct (array $messageArray, $code) { // Construct the message - $message = sprintf("[%s:%d] The checksum %s doesn't match the checksum of the content: %s", + $message = sprintf('[%s:%d] The checksum %s doesnt match the checksum of the content: %s', $messageArray[0]->__toString(), $this->getLine(), $messageArray[0]->getHashFromContentSessionId($messageArray[1], $messageArray[2][NetworkPackage::PACKAGE_DATA_SENDER]), diff --git a/application/hub/exceptions/package/class_UnexpectedPackageStatusException.php b/application/hub/exceptions/package/class_UnexpectedPackageStatusException.php index 9f51fc313..58d07d5b2 100644 --- a/application/hub/exceptions/package/class_UnexpectedPackageStatusException.php +++ b/application/hub/exceptions/package/class_UnexpectedPackageStatusException.php @@ -31,7 +31,7 @@ class UnexpectedPackageStatusException extends FrameworkException { */ public function __construct (array $messageArray, $code) { // Construct the message - $message = sprintf("[%s:%d] Unexpected package status %s!=%s detected, recipient=%s, sender=%s, signature=%s.", + $message = sprintf('[%s:%d] Unexpected package status %s!=%s detected, recipient=%s, sender=%s, signature=%s.', $messageArray[0]->__toString(), $this->getLine(), $messageArray[1][NetworkPackage::PACKAGE_DATA_STATUS], diff --git a/application/hub/exceptions/package/class_UnsupportedPackageCodeHandlerException.php b/application/hub/exceptions/package/class_UnsupportedPackageCodeHandlerException.php index a0daadb77..a469032aa 100644 --- a/application/hub/exceptions/package/class_UnsupportedPackageCodeHandlerException.php +++ b/application/hub/exceptions/package/class_UnsupportedPackageCodeHandlerException.php @@ -31,7 +31,7 @@ class UnsupportedPackageCodeHandlerException extends FrameworkException { */ public function __construct (array $messageArray, $code) { // Construct the message - $message = sprintf("[%s:%d] Unsupported package code handler %s for package code %s detected.", + $message = sprintf('[%s:%d] Unsupported package code handler %s for package code %s detected.', $messageArray[0]->__toString(), $this->getLine(), $messageArray[1], diff --git a/application/hub/exceptions/peer/class_PeerAlreadyRegisteredException.php b/application/hub/exceptions/peer/class_PeerAlreadyRegisteredException.php index bfefba3f4..989056735 100644 --- a/application/hub/exceptions/peer/class_PeerAlreadyRegisteredException.php +++ b/application/hub/exceptions/peer/class_PeerAlreadyRegisteredException.php @@ -31,7 +31,7 @@ class PeerAlreadyRegisteredException extends FrameworkException { */ public function __construct (array $messageArray, $code) { // Construct the message - $message = sprintf("[%s:%d] Sender %s is already registered.", + $message = sprintf('[%s:%d] Sender %s is already registered.', $messageArray[0]->__toString(), $this->getLine(), $messageArray[1][NetworkPackage::PACKAGE_DATA_SENDER] diff --git a/application/hub/exceptions/resolver/class_NoValidHostnameException.php b/application/hub/exceptions/resolver/class_NoValidHostnameException.php index 2eeb24cac..5dd3873bc 100644 --- a/application/hub/exceptions/resolver/class_NoValidHostnameException.php +++ b/application/hub/exceptions/resolver/class_NoValidHostnameException.php @@ -31,7 +31,7 @@ class NoValidHostnameException extends FrameworkException { */ public function __construct (array $hostName, $code) { // Construct the message - $message = sprintf("Hostname %s cannot be resolved. Port=%d", + $message = sprintf('Hostname %s cannot be resolved. Port=%d', $hostName[0], $hostName[1] ); diff --git a/application/hub/exceptions/state/class_InvalidStateException.php b/application/hub/exceptions/state/class_InvalidStateException.php index 630fc51d5..0c758a68e 100644 --- a/application/hub/exceptions/state/class_InvalidStateException.php +++ b/application/hub/exceptions/state/class_InvalidStateException.php @@ -31,7 +31,7 @@ class InvalidStateException extends FrameworkException { */ public function __construct (Stateable $stateInstance, $code) { // Construct the message - $message = sprintf("[%s:%d] Unexpected state detected.", + $message = sprintf('[%s:%d] Unexpected state detected.', $stateInstance->__toString(), $this->getLine() ); diff --git a/application/hub/exceptions/tags/class_InvalidTagException.php b/application/hub/exceptions/tags/class_InvalidTagException.php index 454991883..5e4efd942 100644 --- a/application/hub/exceptions/tags/class_InvalidTagException.php +++ b/application/hub/exceptions/tags/class_InvalidTagException.php @@ -31,7 +31,7 @@ class InvalidTagException extends FrameworkException { */ public function __construct (array $messageArray, $code) { // Construct the message - $message = sprintf("[%s:%d] Tag %s is invalid.", + $message = sprintf('[%s:%d] Tag %s is invalid.', $messageArray[0]->__toString(), $this->getLine(), $messageArray[1] diff --git a/application/hub/exceptions/tasks/class_InvalidTaskException.php b/application/hub/exceptions/tasks/class_InvalidTaskException.php index 41ddc0c2b..8505fdaca 100644 --- a/application/hub/exceptions/tasks/class_InvalidTaskException.php +++ b/application/hub/exceptions/tasks/class_InvalidTaskException.php @@ -31,7 +31,7 @@ class InvalidTaskException extends FrameworkException { */ public function __construct (array $messageArray, $code) { // Construct the message - $message = sprintf("[%s:%d] Current task is invalid which should not happen.", + $message = sprintf('[%s:%d] Current task is invalid which should not happen.', $messageArray[0]->__toString(), $this->getLine() ); diff --git a/application/hub/exceptions/wrapper/.htaccess b/application/hub/exceptions/wrapper/.htaccess new file mode 100644 index 000000000..3a4288278 --- /dev/null +++ b/application/hub/exceptions/wrapper/.htaccess @@ -0,0 +1 @@ +Deny from all diff --git a/application/hub/exceptions/wrapper/class_NodeAlreadyRegisteredException.php b/application/hub/exceptions/wrapper/class_NodeAlreadyRegisteredException.php new file mode 100644 index 000000000..5cfb66dee --- /dev/null +++ b/application/hub/exceptions/wrapper/class_NodeAlreadyRegisteredException.php @@ -0,0 +1,48 @@ + + * @version 0.0.0 + * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 - 2012 Hub Developer Team + * @license GNU GPL 3.0 or any newer version + * @link http://www.ship-simu.org + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * 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 . + */ +class NodeAlreadyRegisteredException extends FrameworkException { + /** + * The super constructor for all exceptions + * + * @param $messageArray Error message array + * @param $code Error code + * @return void + */ + public function __construct (array $messageArray, $code) { + // Construct the message + $message = sprintf('[%s:%d] Node already registered: session-id=%s, external-ip=%s, listen-port=%s', + $messageArray[0]->__toString(), + $this->getLine(), + $msssageArray[1][NodeDistributedHashTableDatabaseWrapper::DB_COLUMN_SESSION_ID], + $msssageArray[1][NodeDistributedHashTableDatabaseWrapper::DB_COLUMN_EXTERNAL_IP], + $msssageArray[1][NodeDistributedHashTableDatabaseWrapper::DB_COLUMN_LISTEN_PORT], + ); + + // Call parent exception constructor + parent::__construct($message, $code); + } +} + +// [EOF] +?> diff --git a/application/hub/exceptions/wrapper/class_NodeDataMissingException.php b/application/hub/exceptions/wrapper/class_NodeDataMissingException.php new file mode 100644 index 000000000..0fbe4249a --- /dev/null +++ b/application/hub/exceptions/wrapper/class_NodeDataMissingException.php @@ -0,0 +1,48 @@ + + * @version 0.0.0 + * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 - 2012 Hub Developer Team + * @license GNU GPL 3.0 or any newer version + * @link http://www.ship-simu.org + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * 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 . + */ +class NodeDataMissingException extends FrameworkException { + /** + * The super constructor for all exceptions + * + * @param $messageArray Error message array + * @param $code Error code + * @return void + */ + public function __construct (array $messageArray, $code) { + // Construct the message + $message = sprintf('[%s:%d] Node not registered/missing: session-id=%s, external-ip=%s, listen-port=%s', + $messageArray[0]->__toString(), + $this->getLine(), + $msssageArray[1][NodeDistributedHashTableDatabaseWrapper::DB_COLUMN_SESSION_ID], + $msssageArray[1][NodeDistributedHashTableDatabaseWrapper::DB_COLUMN_EXTERNAL_IP], + $msssageArray[1][NodeDistributedHashTableDatabaseWrapper::DB_COLUMN_LISTEN_PORT], + ); + + // Call parent exception constructor + parent::__construct($message, $code); + } +} + +// [EOF] +?> diff --git a/application/hub/main/database/wrapper/node/class_NodeDistributedHashTableDatabaseWrapper.php b/application/hub/main/database/wrapper/node/class_NodeDistributedHashTableDatabaseWrapper.php index 967941664..0beb31c0d 100644 --- a/application/hub/main/database/wrapper/node/class_NodeDistributedHashTableDatabaseWrapper.php +++ b/application/hub/main/database/wrapper/node/class_NodeDistributedHashTableDatabaseWrapper.php @@ -34,6 +34,11 @@ class NodeDistributedHashTableDatabaseWrapper extends BaseDatabaseWrapper implem const DB_COLUMN_PRIVATE_KEY_HASH = 'private_key_hash'; const DB_COLUMN_NODE_MODE = 'node_mode'; const DB_COLUMN_ACCEPTED_OBJECTS = 'accepted_object_types'; + const DB_COLUMN_NODE_LIST = 'node_list'; + + // Exception codes + const EXCEPTION_NODE_ALREADY_REGISTERED = 0x800; + const EXCEPTION_NODE_NOT_REGISTERED = 0x801; /** * Protected constructor @@ -230,7 +235,7 @@ class NodeDistributedHashTableDatabaseWrapper extends BaseDatabaseWrapper implem $handlerInstance->addArrayToDataSet($dataSetInstance, $messageData); // Remove 'node_list' - $dataSetInstance->unsetCriteria('node_list'); + $dataSetInstance->unsetCriteria(self::DB_COLUMN_NODE_LIST); // Run the "INSERT" query $this->queryInsertDataSet($dataSetInstance); @@ -258,7 +263,7 @@ class NodeDistributedHashTableDatabaseWrapper extends BaseDatabaseWrapper implem $handlerInstance->addArrayToDataSet($dataSetInstance, $messageData); // Remove 'node_list' - $dataSetInstance->unsetCriteria('node_list'); + $dataSetInstance->unsetCriteria(self::DB_COLUMN_NODE_LIST); // Run the "UPDATE" query $this->queryUpdateDataSet($dataSetInstance); @@ -297,6 +302,13 @@ class NodeDistributedHashTableDatabaseWrapper extends BaseDatabaseWrapper implem * @throws NodeAlreadyRegisteredException If the node is already registered */ public function registerNode (array $nodeData) { + // Is the node registered? + if ($this->isNodeRegistered($nodeData)) { + // Throw an exception + throw new NodeAlreadyRegisteredException(array($this, $nodeData), self::EXCEPTION_NODE_ALREADY_REGISTERED); + } // END - if + + // @TODO Unimplemented part $this->partialStub('nodeData=' . print_r($nodeData, TRUE)); } @@ -310,6 +322,13 @@ class NodeDistributedHashTableDatabaseWrapper extends BaseDatabaseWrapper implem * @throws NodeDataMissingException If the node's data is missing */ public function updateNode (array $nodeData) { + // Is the node registered? + if (!$this->isNodeRegistered($nodeData)) { + // No, then throw an exception + throw new NodeDataMissingException(array($this, $nodeData), self::EXCEPTION_NODE_NOT_REGISTERED); + } // END - if + + // @TODO Unimplemented part $this->partialStub('nodeData=' . print_r($nodeData, TRUE)); } } diff --git a/application/hub/main/helper/connection/class_BaseConnectionHelper.php b/application/hub/main/helper/connection/class_BaseConnectionHelper.php index 116903ec5..bf0897653 100644 --- a/application/hub/main/helper/connection/class_BaseConnectionHelper.php +++ b/application/hub/main/helper/connection/class_BaseConnectionHelper.php @@ -23,7 +23,7 @@ */ class BaseConnectionHelper extends BaseHubSystemHelper implements Registerable, ProtocolHandler { // Exception codes - const EXCEPTION_UNSUPPORTED_ERROR_HANDLER = 0x900; + const EXCEPTION_UNSUPPORTED_ERROR_HANDLER = 0x9100; /** * Connection type 'incoming' diff --git a/application/hub/main/registry/socket/class_SocketRegistry.php b/application/hub/main/registry/socket/class_SocketRegistry.php index d03d2eead..0041ec956 100644 --- a/application/hub/main/registry/socket/class_SocketRegistry.php +++ b/application/hub/main/registry/socket/class_SocketRegistry.php @@ -23,7 +23,7 @@ */ class SocketRegistry extends BaseRegistry implements Register, RegisterableSocket { // Exception constants - const SOCKET_NOT_REGISTERED = 0xd00; + const SOCKET_NOT_REGISTERED = 0xd200; /** * Instance of this class diff --git a/application/hub/main/template/answer/class_BaseXmlAnswerTemplateEngine.php b/application/hub/main/template/answer/class_BaseXmlAnswerTemplateEngine.php index 37c3ffe3a..008cb6840 100644 --- a/application/hub/main/template/answer/class_BaseXmlAnswerTemplateEngine.php +++ b/application/hub/main/template/answer/class_BaseXmlAnswerTemplateEngine.php @@ -24,7 +24,7 @@ */ class BaseXmlAnswerTemplateEngine extends BaseXmlTemplateEngine implements CompileableTemplate, Registerable { /** - * Generic 'answer_status' field + * Generic 'answer-status' field */ const ANSWER_STATUS = 'answer-status'; diff --git a/index.php b/index.php index 2f8d830cd..b399a6a35 100644 --- a/index.php +++ b/index.php @@ -55,7 +55,7 @@ final class ApplicationEntryPoint { // Is a message set? if (empty($message)) { // No message provided - $message = 'No message provided!'; + $message = 'No message provided.'; } // END - if // Get config instance -- 2.39.5