From: Francis Dupont Date: Tue, 12 May 2015 18:18:25 +0000 (+0200) Subject: [3839] unused exception handler variable aka #3839 X-Git-Tag: trac3911_base^2~3 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=2cd955a8440d3c26b92dca40ff62282c69153296;p=thirdparty%2Fkea.git [3839] unused exception handler variable aka #3839 --- diff --git a/src/lib/dhcp/libdhcp++.cc b/src/lib/dhcp/libdhcp++.cc index be7095533d..df8595aaa9 100644 --- a/src/lib/dhcp/libdhcp++.cc +++ b/src/lib/dhcp/libdhcp++.cc @@ -746,7 +746,7 @@ void initOptionSpace(OptionDefContainer& defs, try { definition->validate(); - } catch (const isc::Exception& ex) { + } catch (const isc::Exception&) { // This is unlikely event that validation fails and may // be only caused by programming error. To guarantee the // data consistency we clear all option definitions that diff --git a/src/lib/dhcp/option4_client_fqdn.cc b/src/lib/dhcp/option4_client_fqdn.cc index 97c4bb3c5f..072c5817ee 100644 --- a/src/lib/dhcp/option4_client_fqdn.cc +++ b/src/lib/dhcp/option4_client_fqdn.cc @@ -1,4 +1,4 @@ -// Copyright (C) 2013-2014 Internet Systems Consortium, Inc. ("ISC") +// Copyright (C) 2013-2015 Internet Systems Consortium, Inc. ("ISC") // // Permission to use, copy, modify, and/or distribute this software for any // purpose with or without fee is hereby granted, provided that the above @@ -218,7 +218,7 @@ setDomainName(const std::string& domain_name, try { domain_name_.reset(new isc::dns::Name(name)); - } catch (const Exception& ex) { + } catch (const Exception&) { isc_throw(InvalidOption4FqdnDomainName, "invalid domain-name value '" << domain_name << "' when setting new domain-name for" diff --git a/src/lib/dhcp/option6_client_fqdn.cc b/src/lib/dhcp/option6_client_fqdn.cc index 2fadb897a8..de2b18b31e 100644 --- a/src/lib/dhcp/option6_client_fqdn.cc +++ b/src/lib/dhcp/option6_client_fqdn.cc @@ -1,4 +1,4 @@ -// Copyright (C) 2013-2014 Internet Systems Consortium, Inc. ("ISC") +// Copyright (C) 2013-2015 Internet Systems Consortium, Inc. ("ISC") // // Permission to use, copy, modify, and/or distribute this software for any // purpose with or without fee is hereby granted, provided that the above @@ -189,7 +189,7 @@ setDomainName(const std::string& domain_name, try { domain_name_.reset(new isc::dns::Name(name, true)); - } catch (const Exception& ex) { + } catch (const Exception&) { isc_throw(InvalidOption6FqdnDomainName, "invalid domain-name value '" << domain_name << "' when setting new domain-name for" << " DHCPv6 Client FQDN Option"); @@ -249,7 +249,7 @@ Option6ClientFqdnImpl::parseWireData(OptionBufferConstIter first, isc::util::InputBuffer name_buf(&buf[0], buf.size()); try { domain_name_.reset(new isc::dns::Name(name_buf, true)); - } catch (const Exception& ex) { + } catch (const Exception&) { isc_throw(InvalidOption6FqdnDomainName, "failed to parse" "partial domain-name from wire format"); } @@ -264,7 +264,7 @@ Option6ClientFqdnImpl::parseWireData(OptionBufferConstIter first, std::distance(first, last)); try { domain_name_.reset(new isc::dns::Name(name_buf, true)); - } catch (const Exception& ex) { + } catch (const Exception&) { isc_throw(InvalidOption6FqdnDomainName, "failed to parse" "fully qualified domain-name from wire format"); } diff --git a/src/lib/dhcp_ddns/ncr_msg.cc b/src/lib/dhcp_ddns/ncr_msg.cc index d69fae52b2..1bd9c9e324 100644 --- a/src/lib/dhcp_ddns/ncr_msg.cc +++ b/src/lib/dhcp_ddns/ncr_msg.cc @@ -506,7 +506,7 @@ NameChangeRequest::setIpAddress(const std::string& value) { // Validate IP Address. try { ip_io_address_ = isc::asiolink::IOAddress(value); - } catch (const isc::asiolink::IOError& ex) { + } catch (const isc::asiolink::IOError&) { isc_throw(NcrMessageError, "Invalid ip address string for ip_address: " << value); } diff --git a/src/lib/dhcpsrv/csv_lease_file4.cc b/src/lib/dhcpsrv/csv_lease_file4.cc index a812785857..8ed0e82f31 100644 --- a/src/lib/dhcpsrv/csv_lease_file4.cc +++ b/src/lib/dhcpsrv/csv_lease_file4.cc @@ -62,7 +62,7 @@ CSVLeaseFile4::append(const Lease4& lease) { try { CSVFile::append(row); - } catch (const std::exception& ex) { + } catch (const std::exception&) { // Catch any errors so we can bump the error counter than rethrow it ++write_errs_; throw; diff --git a/src/lib/dhcpsrv/csv_lease_file6.cc b/src/lib/dhcpsrv/csv_lease_file6.cc index 13551a4808..a8c0d50c90 100644 --- a/src/lib/dhcpsrv/csv_lease_file6.cc +++ b/src/lib/dhcpsrv/csv_lease_file6.cc @@ -61,7 +61,7 @@ CSVLeaseFile6::append(const Lease6& lease) { } try { CSVFile::append(row); - } catch (const std::exception& ex) { + } catch (const std::exception&) { // Catch any errors so we can bump the error counter than rethrow it ++write_errs_; throw; diff --git a/src/lib/dhcpsrv/lease_file_loader.h b/src/lib/dhcpsrv/lease_file_loader.h index f41bf4bfcb..fa673098c3 100644 --- a/src/lib/dhcpsrv/lease_file_loader.h +++ b/src/lib/dhcpsrv/lease_file_loader.h @@ -199,7 +199,7 @@ public: ++lease) { try { lease_file.append(**lease); - } catch (const isc::Exception& ex) { + } catch (const isc::Exception&) { // Close the file lease_file.close(); throw; diff --git a/src/lib/dhcpsrv/logging.cc b/src/lib/dhcpsrv/logging.cc index b65b9b95ef..7a3938c8ca 100644 --- a/src/lib/dhcpsrv/logging.cc +++ b/src/lib/dhcpsrv/logging.cc @@ -76,7 +76,7 @@ void LogConfigParser::parseConfigEntry(isc::data::ConstElementPtr entry) { } try { info.severity_ = isc::log::getSeverity(severity_ptr->stringValue().c_str()); - } catch (const std::exception& ex) { + } catch (const std::exception&) { isc_throw(BadValue, "Unsupported severity value '" << severity_ptr->stringValue() << "' (" << severity_ptr->getPosition() << ")"); diff --git a/src/lib/dhcpsrv/memfile_lease_mgr.cc b/src/lib/dhcpsrv/memfile_lease_mgr.cc index 0afb22149e..df2591217a 100644 --- a/src/lib/dhcpsrv/memfile_lease_mgr.cc +++ b/src/lib/dhcpsrv/memfile_lease_mgr.cc @@ -201,7 +201,7 @@ LFCSetup::execute() { .arg(process_->getCommandLine()); pid_ = process_->spawn(); - } catch (const ProcessSpawnError& ex) { + } catch (const ProcessSpawnError&) { LOG_ERROR(dhcpsrv_logger, DHCPSRV_MEMFILE_LFC_SPAWN_FAIL); } } @@ -682,7 +682,7 @@ Memfile_LeaseMgr::initLeaseFilePath(Universe u) { std::string persist_val; try { persist_val = getParameter("persist"); - } catch (const Exception& ex) { + } catch (const Exception&) { // If parameter persist hasn't been specified, we use a default value // 'yes'. persist_val = "true"; @@ -700,7 +700,7 @@ Memfile_LeaseMgr::initLeaseFilePath(Universe u) { std::string lease_file; try { lease_file = getParameter("name"); - } catch (const Exception& ex) { + } catch (const Exception&) { lease_file = getDefaultLeaseFilePath(u); } return (lease_file); @@ -786,14 +786,14 @@ Memfile_LeaseMgr::lfcSetup() { std::string lfc_interval_str = "0"; try { lfc_interval_str = getParameter("lfc-interval"); - } catch (const std::exception& ex) { + } catch (const std::exception&) { // Ignore and default to 0. } uint32_t lfc_interval = 0; try { lfc_interval = boost::lexical_cast(lfc_interval_str); - } catch (boost::bad_lexical_cast& ex) { + } catch (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/dhcp_parsers.cc b/src/lib/dhcpsrv/parsers/dhcp_parsers.cc index 6898049ce8..da304d6251 100644 --- a/src/lib/dhcpsrv/parsers/dhcp_parsers.cc +++ b/src/lib/dhcpsrv/parsers/dhcp_parsers.cc @@ -357,7 +357,7 @@ OptionDataParser::extractCode(ConstElementPtr parent) const { try { code = uint32_values_->getParam("code"); - } catch (const exception& ex) { + } catch (const exception&) { // The code parameter was not found. Return an unspecified // value. return (OptionalValue()); diff --git a/src/lib/dns/rdata.cc b/src/lib/dns/rdata.cc index a34f8870fe..f8ee61d93f 100644 --- a/src/lib/dns/rdata.cc +++ b/src/lib/dns/rdata.cc @@ -235,7 +235,7 @@ Generic::constructFromLexer(MasterLexer& lexer) { try { rdlen = lexer.getNextToken(MasterToken::NUMBER).getNumber(); - } catch (const MasterLexer::LexerError& ex) { + } catch (const MasterLexer::LexerError&) { isc_throw(InvalidRdataLength, "Unknown RDATA length is invalid"); } diff --git a/src/lib/log/tests/logger_lock_test.cc b/src/lib/log/tests/logger_lock_test.cc index 9b9ee17993..626fb0e84a 100644 --- a/src/lib/log/tests/logger_lock_test.cc +++ b/src/lib/log/tests/logger_lock_test.cc @@ -1,4 +1,4 @@ -// Copyright (C) 2012 Internet Systems Consortium, Inc. ("ISC") +// Copyright (C) 2012, 2015 Internet Systems Consortium, Inc. ("ISC") // // Permission to use, copy, modify, and/or distribute this software for any // purpose with or without fee is hereby granted, provided that the above @@ -40,7 +40,7 @@ protected: try { // This lock attempt is non-blocking. Mutex::Locker locker(LoggerManager::getMutex(), false); - } catch (Mutex::Locker::AlreadyLocked& e) { + } catch (Mutex::Locker::AlreadyLocked&) { cout << "FIELD1 FIELD2 LOGGER_LOCK_TEST: MUTEXLOCK\n"; } diff --git a/src/lib/util/csv_file.cc b/src/lib/util/csv_file.cc index 4f03f48d8a..b65d375374 100644 --- a/src/lib/util/csv_file.cc +++ b/src/lib/util/csv_file.cc @@ -195,7 +195,7 @@ CSVFile::size() const { fs.seekg(0, std::ifstream::end); pos = fs.tellg(); fs.close(); - } catch (const std::exception& ex) { + } catch (const std::exception&) { return (0); } return (pos); @@ -321,7 +321,7 @@ CSVFile::open(const bool seek_to_end) { fs_->clear(); } - } catch (const std::exception& ex) { + } catch (const std::exception&) { close(); throw; }