BIND 10 trac2518, updated. ab8ff1eda4c0daaeaf06614651ecea31a38339ab [2518] Introduce DNSTextError and remove generic catch for isc::Exception from the MasterLoader
BIND 10 source code commits
bind10-changes at lists.isc.org
Fri Jan 31 07:01:34 UTC 2014
The branch, trac2518 has been updated
via ab8ff1eda4c0daaeaf06614651ecea31a38339ab (commit)
from 86faa358e17c487ea7b97970bf04ceabb90c0a1b (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commit ab8ff1eda4c0daaeaf06614651ecea31a38339ab
Author: Mukund Sivaraman <muks at isc.org>
Date: Thu Jan 30 11:17:43 2014 +0530
[2518] Introduce DNSTextError and remove generic catch for isc::Exception from the MasterLoader
-----------------------------------------------------------------------
Summary of changes:
src/lib/dns/exceptions.h | 13 +++++++++++--
src/lib/dns/master_loader.cc | 22 +++++++++++++---------
src/lib/dns/rdata.h | 12 ++++++------
src/lib/dns/rrclass-placeholder.h | 4 ++--
src/lib/dns/rrttl.h | 4 ++--
src/lib/dns/rrtype-placeholder.h | 4 ++--
6 files changed, 36 insertions(+), 23 deletions(-)
-----------------------------------------------------------------------
diff --git a/src/lib/dns/exceptions.h b/src/lib/dns/exceptions.h
index 34413aa..21030b4 100644
--- a/src/lib/dns/exceptions.h
+++ b/src/lib/dns/exceptions.h
@@ -37,12 +37,21 @@ public:
};
///
+/// \brief Base class for all sorts of text parse errors.
+///
+class DNSTextError : public isc::dns::Exception {
+public:
+ DNSTextError(const char* file, size_t line, const char* what) :
+ isc::dns::Exception(file, line, what) {}
+};
+
+///
/// \brief Base class for name parser exceptions.
///
-class NameParserException : public isc::dns::Exception {
+class NameParserException : public DNSTextError {
public:
NameParserException(const char* file, size_t line, const char* what) :
- isc::dns::Exception(file, line, what) {}
+ DNSTextError(file, line, what) {}
};
class DNSProtocolError : public isc::dns::Exception {
diff --git a/src/lib/dns/master_loader.cc b/src/lib/dns/master_loader.cc
index 6b6e091..095a272 100644
--- a/src/lib/dns/master_loader.cc
+++ b/src/lib/dns/master_loader.cc
@@ -576,15 +576,19 @@ MasterLoader::MasterLoaderImpl::loadIncremental(size_t count_limit) {
isc_throw(MasterLoaderError, "Invalid RR data");
}
}
- } catch (const MasterLoaderError&) {
- // This is a hack. We exclude the MasterLoaderError from the
- // below case. Once we restrict the below to some smaller
- // exception, we should remove this.
- throw;
- } catch (const isc::Exception& e) {
- // TODO: Once we do #2518, catch only the DNSTextError here,
- // not isc::Exception. The rest should be just simply
- // propagated.
+ } catch (const isc::dns::DNSTextError& e) {
+ reportError(lexer_.getSourceName(), lexer_.getSourceLine(),
+ e.what());
+ eatUntilEOL(false);
+ } catch (const MasterLexer::ReadError& e) {
+ reportError(lexer_.getSourceName(), lexer_.getSourceLine(),
+ e.what());
+ eatUntilEOL(false);
+ } catch (const MasterLexer::LexerError& e) {
+ reportError(lexer_.getSourceName(), lexer_.getSourceLine(),
+ e.what());
+ eatUntilEOL(false);
+ } catch (const InternalException& e) {
reportError(lexer_.getSourceName(), lexer_.getSourceLine(),
e.what());
eatUntilEOL(false);
diff --git a/src/lib/dns/rdata.h b/src/lib/dns/rdata.h
index a1115fd..58603be 100644
--- a/src/lib/dns/rdata.h
+++ b/src/lib/dns/rdata.h
@@ -42,20 +42,20 @@ namespace rdata {
/// \brief A standard DNS module exception that is thrown if RDATA parser
/// encounters an invalid or inconsistent data length.
///
-class InvalidRdataLength : public isc::dns::Exception {
+class InvalidRdataLength : public DNSTextError {
public:
InvalidRdataLength(const char* file, size_t line, const char* what) :
- isc::dns::Exception(file, line, what) {}
+ DNSTextError(file, line, what) {}
};
///
/// \brief A standard DNS module exception that is thrown if RDATA parser
/// fails to recognize a given textual representation.
///
-class InvalidRdataText : public isc::dns::Exception {
+class InvalidRdataText : public DNSTextError {
public:
InvalidRdataText(const char* file, size_t line, const char* what) :
- isc::dns::Exception(file, line, what) {}
+ DNSTextError(file, line, what) {}
};
///
@@ -63,10 +63,10 @@ public:
/// encounters a character-string (as defined in RFC1035) exceeding
/// the maximum allowable length (\c MAX_CHARSTRING_LEN).
///
-class CharStringTooLong : public isc::dns::Exception {
+class CharStringTooLong : public DNSTextError {
public:
CharStringTooLong(const char* file, size_t line, const char* what) :
- isc::dns::Exception(file, line, what) {}
+ DNSTextError(file, line, what) {}
};
// Forward declaration to define RdataPtr.
diff --git a/src/lib/dns/rrclass-placeholder.h b/src/lib/dns/rrclass-placeholder.h
index 56d9474..709057e 100644
--- a/src/lib/dns/rrclass-placeholder.h
+++ b/src/lib/dns/rrclass-placeholder.h
@@ -39,10 +39,10 @@ class AbstractMessageRenderer;
/// \brief A standard DNS module exception that is thrown if an RRClass object
/// is being constructed from an unrecognized string.
///
-class InvalidRRClass : public isc::dns::Exception {
+class InvalidRRClass : public DNSTextError {
public:
InvalidRRClass(const char* file, size_t line, const char* what) :
- isc::dns::Exception(file, line, what) {}
+ DNSTextError(file, line, what) {}
};
///
diff --git a/src/lib/dns/rrttl.h b/src/lib/dns/rrttl.h
index 7804234..ffa3467 100644
--- a/src/lib/dns/rrttl.h
+++ b/src/lib/dns/rrttl.h
@@ -36,10 +36,10 @@ class AbstractMessageRenderer;
/// \brief A standard DNS module exception that is thrown if an RRTTL object
/// is being constructed from an unrecognized string.
///
-class InvalidRRTTL : public isc::dns::Exception {
+class InvalidRRTTL : public DNSTextError {
public:
InvalidRRTTL(const char* file, size_t line, const char* what) :
- isc::dns::Exception(file, line, what) {}
+ DNSTextError(file, line, what) {}
};
///
diff --git a/src/lib/dns/rrtype-placeholder.h b/src/lib/dns/rrtype-placeholder.h
index 08ab287..46167e4 100644
--- a/src/lib/dns/rrtype-placeholder.h
+++ b/src/lib/dns/rrtype-placeholder.h
@@ -42,10 +42,10 @@ class AbstractMessageRenderer;
/// \brief A standard DNS module exception that is thrown if an RRType object
/// is being constructed from an unrecognized string.
///
-class InvalidRRType : public isc::dns::Exception {
+class InvalidRRType : public DNSTextError {
public:
InvalidRRType(const char* file, size_t line, const char* what) :
- isc::dns::Exception(file, line, what) {}
+ DNSTextError(file, line, what) {}
};
///
More information about the bind10-changes
mailing list