From: Francis Dupont Date: Thu, 30 Jul 2020 10:18:22 +0000 (+0200) Subject: [#1358] Fixed catch clauses X-Git-Tag: Kea-1.8.0~126 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=3b27090c9d25389d81ad27e4bffedac909f453ac;p=thirdparty%2Fkea.git [#1358] Fixed catch clauses --- diff --git a/src/bin/dhcp4/ctrl_dhcp4_srv.cc b/src/bin/dhcp4/ctrl_dhcp4_srv.cc index f29e2cffa1..b1c20aa577 100644 --- a/src/bin/dhcp4/ctrl_dhcp4_srv.cc +++ b/src/bin/dhcp4/ctrl_dhcp4_srv.cc @@ -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 + "'")); diff --git a/src/bin/dhcp6/ctrl_dhcp6_srv.cc b/src/bin/dhcp6/ctrl_dhcp6_srv.cc index ff9c637711..ed339a0abd 100644 --- a/src/bin/dhcp6/ctrl_dhcp6_srv.cc +++ b/src/bin/dhcp6/ctrl_dhcp6_srv.cc @@ -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 + "'")); diff --git a/src/bin/perfdhcp/command_options.cc b/src/bin/perfdhcp/command_options.cc index acc6ee62c2..ca5c580644 100644 --- a/src/bin/perfdhcp/command_options.cc +++ b/src/bin/perfdhcp/command_options.cc @@ -305,7 +305,7 @@ CommandOptions::initialize(int argc, char** argv, bool print_cmd_line) { try { drop_time_[drop_time_set_] = boost::lexical_cast(optarg); - } catch (boost::bad_lexical_cast&) { + } catch (const boost::bad_lexical_cast&) { isc_throw(isc::InvalidParameter, "value of drop time: -d" " must be positive number"); @@ -325,7 +325,7 @@ CommandOptions::initialize(int argc, char** argv, bool print_cmd_line) { try { drop_percent = boost::lexical_cast(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" " must be 0..100"); @@ -474,7 +474,7 @@ CommandOptions::initialize(int argc, char** argv, bool print_cmd_line) { try { code = boost::lexical_cast(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,"); } @@ -484,7 +484,7 @@ CommandOptions::initialize(int argc, char** argv, bool print_cmd_line) { std::vector 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(optarg); check(clients_num < 0, errmsg); clients_num_ = boost::lexical_cast(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(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(optarg); check(value < 0, errmsg); return (value); - } catch (boost::bad_lexical_cast&) { + } catch (const boost::bad_lexical_cast&) { isc_throw(InvalidParameter, errmsg); } } diff --git a/src/bin/perfdhcp/main.cc b/src/bin/perfdhcp/main.cc index d5e8e6f11c..9a1dbcee9f 100644 --- a/src/bin/perfdhcp/main.cc +++ b/src/bin/perfdhcp/main.cc @@ -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) { diff --git a/src/hooks/dhcp/user_chk/user_file.cc b/src/hooks/dhcp/user_chk/user_file.cc index 1586cf5e11..96cb6a0fc4 100644 --- a/src/hooks/dhcp/user_chk/user_file.cc +++ b/src/hooks/dhcp/user_chk/user_file.cc @@ -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()); } diff --git a/src/lib/asiolink/tcp_socket.h b/src/lib/asiolink/tcp_socket.h index f1297e0630..0ebffa37d2 100644 --- a/src/lib/asiolink/tcp_socket.h +++ b/src/lib/asiolink/tcp_socket.h @@ -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::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::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"); } diff --git a/src/lib/config/cmds_impl.h b/src/lib/config/cmds_impl.h index 452465b99a..cb470dc2fb 100644 --- a/src/lib/config/cmds_impl.h +++ b/src/lib/config/cmds_impl.h @@ -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()); } } diff --git a/src/lib/dhcp/packet_queue_mgr.h b/src/lib/dhcp/packet_queue_mgr.h index 3e77643362..4acac274bb 100644 --- a/src/lib/dhcp/packet_queue_mgr.h +++ b/src/lib/dhcp/packet_queue_mgr.h @@ -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()); } diff --git a/src/lib/dhcp/tests/packet_queue_mgr4_unittest.cc b/src/lib/dhcp/tests/packet_queue_mgr4_unittest.cc index ed4b16572e..4ad6e279b5 100644 --- a/src/lib/dhcp/tests/packet_queue_mgr4_unittest.cc +++ b/src/lib/dhcp/tests/packet_queue_mgr4_unittest.cc @@ -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()); } diff --git a/src/lib/dhcp/tests/packet_queue_mgr6_unittest.cc b/src/lib/dhcp/tests/packet_queue_mgr6_unittest.cc index 6003e03363..a24472f0b8 100644 --- a/src/lib/dhcp/tests/packet_queue_mgr6_unittest.cc +++ b/src/lib/dhcp/tests/packet_queue_mgr6_unittest.cc @@ -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()); } diff --git a/src/lib/dhcp_ddns/ncr_msg.cc b/src/lib/dhcp_ddns/ncr_msg.cc index a8d7826458..aabf8d24ae 100644 --- a/src/lib/dhcp_ddns/ncr_msg.cc +++ b/src/lib/dhcp_ddns/ncr_msg.cc @@ -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()); diff --git a/src/lib/dhcp_ddns/ncr_udp.cc b/src/lib/dhcp_ddns/ncr_udp.cc index 655f8b06e6..b47ca1c2af 100644 --- a/src/lib/dhcp_ddns/ncr_udp.cc +++ b/src/lib/dhcp_ddns/ncr_udp.cc @@ -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 diff --git a/src/lib/dhcpsrv/csv_lease_file4.cc b/src/lib/dhcpsrv/csv_lease_file4.cc index 1fb8d19ca1..71bfd22440 100644 --- a/src/lib/dhcpsrv/csv_lease_file4.cc +++ b/src/lib/dhcpsrv/csv_lease_file4.cc @@ -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_; diff --git a/src/lib/dhcpsrv/csv_lease_file6.cc b/src/lib/dhcpsrv/csv_lease_file6.cc index cf2f0c0c5c..1164043cc6 100644 --- a/src/lib/dhcpsrv/csv_lease_file6.cc +++ b/src/lib/dhcpsrv/csv_lease_file6.cc @@ -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_; diff --git a/src/lib/dhcpsrv/memfile_lease_mgr.cc b/src/lib/dhcpsrv/memfile_lease_mgr.cc index b977406f6b..7272baa00a 100644 --- a/src/lib/dhcpsrv/memfile_lease_mgr.cc +++ b/src/lib/dhcpsrv/memfile_lease_mgr.cc @@ -1777,7 +1777,7 @@ Memfile_LeaseMgr::loadLeasesFromFiles(const std::string& filename, uint32_t max_row_errors = 0; try { max_row_errors = boost::lexical_cast(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(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"); } diff --git a/src/lib/dhcpsrv/parsers/option_data_parser.cc b/src/lib/dhcpsrv/parsers/option_data_parser.cc index ae79505517..80808ffdbe 100644 --- a/src/lib/dhcpsrv/parsers/option_data_parser.cc +++ b/src/lib/dhcpsrv/parsers/option_data_parser.cc @@ -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) << ")"); diff --git a/src/lib/exceptions/tests/exceptions_unittest.cc b/src/lib/exceptions/tests/exceptions_unittest.cc index c5423d2e20..c4b0528305 100644 --- a/src/lib/exceptions/tests/exceptions_unittest.cc +++ b/src/lib/exceptions/tests/exceptions_unittest.cc @@ -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)); } } diff --git a/src/lib/log/logger_level_impl.cc b/src/lib/log/logger_level_impl.cc index 85ba3e7d7d..ef2a2aa34f 100644 --- a/src/lib/log/logger_level_impl.cc +++ b/src/lib/log/logger_level_impl.cc @@ -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); } diff --git a/src/lib/log/logger_manager.cc b/src/lib/log/logger_manager.cc index dc7a506d9a..8742d9109d 100644 --- a/src/lib/log/logger_manager.cc +++ b/src/lib/log/logger_manager.cc @@ -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 args = e.arguments(); diff --git a/src/lib/log/tests/logger_example.cc b/src/lib/log/tests/logger_example.cc index dd1e8bcbf0..ff3d512296 100644 --- a/src/lib/log/tests/logger_example.cc +++ b/src/lib/log/tests/logger_example.cc @@ -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(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(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); diff --git a/src/lib/log/tests/message_reader_unittest.cc b/src/lib/log/tests/message_reader_unittest.cc index 72273da4b0..4dd64353b9 100644 --- a/src/lib/log/tests/message_reader_unittest.cc +++ b/src/lib/log/tests/message_reader_unittest.cc @@ -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(expected), boost::lexical_cast(e.id())); } catch (...) { diff --git a/src/lib/util/csv_file.cc b/src/lib/util/csv_file.cc index 6db97620c8..1fa54c0da6 100644 --- a/src/lib/util/csv_file.cc +++ b/src/lib/util/csv_file.cc @@ -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); }