From: Francis Dupont Date: Fri, 19 Jun 2015 09:11:21 +0000 (+0200) Subject: [3697] Applied and reindented the proposed patch X-Git-Tag: trac3910_base~14^2~1 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=2a1b3e11d8864b26b5d364e195c2f0f5ab74f27c;p=thirdparty%2Fkea.git [3697] Applied and reindented the proposed patch --- diff --git a/src/bin/dhcp6/kea_controller.cc b/src/bin/dhcp6/kea_controller.cc index e28fd41205..18d416dc5c 100644 --- a/src/bin/dhcp6/kea_controller.cc +++ b/src/bin/dhcp6/kea_controller.cc @@ -69,6 +69,17 @@ void configure(const std::string& file_name) { isc_throw(isc::BadValue, "no configuration found"); } + // Let's do sanity check before we call json->get() which + // works only for map. + if (json->getType() != isc::data::Element::map) { + isc_throw(isc::BadValue, "Configuration file is expected to be " + "a map, i.e., start with { and end with } and contain " + "at least an entry called 'Dhcp6' that itself is a map. " + << file_name + << " is a valid JSON, but its top element is not a map." + " Did you forget to add { } around your configuration?"); + } + // Let's configure logging before applying the configuration, // so we can log things during configuration process. // If there's no logging element, we'll just pass NULL pointer,