]> git.ipfire.org Git - thirdparty/kea.git/commitdiff
[#1358] Fixed catch clauses
authorFrancis Dupont <fdupont@isc.org>
Thu, 30 Jul 2020 10:18:22 +0000 (12:18 +0200)
committerFrancis Dupont <fdupont@isc.org>
Tue, 4 Aug 2020 16:53:10 +0000 (18:53 +0200)
22 files changed:
src/bin/dhcp4/ctrl_dhcp4_srv.cc
src/bin/dhcp6/ctrl_dhcp6_srv.cc
src/bin/perfdhcp/command_options.cc
src/bin/perfdhcp/main.cc
src/hooks/dhcp/user_chk/user_file.cc
src/lib/asiolink/tcp_socket.h
src/lib/config/cmds_impl.h
src/lib/dhcp/packet_queue_mgr.h
src/lib/dhcp/tests/packet_queue_mgr4_unittest.cc
src/lib/dhcp/tests/packet_queue_mgr6_unittest.cc
src/lib/dhcp_ddns/ncr_msg.cc
src/lib/dhcp_ddns/ncr_udp.cc
src/lib/dhcpsrv/csv_lease_file4.cc
src/lib/dhcpsrv/csv_lease_file6.cc
src/lib/dhcpsrv/memfile_lease_mgr.cc
src/lib/dhcpsrv/parsers/option_data_parser.cc
src/lib/exceptions/tests/exceptions_unittest.cc
src/lib/log/logger_level_impl.cc
src/lib/log/logger_manager.cc
src/lib/log/tests/logger_example.cc
src/lib/log/tests/message_reader_unittest.cc
src/lib/util/csv_file.cc

index f29e2cffa195be5d8ac02bf0723a7f8c89aaabed..b1c20aa577df6b3b10f59fd216fb572a8f726d5c 100644 (file)
@@ -756,7 +756,7 @@ ControlledDhcpv4Srv::processCommand(const string& command,
         return (isc::config::createAnswer(1, "Unrecognized command:"
                                           + command));
 
-    } catch (const Exception& ex) {
+    } catch (const isc::Exception& ex) {
         return (isc::config::createAnswer(1, "Error while processing command '"
                                           + command + "':" + ex.what() +
                                           ", params: '" + txt + "'"));
index ff9c637711e35a54f99452fa5059b5e987e03c91..ed339a0abd62eab37820cc526a18580a1792dc24 100644 (file)
@@ -759,7 +759,7 @@ ControlledDhcpv6Srv::processCommand(const string& command,
         return (isc::config::createAnswer(1, "Unrecognized command:"
                                           + command));
 
-    } catch (const Exception& ex) {
+    } catch (const isc::Exception& ex) {
         return (isc::config::createAnswer(1, "Error while processing command '"
                                           + command + "':" + ex.what() +
                                           ", params: '" + txt + "'"));
index acc6ee62c2fe0893e10beb847c963d6413eae37c..ca5c580644974ab9df66ab60ba2c91daaec22a43 100644 (file)
@@ -305,7 +305,7 @@ CommandOptions::initialize(int argc, char** argv, bool print_cmd_line) {
             try {
                 drop_time_[drop_time_set_] =
                     boost::lexical_cast<double>(optarg);
-            } catch (boost::bad_lexical_cast&) {
+            } catch (const boost::bad_lexical_cast&) {
                 isc_throw(isc::InvalidParameter,
                           "value of drop time: -d<value>"
                           " must be positive number");
@@ -325,7 +325,7 @@ CommandOptions::initialize(int argc, char** argv, bool print_cmd_line) {
                 try {
                     drop_percent =
                         boost::lexical_cast<double>(drop_arg.substr(0, percent_loc));
-                } catch (boost::bad_lexical_cast&) {
+                } catch (const boost::bad_lexical_cast&) {
                     isc_throw(isc::InvalidParameter,
                               "value of drop percentage: -D<value%>"
                               " must be 0..100");
@@ -474,7 +474,7 @@ CommandOptions::initialize(int argc, char** argv, bool print_cmd_line) {
             try {
                 code = boost::lexical_cast<int>(opt_text.substr(0,coma_loc));
                 check(code <= 0, "Option code can't be negative");
-            } catch (boost::bad_lexical_cast&) {
+            } catch (const boost::bad_lexical_cast&) {
                 isc_throw(InvalidParameter, "Invalid option code specified for "
                           "-o option, expected format: -o<integer>,<hexstring>");
             }
@@ -484,7 +484,7 @@ CommandOptions::initialize(int argc, char** argv, bool print_cmd_line) {
             std::vector<uint8_t> bin;
             try {
                 isc::util::encode::decodeHex(opt_text, bin);
-            } catch (BadValue& e) {
+            } catch (const BadValue& e) {
                 isc_throw(InvalidParameter, "Error during encoding option -o:"
                           << e.what());
             }
@@ -682,7 +682,7 @@ CommandOptions::initClientsNum() {
         long long clients_num = boost::lexical_cast<long long>(optarg);
         check(clients_num < 0, errmsg);
         clients_num_ = boost::lexical_cast<uint32_t>(optarg);
-    } catch (boost::bad_lexical_cast&) {
+    } catch (const boost::bad_lexical_cast&) {
         isc_throw(isc::InvalidParameter, errmsg);
     }
 }
@@ -736,7 +736,7 @@ CommandOptions::decodeMacBase(const std::string& base) {
             try {
                 // Do actual conversion
                 ui = convertHexString(token);
-            } catch (isc::InvalidParameter&) {
+            } catch (const isc::InvalidParameter&) {
                 isc_throw(isc::InvalidParameter,
                           "invalid characters in MAC provided");
 
@@ -769,7 +769,7 @@ CommandOptions::decodeDuid(const std::string& base) {
         try {
             // Do actual conversion
             ui = convertHexString(b.substr(i, 2));
-        } catch (isc::InvalidParameter&) {
+        } catch (const isc::InvalidParameter&) {
             isc_throw(isc::InvalidParameter,
                       "invalid characters in DUID provided,"
                       " expected hex digits");
@@ -886,7 +886,7 @@ bool CommandOptions::decodeMacString(const std::string& line) {
       try {
         // Do actual conversion
         ui = convertHexString(token);
-      } catch (isc::InvalidParameter&) {
+      } catch (const isc::InvalidParameter&) {
         return (true);
       }
       // If conversion succeeded store byte value
@@ -1007,7 +1007,7 @@ CommandOptions::positiveInteger(const std::string& errmsg) const {
         int value = boost::lexical_cast<int>(optarg);
         check(value <= 0, errmsg);
         return (value);
-    } catch (boost::bad_lexical_cast&) {
+    } catch (const boost::bad_lexical_cast&) {
         isc_throw(InvalidParameter, errmsg);
     }
 }
@@ -1018,7 +1018,7 @@ CommandOptions::nonNegativeInteger(const std::string& errmsg) const {
         int value = boost::lexical_cast<int>(optarg);
         check(value < 0, errmsg);
         return (value);
-    } catch (boost::bad_lexical_cast&) {
+    } catch (const boost::bad_lexical_cast&) {
         isc_throw(InvalidParameter, errmsg);
     }
 }
index d5e8e6f11ce48b5adea590a2b135076b68036e09..9a1dbcee9fde012560e0a3768a41fd8953971dba 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2012-2019 Internet Systems Consortium, Inc. ("ISC")
+// Copyright (C) 2012-2020 Internet Systems Consortium, Inc. ("ISC")
 //
 // This Source Code Form is subject to the terms of the Mozilla Public
 // License, v. 2.0. If a copy of the MPL was not distributed with this
@@ -33,7 +33,7 @@ main(int argc, char* argv[]) {
         if (command_options.parse(argc, argv, true)) {
             return (ret_code);
         }
-    } catch(isc::Exception& e) {
+    } catch (const isc::Exception& e) {
         ret_code = 1;
         command_options.usage();
         std::cerr << "\nERROR: parsing command line options: "
@@ -53,7 +53,7 @@ main(int argc, char* argv[]) {
             AvalancheScen scen(command_options, socket);
             ret_code = scen.run();
         }
-    } catch (std::exception& e) {
+    } catch (const std::exception& e) {
         ret_code = 1;
         std::cerr << "\nERROR: running perfdhcp: " << e.what() << std::endl;
         if (diags.find('e') != std::string::npos) {
index 1586cf5e11aa84000b20ddd10715c33e63a571da..96cb6a0fc40e15aa8cac054289633d63ca95b156 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2013-2015 Internet Systems Consortium, Inc. ("ISC")
+// Copyright (C) 2013-2020 Internet Systems Consortium, Inc. ("ISC")
 //
 // This Source Code Form is subject to the terms of the Mozilla Public
 // License, v. 2.0. If a copy of the MPL was not distributed with this
@@ -72,7 +72,7 @@ UserFile::makeUser(const std::string& user_string) {
     isc::data::ElementPtr elements;
     try {
         elements = isc::data::Element::fromJSON(user_string);
-    } catch (isc::data::JSONError& ex) {
+    } catch (const isc::data::JSONError& ex) {
         isc_throw(UserFileError,
                   "UserFile entry is malformed JSON: " << ex.what());
     }
index f1297e06300fa6568c427c62e036083bf2c9ff2e..0ebffa37d2dd3d82940b949602bdce2a03ed3d3e 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2011-2018 Internet Systems Consortium, Inc. ("ISC")
+// Copyright (C) 2011-2020 Internet Systems Consortium, Inc. ("ISC")
 //
 // This Source Code Form is subject to the terms of the Mozilla Public
 // License, v. 2.0. If a copy of the MPL was not distributed with this
@@ -326,7 +326,7 @@ TCPSocket<C>::asyncSend(const void* data, size_t length, C& callback)
             socket_.async_send(boost::asio::buffer(send_buffer_->getData(),
                                                    send_buffer_->getLength()),
                                callback);
-        } catch (boost::numeric::bad_numeric_cast&) {
+        } catch (const boost::numeric::bad_numeric_cast&) {
             isc_throw(BufferTooLarge,
                       "attempt to send buffer larger than 64kB");
         }
@@ -358,7 +358,7 @@ TCPSocket<C>::asyncSend(const void* data, size_t length,
             // ... and send it
             socket_.async_send(boost::asio::buffer(send_buffer_->getData(),
                                send_buffer_->getLength()), callback);
-        } catch (boost::numeric::bad_numeric_cast&) {
+        } catch (const boost::numeric::bad_numeric_cast&) {
             isc_throw(BufferTooLarge,
                       "attempt to send buffer larger than 64kB");
         }
index 452465b99a092a1f1030169ecd15e3db7ee5b334..cb470dc2fb36e98d73cf38643f185925bfb25cd5 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2017 Internet Systems Consortium, Inc. ("ISC")
+// Copyright (C) 2017-2020 Internet Systems Consortium, Inc. ("ISC")
 //
 // This Source Code Form is subject to the terms of the Mozilla Public
 // License, v. 2.0. If a copy of the MPL was not distributed with this
@@ -31,7 +31,7 @@ protected:
             data::ConstElementPtr command;
             handle.getArgument("command", command);
             cmd_name_ = parseCommand(cmd_args_, command);
-        } catch (std::exception& ex) {
+        } catch (const std::exception& ex) {
             isc_throw(isc::BadValue, "JSON command text is invalid: " << ex.what());
         }
     }
index 3e77643362bcfb1c2c72a05becb7c4ccfbfcb19d..4acac274bb5a66d0eb83b9de2e36e434e8f3ee14 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2018 Internet Systems Consortium, Inc. ("ISC")
+// Copyright (C) 2018-2020 Internet Systems Consortium, Inc. ("ISC")
 //
 // This Source Code Form is subject to the terms of the Mozilla Public
 // License, v. 2.0. If a copy of the MPL was not distributed with this
@@ -139,7 +139,7 @@ public:
         std::string queue_type ;
         try {
             queue_type = data::SimpleParser::getString(parameters, "queue-type");
-        } catch (std::exception& ex) {
+        } catch (const std::exception& ex) {
             isc_throw(InvalidQueueParameter, "queue-type missing or invalid: " << ex.what());
         }
 
index ed4b16572e2f9ecb5f966f115d57e9667949ef6d..4ad6e279b5d0e8ada95e07cae9e49145a73c9e68 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2018 Internet Systems Consortium, Inc. ("ISC")
+// Copyright (C) 2018-2020 Internet Systems Consortium, Inc. ("ISC")
 //
 // This Source Code Form is subject to the terms of the Mozilla Public
 // License, v. 2.0. If a copy of the MPL was not distributed with this
@@ -61,7 +61,7 @@ public:
                 std::string queue_type ;
                 try {
                     queue_type = data::SimpleParser::getString(parameters, "queue-type");
-                } catch (std::exception& ex) {
+                } catch (const std::exception& ex) {
                     isc_throw(InvalidQueueParameter,
                               "queue-type missing or invalid: " << ex.what());
                 }
index 6003e0336322a8addafe0d8dca02612ecac74203..a24472f0b850055dc2cf7fe114c0d4a7d4cfea15 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2018 Internet Systems Consortium, Inc. ("ISC")
+// Copyright (C) 2018-2020 Internet Systems Consortium, Inc. ("ISC")
 //
 // This Source Code Form is subject to the terms of the Mozilla Public
 // License, v. 2.0. If a copy of the MPL was not distributed with this
@@ -50,7 +50,7 @@ public:
                 std::string queue_type ;
                 try {
                     queue_type = data::SimpleParser::getString(parameters, "queue-type");
-                } catch (std::exception& ex) {
+                } catch (const std::exception& ex) {
                     isc_throw(InvalidQueueParameter,
                               "queue-type missing or invalid: " << ex.what());
                 }
index a8d7826458fcf84b6816622e84e7aae407ded52e..aabf8d24ae855725f58197746ed7b982997bee41 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2013-2019 Internet Systems Consortium, Inc. ("ISC")
+// Copyright (C) 2013-2020 Internet Systems Consortium, Inc. ("ISC")
 //
 // This Source Code Form is subject to the terms of the Mozilla Public
 // License, v. 2.0. If a copy of the MPL was not distributed with this
@@ -248,7 +248,7 @@ NameChangeRequest::fromFormat(const NameChangeFormat format,
             // NameChangeRequest instance.  Note the factory may throw
             // NcrMessageError.
             ncr = NameChangeRequest::fromJSON(string_data);
-        } catch (isc::util::InvalidBufferPosition& ex) {
+        } catch (const isc::util::InvalidBufferPosition& ex) {
             // Read error accessing data in InputBuffer.
             isc_throw(NcrMessageError, "fromFormat: buffer read error: "
                       << ex.what());
@@ -299,7 +299,7 @@ NameChangeRequest::fromJSON(const std::string& json) {
     isc::data::ElementPtr elements;
     try {
         elements = isc::data::Element::fromJSON(json);
-    } catch (isc::data::JSONError& ex) {
+    } catch (const isc::data::JSONError& ex) {
         isc_throw(NcrMessageError,
                   "Malformed NameChangeRequest JSON: " << ex.what());
     }
@@ -420,7 +420,7 @@ NameChangeRequest::setChangeType(isc::data::ConstElementPtr element) {
     try {
         // Get the element's integer value.
         raw_value = element->intValue();
-    } catch (isc::data::TypeError& ex) {
+    } catch (const isc::data::TypeError& ex) {
         // We expect a integer Element type, don't have one.
         isc_throw(NcrMessageError,
                   "Wrong data type for change_type: " << ex.what());
@@ -447,7 +447,7 @@ NameChangeRequest::setForwardChange(isc::data::ConstElementPtr element) {
     try {
         // Get the element's boolean value.
         value = element->boolValue();
-    } catch (isc::data::TypeError& ex) {
+    } catch (const isc::data::TypeError& ex) {
         // We expect a boolean Element type, don't have one.
         isc_throw(NcrMessageError,
                   "Wrong data type for forward-change: " << ex.what());
@@ -468,7 +468,7 @@ NameChangeRequest::setReverseChange(isc::data::ConstElementPtr element) {
     try {
         // Get the element's boolean value.
         value = element->boolValue();
-    } catch (isc::data::TypeError& ex) {
+    } catch (const isc::data::TypeError& ex) {
         // We expect a boolean Element type, don't have one.
         isc_throw(NcrMessageError,
                   "Wrong data type for reverse_change: " << ex.what());
@@ -532,7 +532,7 @@ void
 NameChangeRequest::setLeaseExpiresOn(const std::string&  value) {
     try {
         lease_expires_on_ = isc::util::timeFromText64(value);
-    } catch(...) {
+    } catch (...) {
         // We were given an invalid string, so throw.
         isc_throw(NcrMessageError,
             "Invalid date-time string: [" << value << "]");
@@ -556,7 +556,7 @@ NameChangeRequest::setLeaseLength(isc::data::ConstElementPtr element) {
     try {
         // Get the element's integer value.
         value = element->intValue();
-    } catch (isc::data::TypeError& ex) {
+    } catch (const isc::data::TypeError& ex) {
         // We expect a integer Element type, don't have one.
         isc_throw(NcrMessageError,
                   "Wrong data type for lease_length: " << ex.what());
index 655f8b06e6d5322c4cf4c0ecb33a75a4737870ce..b47ca1c2af6229c64fc2be9cda7db83378db5a22 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2013-2017 Internet Systems Consortium, Inc. ("ISC")
+// Copyright (C) 2013-2020 Internet Systems Consortium, Inc. ("ISC")
 //
 // This Source Code Form is subject to the terms of the Mozilla Public
 // License, v. 2.0. If a copy of the MPL was not distributed with this
@@ -102,7 +102,7 @@ NameChangeUDPListener::open(isc::asiolink::IOService& io_service) {
 
         // Bind the low level socket to our endpoint.
         asio_socket_->bind(endpoint.getASIOEndpoint());
-    } catch (boost::system::system_error& ex) {
+    } catch (const boost::system::system_error& ex) {
         asio_socket_.reset();
         isc_throw (NcrUDPError, ex.code().message());
     }
@@ -132,7 +132,7 @@ NameChangeUDPListener::close() {
         if (asio_socket_->is_open()) {
             try {
                 asio_socket_->close();
-            } catch (boost::system::system_error& ex) {
+            } catch (const boost::system::system_error& ex) {
                 // It is really unlikely that this will occur.
                 // If we do reopen later it will be with a new socket
                 // instance. Repackage exception as one that is conformant
@@ -237,7 +237,7 @@ NameChangeUDPSender::open(isc::asiolink::IOService& io_service) {
 
         // Bind the low level socket to our endpoint.
         asio_socket_->bind(endpoint.getASIOEndpoint());
-    } catch (boost::system::system_error& ex) {
+    } catch (const boost::system::system_error& ex) {
         isc_throw (NcrUDPError, ex.code().message());
     }
 
@@ -265,7 +265,7 @@ NameChangeUDPSender::close() {
         if (asio_socket_->is_open()) {
             try {
                 asio_socket_->close();
-            } catch (boost::system::system_error& ex) {
+            } catch (const boost::system::system_error& ex) {
                 // It is really unlikely that this will occur.
                 // If we do reopen later it will be with a new socket
                 // instance. Repackage exception as one that is conformant
index 1fb8d19ca14b8091ff14136f3dc36e9c96eab258..71bfd22440c1679fef554ae8a21b9c19e5b2b67e 100644 (file)
@@ -146,7 +146,7 @@ CSVLeaseFile4::next(Lease4Ptr& lease) {
             lease->setContext(ctx);
         }
 
-    } catch (std::exception& ex) {
+    } catch (const std::exception& ex) {
         // bump the read error count
         ++read_errs_;
 
index cf2f0c0c5c7400f1b9089e479bf6bd8b27dae740..1164043cc6ccaf3bea4b969ca488a7dba11c17f4 100644 (file)
@@ -116,7 +116,7 @@ CSVLeaseFile6::next(Lease6Ptr& lease) {
         if (ctx) {
             lease->setContext(ctx);
         }
-    } catch (std::exception& ex) {
+    } catch (const std::exception& ex) {
         // bump the read error count
         ++read_errs_;
 
index b977406f6bf12bf3f400fe1af4de793b604b7dfa..7272baa00ae27d808a010102afde169ce1fd5755 100644 (file)
@@ -1777,7 +1777,7 @@ Memfile_LeaseMgr::loadLeasesFromFiles(const std::string& filename,
     uint32_t max_row_errors = 0;
     try {
         max_row_errors = boost::lexical_cast<uint32_t>(max_row_errors_str);
-    } catch (boost::bad_lexical_cast&) {
+    } catch (const boost::bad_lexical_cast&) {
         isc_throw(isc::BadValue, "invalid value of the max-row-errors "
                   << max_row_errors_str << " specified");
     }
@@ -1858,7 +1858,7 @@ Memfile_LeaseMgr::lfcSetup(bool conversion_needed) {
     uint32_t lfc_interval = 0;
     try {
         lfc_interval = boost::lexical_cast<uint32_t>(lfc_interval_str);
-    } catch (boost::bad_lexical_cast&) {
+    } catch (const boost::bad_lexical_cast&) {
         isc_throw(isc::BadValue, "invalid value of the lfc-interval "
                   << lfc_interval_str << " specified");
     }
index ae79505517d5efa42ea9162a0736a85d71e2f73c..80808ffdbedb37da490f66632259c7657e4551f6 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2017-2019 Internet Systems Consortium, Inc. ("ISC")
+// Copyright (C) 2017-2020 Internet Systems Consortium, Inc. ("ISC")
 //
 // This Source Code Form is subject to the terms of the Mozilla Public
 // License, v. 2.0. If a copy of the MPL was not distributed with this
@@ -163,7 +163,7 @@ OptionDataParser::extractSpace(ConstElementPtr parent) const {
                       << "' option space name is reserved for DHCPv6 server");
         }
 
-    } catch (std::exception& ex) {
+    } catch (const std::exception& ex) {
         // Append position of the option space parameter.
         isc_throw(DhcpConfigError, ex.what() << " ("
                   << getPosition("space", parent) << ")");
index c5423d2e205c26bed2ff61a29f57a71276ee544c..c4b0528305de65538143e3232f3ba8b3ba658f6d 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2009-2019 Internet Systems Consortium, Inc. ("ISC")
+// Copyright (C) 2009-2020 Internet Systems Consortium, Inc. ("ISC")
 //
 // This Source Code Form is subject to the terms of the Mozilla Public
 // License, v. 2.0. If a copy of the MPL was not distributed with this
@@ -32,7 +32,7 @@ void raise_foobar() {
 TEST_F(ExceptionTest, basicMethods) {
     try {
         isc_throw(Exception, teststring);
-    } catch (Exception& ex) {
+    } catch (const Exception& ex) {
         EXPECT_EQ(ex.getMessage(), std::string(teststring));
         EXPECT_EQ(ex.getFile(), std::string(__FILE__));
         EXPECT_EQ(ex.getLine(), __LINE__ - 4);
@@ -43,7 +43,7 @@ TEST_F(ExceptionTest, basicMethods) {
 TEST_F(ExceptionTest, string) {
     try {
         isc_throw(Exception, std::string(teststring));
-    } catch (Exception& ex) {
+    } catch (const Exception& ex) {
         EXPECT_EQ(ex.getMessage(), std::string(teststring));
         EXPECT_EQ(ex.getFile(), std::string(__FILE__));
         EXPECT_EQ(ex.getLine(), __LINE__ - 4);
@@ -54,7 +54,7 @@ TEST_F(ExceptionTest, string) {
 TEST_F(ExceptionTest, stdInheritance) {
     try {
         isc_throw(Exception, teststring);
-    } catch (std::exception& ex) {
+    } catch (const std::exception& ex) {
         EXPECT_EQ(std::string(ex.what()), std::string(teststring));
     }
 }
index 85ba3e7d7d797cbb3f6f66e39b61915b9be43403..ef2a2aa34fcc5620959e0cc7881f0ec00f92db0a 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2011-2016 Internet Systems Consortium, Inc. ("ISC")
+// Copyright (C) 2011-2020 Internet Systems Consortium, Inc. ("ISC")
 //
 // This Source Code Form is subject to the terms of the Mozilla Public
 // License, v. 2.0. If a copy of the MPL was not distributed with this
@@ -163,7 +163,7 @@ LoggerLevelImpl::logLevelFromString(const log4cplus::tstring& level) {
                     }
                     return convertFromBindLevel(Level(DEBUG, dbglevel));
                 }
-                catch (boost::bad_lexical_cast&) {
+                catch (const boost::bad_lexical_cast&) {
                     LOG_ERROR(logger, LOGIMPL_BAD_DEBUG_STRING).arg(name);
                     return (NOT_SET_LOG_LEVEL);
                 }
index dc7a506d9a5412143d125fa0d61351935029db7b..8742d9109dcca30f1b25b66e073ba0911ec69534 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2011-2019 Internet Systems Consortium, Inc. ("ISC")
+// Copyright (C) 2011-2020 Internet Systems Consortium, Inc. ("ISC")
 //
 // This Source Code Form is subject to the terms of the Mozilla Public
 // License, v. 2.0. If a copy of the MPL was not distributed with this
@@ -186,7 +186,7 @@ LoggerManager::readLocalMessageFile(const char* file) {
                 logger.warn(LOG_NO_SUCH_MESSAGE).arg(message_id);
         }
     }
-    catch (MessageException& e) {
+    catch (const MessageException& e) {
         MessageID ident = e.id();
         vector<string> args = e.arguments();
 
index dd1e8bcbf016c58b99a4373447929c385aff0c12..ff3d512296ac13e9766cb5aba4faac9429d308cd 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2011-2017 Internet Systems Consortium, Inc. ("ISC")
+// Copyright (C) 2011-2020 Internet Systems Consortium, Inc. ("ISC")
 //
 // This Source Code Form is subject to the terms of the Mozilla Public
 // License, v. 2.0. If a copy of the MPL was not distributed with this
@@ -210,7 +210,7 @@ int main(int argc, char** argv) {
             }
             try {
                 cur_opt.maxver = boost::lexical_cast<unsigned int>(optarg);
-            } catch (boost::bad_lexical_cast&) {
+            } catch (const boost::bad_lexical_cast&) {
                 std::cerr << "Maximum version (-m) argument must be a positive "
                              "integer\n";
                 return (1);
@@ -244,7 +244,7 @@ int main(int argc, char** argv) {
             }
             try {
                 cur_opt.maxsize = boost::lexical_cast<size_t>(optarg);
-            } catch (boost::bad_lexical_cast&) {
+            } catch (const boost::bad_lexical_cast&) {
                 std::cerr << "File size (-z) argument must be a positive "
                              "integer\n";
                 return (1);
index 72273da4b0f3db9f4f3cce93cd008aa3ec252900..4dd64353b980cb27405e79d15bdecc5ad00bb037 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2011-2015 Internet Systems Consortium, Inc. ("ISC")
+// Copyright (C) 2011-2020 Internet Systems Consortium, Inc. ("ISC")
 //
 // This Source Code Form is subject to the terms of the Mozilla Public
 // License, v. 2.0. If a copy of the MPL was not distributed with this
@@ -83,7 +83,7 @@ processLineException(MessageReader& reader, const char* what,
         reader.processLine(what);
         FAIL() << "MessageReader::processLine() should throw an exception " <<
             " with message ID " << expected << " for '" << what << "'\n";
-    } catch (MessageException& e) {
+    } catch (const MessageException& e) {
         EXPECT_EQ(boost::lexical_cast<string>(expected),
             boost::lexical_cast<string>(e.id()));
     } catch (...) {
index 6db97620c8d97c433beb7450885ea7e5c578bb55..1fa54c0da60b3ddbfc1f294dce1b08069aafbfdf 100644 (file)
@@ -264,7 +264,7 @@ CSVFile::next(CSVRow& row, const bool skip_validation) {
         // Check that stream is "ready" for any IO operations.
         checkStreamStatusAndReset("get next row");
 
-    } catch (isc::Exception& ex) {
+    } catch (const isc::Exception& ex) {
         setReadMsg(ex.what());
         return (false);
     }