diff --git a/src/bin/dhcp4/json_config_parser.cc b/src/bin/dhcp4/json_config_parser.cc index 38258e2f18..ebab5530e5 100644 --- a/src/bin/dhcp4/json_config_parser.cc +++ b/src/bin/dhcp4/json_config_parser.cc @@ -412,7 +412,7 @@ processDhcp4Config(isc::data::ConstElementPtr config_set) { ConstElementPtr control_socket = mutable_cfg->get("control-socket"); if (control_socket) { mutable_cfg->remove("control-socket"); - ElementPtr l = Element::createList(); + ElementPtr l = Element::createList(control_socket->getPosition()); l->add(UserContext::toElement(control_socket)); mutable_cfg->set("control-sockets", l); } diff --git a/src/hooks/dhcp/lease_query/tests/lease_query_impl4_unittest.cc b/src/hooks/dhcp/lease_query/tests/lease_query_impl4_unittest.cc index 3c67d87814..ab5645ac59 100644 --- a/src/hooks/dhcp/lease_query/tests/lease_query_impl4_unittest.cc +++ b/src/hooks/dhcp/lease_query/tests/lease_query_impl4_unittest.cc @@ -1224,7 +1224,7 @@ TEST_F(LeaseQueryImpl4ProcessTest, addRelayAgentInfo) { // Pass lease and response into addRelayAgentInfo(). ASSERT_THROW_MSG(LeaseQueryImpl4::addRelayAgentInfo(response, lease), Unexpected, "Error creating relay-agent-info option:" - " stringValue() called on non-string Element"); + " stringValue() called on non-string Element in (:1:32)"); // Verify relay-agent-info is not in the response checkRelayAgentInfo(response, ""); diff --git a/src/lib/cc/data.cc b/src/lib/cc/data.cc index f48bed5e81..66f39869b7 100644 --- a/src/lib/cc/data.cc +++ b/src/lib/cc/data.cc @@ -1421,19 +1421,21 @@ copy(ConstElementPtr from, int level) { if (!from) { isc_throw(BadValue, "copy got a null pointer"); } + + auto pos = from->getPosition(); int from_type = from->getType(); if (from_type == Element::integer) { - return (ElementPtr(new IntElement(from->intValue()))); + return (ElementPtr(new IntElement(from->intValue(), pos))); } else if (from_type == Element::real) { - return (ElementPtr(new DoubleElement(from->doubleValue()))); + return (ElementPtr(new DoubleElement(from->doubleValue(), pos))); } else if (from_type == Element::boolean) { - return (ElementPtr(new BoolElement(from->boolValue()))); + return (ElementPtr(new BoolElement(from->boolValue(), pos))); } else if (from_type == Element::null) { return (ElementPtr(new NullElement())); } else if (from_type == Element::string) { - return (ElementPtr(new StringElement(from->stringValue()))); + return (ElementPtr(new StringElement(from->stringValue(), pos))); } else if (from_type == Element::list) { - ElementPtr result = ElementPtr(new ListElement()); + ElementPtr result = ElementPtr(new ListElement(pos)); for (auto const& elem : from->listValue()) { if (level == 0) { result->add(elem); @@ -1443,7 +1445,7 @@ copy(ConstElementPtr from, int level) { } return (result); } else if (from_type == Element::map) { - ElementPtr result = ElementPtr(new MapElement()); + ElementPtr result = ElementPtr(new MapElement(pos)); for (auto const& kv : from->mapValue()) { auto key = kv.first; auto value = kv.second; diff --git a/src/lib/http/tests/basic_auth_config_unittests.cc b/src/lib/http/tests/basic_auth_config_unittests.cc index 0b32999c72..ab41aa8ff9 100644 --- a/src/lib/http/tests/basic_auth_config_unittests.cc +++ b/src/lib/http/tests/basic_auth_config_unittests.cc @@ -556,7 +556,6 @@ TEST_F(BasicHttpAuthConfigTest, parse) { cfg->set("clients", clients_cfg); EXPECT_NO_THROW(config.parse(cfg)); runToElementTest(cfg, config); - std::cout << "TKM config: " << prettyPrint(config.toElement()) << std::endl; // Check a working not empty config with files. config.clear();