BIND 10 trac2850_3, updated. 7b1c5d9ea91c0a4db83c191587220c65417ffdc5 [2850] Correct type of exception thrown and also add a test for it

BIND 10 source code commits bind10-changes at lists.isc.org
Wed May 15 13:07:48 UTC 2013


The branch, trac2850_3 has been updated
       via  7b1c5d9ea91c0a4db83c191587220c65417ffdc5 (commit)
      from  3a83a6deb293c21611053d24ac7fcf39fb6690ea (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 7b1c5d9ea91c0a4db83c191587220c65417ffdc5
Author: Mukund Sivaraman <muks at isc.org>
Date:   Wed May 15 18:37:04 2013 +0530

    [2850] Correct type of exception thrown and also add a test for it

-----------------------------------------------------------------------

Summary of changes:
 .../datasrc/memory/zone_table_segment_mapped.cc    |    2 +-
 .../memory/zone_table_segment_mapped_unittest.cc   |    8 ++++++++
 2 files changed, 9 insertions(+), 1 deletion(-)

-----------------------------------------------------------------------
diff --git a/src/lib/datasrc/memory/zone_table_segment_mapped.cc b/src/lib/datasrc/memory/zone_table_segment_mapped.cc
index 77ee58f..186e580 100644
--- a/src/lib/datasrc/memory/zone_table_segment_mapped.cc
+++ b/src/lib/datasrc/memory/zone_table_segment_mapped.cc
@@ -264,7 +264,7 @@ ZoneTableSegmentMapped::reset(MemorySegmentOpenMode mode,
         break;
 
     default:
-        isc_throw(isc::InvalidOperation,
+        isc_throw(isc::InvalidParameter,
                   "Invalid MemorySegmentOpenMode passed to reset()");
     }
 
diff --git a/src/lib/datasrc/tests/memory/zone_table_segment_mapped_unittest.cc b/src/lib/datasrc/tests/memory/zone_table_segment_mapped_unittest.cc
index 441f433..043b89e 100644
--- a/src/lib/datasrc/tests/memory/zone_table_segment_mapped_unittest.cc
+++ b/src/lib/datasrc/tests/memory/zone_table_segment_mapped_unittest.cc
@@ -267,6 +267,14 @@ TEST_F(ZoneTableSegmentMappedTest, reset) {
     EXPECT_FALSE(ztable_segment_->isUsable());
     EXPECT_FALSE(ztable_segment_->isWritable());
 
+    // If a Python binding passes an invalid integer as the mode,
+    // reset() should reject it.
+    EXPECT_THROW({
+        ztable_segment_->reset
+            (static_cast<ZoneTableSegment::MemorySegmentOpenMode>(1234),
+             config_params_);
+    }, isc::InvalidParameter);
+
     // READ_WRITE mode must create the mapped file if it doesn't exist
     // (and must not result in an exception).
     ztable_segment_->reset(ZoneTableSegment::READ_WRITE, config_params_);



More information about the bind10-changes mailing list