From: Mukund Sivaraman Date: Sun, 7 Oct 2012 15:48:38 +0000 (+0530) Subject: [2268] Move EmptyZone exception to InMemoryClient class X-Git-Tag: trac2402_base~57 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=ef49adadf64f56558c75d34483895e1e8d8bcf66;p=thirdparty%2Fkea.git [2268] Move EmptyZone exception to InMemoryClient class --- diff --git a/src/lib/datasrc/memory/memory_client.cc b/src/lib/datasrc/memory/memory_client.cc index de1b91d5f2..8f444b610d 100644 --- a/src/lib/datasrc/memory/memory_client.cc +++ b/src/lib/datasrc/memory/memory_client.cc @@ -92,7 +92,7 @@ InMemoryClient::load(const Name& zone_name, // an SOA RR. This condition should be avoided, and hence load() // should throw when an empty zone is loaded. if (RdataSet::find(set, RRType::SOA()) == NULL) { - isc_throw(ZoneDataUpdater::EmptyZone, + isc_throw(EmptyZone, "Won't create an empty zone for: " << zone_name); } diff --git a/src/lib/datasrc/memory/memory_client.h b/src/lib/datasrc/memory/memory_client.h index 262cbb7909..edd3837b6f 100644 --- a/src/lib/datasrc/memory/memory_client.h +++ b/src/lib/datasrc/memory/memory_client.h @@ -87,6 +87,16 @@ public: /// \return The number of zones stored in the client. virtual unsigned int getZoneCount() const; + /// \brief Zone is empty exception. + /// + /// This is thrown if we have an empty zone created as a result of + /// load(). + struct EmptyZone : public InvalidParameter { + EmptyZone(const char* file, size_t line, const char* what) : + InvalidParameter(file, line, what) + {} + }; + /// \brief Load zone from masterfile. /// /// This loads data from masterfile specified by filename. It replaces diff --git a/src/lib/datasrc/memory/zone_data_updater.h b/src/lib/datasrc/memory/zone_data_updater.h index 1c00aef898..b17a5341fc 100644 --- a/src/lib/datasrc/memory/zone_data_updater.h +++ b/src/lib/datasrc/memory/zone_data_updater.h @@ -57,16 +57,6 @@ public: {} }; - /// \brief Zone is empty exception. - /// - /// This is thrown if we have an empty zone created as a result of - /// load(). - struct EmptyZone : public InvalidParameter { - EmptyZone(const char* file, size_t line, const char* what) : - InvalidParameter(file, line, what) - {} - }; - /// \brief General failure exception for \c add(). /// /// This is thrown against general error cases in adding an RRset diff --git a/src/lib/datasrc/tests/memory/memory_client_unittest.cc b/src/lib/datasrc/tests/memory/memory_client_unittest.cc index c078105b6e..2bc9304dd5 100644 --- a/src/lib/datasrc/tests/memory/memory_client_unittest.cc +++ b/src/lib/datasrc/tests/memory/memory_client_unittest.cc @@ -189,7 +189,7 @@ TEST_F(MemoryClientTest, loadEmptyZoneFileThrows) { EXPECT_THROW(client_->load(Name("."), TEST_DATA_DIR "/empty.zone"), - ZoneDataUpdater::EmptyZone); + InMemoryClient::EmptyZone); EXPECT_EQ(0, client_->getZoneCount());