}
ZoneFinder& finder = updater_->getFinder();
- ZoneFinderContextPtr result =
- finder.find(name, rrtype,
- ZoneFinder::NO_WILDCARD | ZoneFinder::FIND_GLUE_OK);
-
- return (result->rrset);
+ try {
+ ZoneFinderContextPtr result =
+ finder.find(name, rrtype,
+ ZoneFinder::NO_WILDCARD | ZoneFinder::FIND_GLUE_OK);
+ return (result->rrset);
+ } catch (const OutOfZone&) {
+ // As RRsetCollection is an arbitrary set of RRsets, in case the
+ // searched name is out of zone, we return nothing instead of
+ // propagating the exception.
+ return (ConstRRsetPtr());
+ }
}
RRsetCollectionBase::IterPtr
rrset = this->collection.find(Name("www.example.org"), RRClass::CH(),
RRType::AAAA());
EXPECT_FALSE(rrset);
+
+ // Out of zone find()s must not throw.
+ rrset = this->collection.find(Name("www.example.com"), this->qclass_,
+ RRType::A());
+ EXPECT_FALSE(rrset);
}
TYPED_TEST(RRsetCollectionTest, iteratorTest) {