MasterLoader::Options options,
MasterLoaderCallbacks& callbacks)
{
- return (RRParamRegistry::getRegistry().createRdata(rrtype, rrclass,
- lexer, origin,
- options, callbacks));
+ RdataPtr ret;
+
+ try {
+ ret = RRParamRegistry::getRegistry().createRdata(rrtype, rrclass,
+ lexer, origin,
+ options, callbacks);
+ } catch (...) {
+ // ret is NULL here.
+ }
+
+ return (ret);
}
int
*test::createRdataUsingLexer(RRType::AFSDB(), RRClass::IN(),
afsdb_text)));
- // Check that bad input throws as usual
- EXPECT_THROW({
- *test::createRdataUsingLexer(RRType::AFSDB(), RRClass::IN(),
- "1root.example.com.");
- }, InvalidRdataText);
+ // Exceptions cause NULL to be returned.
+ EXPECT_FALSE(test::createRdataUsingLexer(RRType::AFSDB(), RRClass::IN(),
+ "1root.example.com."));
}
TEST_F(Rdata_AFSDB_Test, toWireBuffer) {
*test::createRdataUsingLexer(RRType::DHCID(), RRClass::IN(),
string_dhcid)));
- // Check that bad input throws as usual
- EXPECT_THROW({
- *test::createRdataUsingLexer(RRType::DHCID(), RRClass::IN(), "00");
- }, isc::BadValue);
+ // Exceptions cause NULL to be returned.
+ EXPECT_FALSE(test::createRdataUsingLexer(RRType::DHCID(), RRClass::IN(),
+ "00"));
}
TEST_F(Rdata_DHCID_Test, toWireRenderer) {
*test::createRdataUsingLexer(RRType::DNSKEY(), RRClass::IN(),
dnskey_txt)));
- // Check that bad input throws as usual
- EXPECT_THROW({
- *test::createRdataUsingLexer(RRType::DNSKEY(), RRClass::IN(),
- "257 3 5");
- }, InvalidRdataText);
+ // Exceptions cause NULL to be returned.
+ EXPECT_FALSE(test::createRdataUsingLexer(RRType::DNSKEY(), RRClass::IN(),
+ "257 3 5"));
}
TEST_F(Rdata_DNSKEY_Test, toWireRenderer) {
*test::createRdataUsingLexer(RRTYPE<TypeParam>(), RRClass::IN(),
ds_like_txt)));
- // Check that bad input throws as usual
- EXPECT_THROW({
- *test::createRdataUsingLexer(RRTYPE<TypeParam>(), RRClass::IN(),
- "99999 5 2 BEEF");
- }, InvalidRdataText);
+ // Exceptions cause NULL to be returned.
+ EXPECT_FALSE(test::createRdataUsingLexer(RRTYPE<TypeParam>(), RRClass::IN(),
+ "99999 5 2 BEEF"));
}
TYPED_TEST(Rdata_DS_LIKE_Test, assignment_DS_LIKE) {
*test::createRdataUsingLexer(RRType::HINFO(), RRClass::IN(),
hinfo_str)));
- // Check that bad input throws as usual
- EXPECT_THROW({
- *test::createRdataUsingLexer(RRType::HINFO(), RRClass::IN(),
- "\"Pentium\"\"Linux\"");
- }, InvalidRdataText);
+ // Exceptions cause NULL to be returned.
+ EXPECT_FALSE(test::createRdataUsingLexer(RRType::HINFO(), RRClass::IN(),
+ "\"Pentium\"\"Linux\""));
}
TEST_F(Rdata_HINFO_Test, toText) {
*test::createRdataUsingLexer(RRType::MX(), RRClass::IN(),
"10 mx.example.com")));
- EXPECT_THROW({
- test::createRdataUsingLexer(RRType::MX(), RRClass::IN(),
- "10 mx. example.com");
- }, InvalidRdataText);
+ // Exceptions cause NULL to be returned.
+ EXPECT_FALSE(test::createRdataUsingLexer(RRType::MX(), RRClass::IN(),
+ "10 mx. example.com"));
}
TEST_F(Rdata_MX_Test, toWireRenderer) {
*test::createRdataUsingLexer(RRType::NAPTR(), RRClass::IN(),
naptr_str)));
- // Check that bad input throws as usual (order > 65535)
- EXPECT_THROW({
- *test::createRdataUsingLexer(RRType::NAPTR(), RRClass::IN(),
- "65536 10 S SIP \"\" "
- "_sip._udp.example.com.");
- }, InvalidRdataText);
+ // Exceptions cause NULL to be returned.
+ EXPECT_FALSE(test::createRdataUsingLexer(RRType::NAPTR(), RRClass::IN(),
+ "65536 10 S SIP \"\" "
+ "_sip._udp.example.com."));
}
TEST_F(Rdata_NAPTR_Test, toWire) {
*test::createRdataUsingLexer(RRType::NS(), RRClass::IN(),
"ns.example.com")));
- EXPECT_THROW({
- test::createRdataUsingLexer(RRType::NS(), RRClass::IN(),
- "");
- }, IncompleteName);
+ // Exceptions cause NULL to be returned.
+ EXPECT_FALSE(test::createRdataUsingLexer(RRType::NS(), RRClass::IN(),
+ ""));
}
TEST_F(Rdata_NS_Test, toWireBuffer) {
*test::createRdataUsingLexer(RRType::NSEC3(), RRClass::IN(),
nsec3_txt)));
- // Check that bad input throws as usual (next hash shouldn't be
- // padded)
- EXPECT_THROW({
- *test::createRdataUsingLexer(RRType::NSEC3(), RRClass::IN(),
- "1 1 1 ADDAFEEE CPNMU=== A NS SOA");
- }, InvalidRdataText);
+ // Exceptions cause NULL to be returned.
+ EXPECT_FALSE(test::createRdataUsingLexer(RRType::NSEC3(), RRClass::IN(),
+ "1 1 1 ADDAFEEE CPNMU=== "
+ "A NS SOA"));
}
TEST_F(Rdata_NSEC3_Test, assign) {
*test::createRdataUsingLexer(this->getType(), RRClass::IN(),
this->salt_txt)));
- // Check that bad input throws as usual (too large algorithm)
- EXPECT_THROW({
- *test::createRdataUsingLexer(this->getType(), RRClass::IN(),
- "1000000 1 1 ADDAFEEE" +
- this->getCommonText());
- }, InvalidRdataText);
+ // Exceptions cause NULL to be returned.
+ EXPECT_FALSE(test::createRdataUsingLexer(this->getType(), RRClass::IN(),
+ "1000000 1 1 ADDAFEEE" +
+ this->getCommonText()));
}
template <typename OUTPUT_TYPE>
*test::createRdataUsingLexer(RRType::NSEC(), RRClass::IN(),
nsec_txt)));
- // Check that bad input throws as usual
- EXPECT_THROW({
- *test::createRdataUsingLexer(RRType::NSEC(), RRClass::IN(),
- "www.isc.org.");
- }, InvalidRdataText);
+ // Exceptions cause NULL to be returned.
+ EXPECT_FALSE(test::createRdataUsingLexer(RRType::NSEC(), RRClass::IN(),
+ "www.isc.org."));
}
TEST_F(Rdata_NSEC_Test, toWireRenderer_NSEC) {
}
TEST_F(Rdata_OPT_Test, createFromLexer) {
- // OPT RR cannot be created from text.
- EXPECT_THROW({
- *test::createRdataUsingLexer(RRType::OPT(), RRClass::IN(),
- "this does not matter");
- }, InvalidRdataText);
+ // OPT RR cannot be created from text. Exceptions cause NULL to be
+ // returned.
+ EXPECT_FALSE(test::createRdataUsingLexer(RRType::OPT(), RRClass::IN(),
+ "this does not matter"));
}
TEST_F(Rdata_OPT_Test, toWireBuffer) {
"root.example.com. "
"rp-text.example.com.")));
- // Check that bad input throws as usual
- EXPECT_THROW({
- *test::createRdataUsingLexer(RRType::RP(), RRClass::IN(),
- "mailbox.example.com.");
- }, InvalidRdataText);
+ // Exceptions cause NULL to be returned.
+ EXPECT_FALSE(test::createRdataUsingLexer(RRType::RP(), RRClass::IN(),
+ "mailbox.example.com."));
}
TEST_F(Rdata_RP_Test, toWireBuffer) {
*test::createRdataUsingLexer(RRType::RRSIG(), RRClass::IN(),
rrsig_txt)));
- // Check that bad input throws as usual
- EXPECT_THROW({
- *test::createRdataUsingLexer(RRType::RRSIG(), RRClass::IN(),
- "INVALIDINPUT");
- }, InvalidRdataText);
+ // Exceptions cause NULL to be returned.
+ EXPECT_FALSE(test::createRdataUsingLexer(RRType::RRSIG(), RRClass::IN(),
+ "INVALIDINPUT"));
}
TEST_F(Rdata_RRSIG_Test, toWireRenderer) {
EXPECT_EQ(0, rdata_srv.compare(
*test::createRdataUsingLexer(RRType::SRV(), RRClass::IN(),
"1 5 1500 a.example.com.")));
- // port is too large
- EXPECT_THROW({
- *test::createRdataUsingLexer(RRType::SRV(), RRClass::IN(),
- "1 5 281474976710656 a.example.com.");
- }, InvalidRdataText);
+
+ // Exceptions cause NULL to be returned.
+ EXPECT_FALSE(test::createRdataUsingLexer(RRType::SRV(), RRClass::IN(),
+ "1 5 281474976710656 "
+ "a.example.com."));
}
TEST_F(Rdata_SRV_Test, toWireBuffer) {
*test::createRdataUsingLexer(RRType::TSIG(), RRClass::ANY(),
valid_text1)));
- // Check that bad input throws as usual
- EXPECT_THROW({
- *test::createRdataUsingLexer(RRType::TSIG(), RRClass::ANY(),
- "foo 0 0 0 0 BADKEY 0 0");
- }, InvalidRdataText);
+ // Exceptions cause NULL to be returned.
+ EXPECT_FALSE(test::createRdataUsingLexer(RRType::TSIG(), RRClass::ANY(),
+ "foo 0 0 0 0 BADKEY 0 0"));
}
TEST_F(Rdata_TSIG_Test, assignment) {