Verified Commit a0cdbb30 authored by Andrei Pavel's avatar Andrei Pavel 🐧

[#1496] add missing spaces, remove spurious spaces

in exception messages & error messages
parent c1e3c626
......@@ -427,8 +427,9 @@ TSIGKeyInfoParser::parse(ConstElementPtr key_config) {
&& (digestbits < 192)) ||
(boost::iequals(algorithm, TSIGKeyInfo::HMAC_SHA512_STR)
&& (digestbits < 256)))) {
isc_throw(D2CfgError, "tsig-key: digest-bits too small : "
<< " (" << getPosition("digest-bits", key_config) << ")");
isc_throw(D2CfgError, "tsig-key: digest-bits too small : ("
<< getPosition("digest-bits", key_config)
<< ")");
}
// Everything should be valid, so create the key instance.
......
......@@ -248,8 +248,8 @@ void D2SimpleParser::parse(const D2CfgContextPtr& ctx,
if (ncr_protocol != dhcp_ddns::NCR_UDP) {
isc_throw(D2CfgError, "ncr-protocol : "
<< dhcp_ddns::ncrProtocolToString(ncr_protocol)
<< " is not yet supported "
<< " (" << config->get("ncr-protocol")->getPosition() << ")");
<< " is not yet supported ("
<< config->get("ncr-protocol")->getPosition() << ")");
}
ncr_format = getFormat(config, "ncr-format");
......
......@@ -418,7 +418,7 @@ TEST_F(D2CfgMgrTest, invalidEntry) {
// Unsupported protocol
config = makeParamsConfigString ("127.0.0.1", 777, 333, "TCP", "JSON");
LOGIC_ERROR(config, "ncr-protocol : TCP is not yet supported"
" (<string>:1:92)");
" (<string>:1:92)");
// Invalid format
config = makeParamsConfigString ("127.0.0.1", 777, 333, "UDP", "BOGUS");
......@@ -939,8 +939,7 @@ TEST_F(D2CfgMgrTest, configPermutations) {
// Grab the test's configuration data.
isc::data::ConstElementPtr data = test->get("data");
ASSERT_TRUE(data) << "No data for test: "
<< " : " << test->getPosition();
ASSERT_TRUE(data) << "No data for test: " << test->getPosition();
// Convert the test data back to JSON text, then submit it for parsing.
stringstream os;
......
......@@ -101,7 +101,7 @@ public:
if (rcode) {
return (::testing::AssertionFailure(::testing::Message() <<
"configure() failed:"
"configure() failed: "
<< comment));
}
......
......@@ -240,7 +240,7 @@
#-----
,{
"description" : "D2Params.ncr-protocol, unsupported TCP",
"logic-error" : "ncr-protocol : TCP is not yet supported (<string>:1:41)",
"logic-error" : "ncr-protocol : TCP is not yet supported (<string>:1:41)",
"data" :
{
"ncr-protocol" : "TCP",
......@@ -545,7 +545,7 @@
#-----
,{
"description" : "D2.tsig-keys, too small truncated HMAC-MD5",
"logic-error" : "tsig-key: digest-bits too small : (<string>:1:104)",
"logic-error" : "tsig-key: digest-bits too small : (<string>:1:104)",
"data" :
{
"forward-ddns" : {},
......@@ -565,7 +565,7 @@
#-----
,{
"description" : "D2.tsig-keys, too small truncated HMAC-SHA1",
"logic-error" : "tsig-key: digest-bits too small : (<string>:1:105)",
"logic-error" : "tsig-key: digest-bits too small : (<string>:1:105)",
"data" :
{
"forward-ddns" : {},
......@@ -585,7 +585,7 @@
#-----
,{
"description" : "D2.tsig-keys, too small truncated HMAC-SHA224",
"logic-error" : "tsig-key: digest-bits too small : (<string>:1:107)",
"logic-error" : "tsig-key: digest-bits too small : (<string>:1:107)",
"data" :
{
"forward-ddns" : {},
......@@ -605,7 +605,7 @@
#-----
,{
"description" : "D2.tsig-keys, too small truncated HMAC-SHA256",
"logic-error" : "tsig-key: digest-bits too small : (<string>:1:107)",
"logic-error" : "tsig-key: digest-bits too small : (<string>:1:107)",
"data" :
{
"forward-ddns" : {},
......@@ -625,7 +625,7 @@
#-----
,{
"description" : "D2.tsig-keys, too small truncated HMAC-SHA384",
"logic-error" : "tsig-key: digest-bits too small : (<string>:1:107)",
"logic-error" : "tsig-key: digest-bits too small : (<string>:1:107)",
"data" :
{
"forward-ddns" : {},
......@@ -645,7 +645,7 @@
#-----
,{
"description" : "D2.tsig-keys, too small truncated HMAC-SHA512",
"logic-error" : "tsig-key: digest-bits too small : (<string>:1:107)",
"logic-error" : "tsig-key: digest-bits too small : (<string>:1:107)",
"data" :
{
"forward-ddns" : {},
......
......@@ -210,8 +210,8 @@ JSONFeed::getNextFromBuffer() {
void
JSONFeed::invalidEventError(const std::string& handler_name,
const unsigned int event) {
isc_throw(JSONFeedError, handler_name << ": "
<< " invalid event " << getEventLabel(static_cast<int>(event)));
isc_throw(JSONFeedError, handler_name << ": invalid event "
<< getEventLabel(static_cast<int>(event)));
}
void
......
......@@ -275,8 +275,9 @@ CqlBindUdt(const boost::any& value,
} catch (const boost::bad_any_cast& exception) {
isc_throw(DbOperationError,
"CqlCommon::udtSetData(): "
<< exception.what() << " when binding parameter "
<< " of type " << element.type().name()
<< exception.what()
<< " when binding parameter of type "
<< element.type().name()
<< "in UDT with function CQL_FUNCTIONS["
<< exchangeType(element) << "].cqlUdtSetFunction_");
}
......
......@@ -68,8 +68,8 @@ runCqlScript(const std::string& path,
int32_t retval = ::system(cmd.str().c_str());
if (retval) {
std::cerr << "runCqlSchema failed:" << cmd.str() << std::endl;
isc_throw(Unexpected, "runCqlSchema failed:" << cmd.str());
std::cerr << "runCqlSchema failed: " << cmd.str() << std::endl;
isc_throw(Unexpected, "runCqlSchema failed: " << cmd.str());
}
}
......
......@@ -193,8 +193,9 @@ DbAccessParser::parse(std::string& access_string,
// Check that the max-reconnect-tries is reasonable.
if (max_reconnect_tries < 0) {
ConstElementPtr value = database_config->get("max-reconnect-tries");
isc_throw(DbConfigError, "max-reconnect-tries cannot be less than zero: "
<< " (" << value->getPosition() << ")");
isc_throw(DbConfigError,
"max-reconnect-tries cannot be less than zero: ("
<< value->getPosition() << ")");
}
// Check that the reconnect-wait-time is reasonable.
......@@ -203,7 +204,7 @@ DbAccessParser::parse(std::string& access_string,
ConstElementPtr value = database_config->get("reconnect-wait-time");
isc_throw(DbConfigError, "reconnect-wait-time " << reconnect_wait_time
<< " must be in range 0...MAX_UINT32 (4294967295) "
<< " (" << value->getPosition() << ")");
<< "(" << value->getPosition() << ")");
}
// Check that request_timeout value makes sense.
......@@ -212,7 +213,7 @@ DbAccessParser::parse(std::string& access_string,
ConstElementPtr value = database_config->get("request-timeout");
isc_throw(DbConfigError, "request-timeout " << request_timeout
<< " must be in range 0...MAX_UINT32 (4294967295) "
<< " (" << value->getPosition() << ")");
<< "(" << value->getPosition() << ")");
}
if ((reconnect_wait_time < 0) ||
......@@ -220,7 +221,7 @@ DbAccessParser::parse(std::string& access_string,
ConstElementPtr value = database_config->get("reconnect-wait-time");
isc_throw(DbConfigError, "reconnect-wait-time " << reconnect_wait_time
<< " must be in range 0...MAX_UINT32 (4294967295) "
<< " (" << value->getPosition() << ")");
<< "(" << value->getPosition() << ")");
}
// Check that tcp_keepalive value makes sense.
......@@ -229,7 +230,7 @@ DbAccessParser::parse(std::string& access_string,
ConstElementPtr value = database_config->get("tcp-keepalive");
isc_throw(DbConfigError, "tcp-keepalive " << tcp_keepalive
<< " must be in range 0...MAX_UINT32 (4294967295) "
<< " (" << value->getPosition() << ")");
<< "(" << value->getPosition() << ")");
}
// 4. If all is OK, update the stored keyword/value pairs. We do this by
......
......@@ -580,7 +580,7 @@ OptionDataTypeUtil::readString(const std::vector<uint8_t>& buf) {
auto end = util::str::seekTrimmed(begin, buf.end(), 0x0);
if (std::distance(begin, end) == 0) {
isc_throw(isc::OutOfRange, "string value carried by the option "
<< " contained only NULLs");
"contained only NULLs");
}
value.insert(value.end(), begin, end);
......
......@@ -153,14 +153,18 @@ OptionDefinition::addRecordField(const std::string& data_type_name) {
void
OptionDefinition::addRecordField(const OptionDataType data_type) {
if (type_ != OPT_RECORD_TYPE) {
isc_throw(isc::InvalidOperation, "'record' option type must be used"
" to add data fields to the record");
isc_throw(isc::InvalidOperation,
"'record' option type must be used instead of '"
<< OptionDataTypeUtil::getDataTypeName(type_)
<< "' to add data fields to the record");
}
if (data_type >= OPT_RECORD_TYPE ||
data_type == OPT_ANY_ADDRESS_TYPE ||
data_type == OPT_EMPTY_TYPE) {
isc_throw(isc::BadValue,
"attempted to add invalid data type to the record.");
"attempted to add invalid data type '"
<< OptionDataTypeUtil::getDataTypeName(data_type)
<< "' to the record.");
}
record_fields_.push_back(data_type);
}
......@@ -376,7 +380,7 @@ OptionDefinition::validate() const {
<< " fields of other types.";
break;
}
/// Empty type is not allowed within a record.
// Empty type is not allowed within a record.
if (*it == OPT_EMPTY_TYPE) {
err_str << "empty data type can't be stored as a field in"
<< " an option record.";
......@@ -387,11 +391,11 @@ OptionDefinition::validate() const {
if (err_str.str().empty() && array_type_) {
const OptionDataType& last_type = fields.back();
if (last_type == OPT_STRING_TYPE) {
err_str << "array of strings is not"
<< "a valid option definition.";
err_str
<< "array of strings is not a valid option definition.";
} else if (last_type == OPT_BINARY_TYPE) {
err_str << "array of binary values is not"
<< " a valid option definition.";
err_str << "array of binary values is not a valid option "
"definition.";
}
// Empty type was already checked.
}
......
......@@ -328,7 +328,7 @@ RelayInfoParser::parse(const isc::dhcp::Network::RelayInfoPtr& relay_info,
if (addresses->getType() != Element::list) {
isc_throw(DhcpConfigError, "ip-addresses must be a list "
<< " (" << getPosition("ip-addresses", relay_elem) << ")");
"(" << getPosition("ip-addresses", relay_elem) << ")");
}
BOOST_FOREACH(ConstElementPtr address_element, addresses->listValue()) {
......
......@@ -128,7 +128,7 @@ public:
PgSqlResult r(PQexec(conn, query.c_str()));
if (PQresultStatus(r) != PGRES_TUPLES_OK) {
isc_throw(DbOperationError, "Query failed:" << PQerrorMessage(conn));
isc_throw(DbOperationError, "Query failed: " << PQerrorMessage(conn));
}
int numrows = PQntuples(r);
......
......@@ -221,9 +221,9 @@ HttpMessageParserBase::getNextFromBuffer(std::string& bytes, const size_t limit)
void
HttpMessageParserBase::invalidEventError(const std::string& handler_name,
const unsigned int event) {
isc_throw(HttpParseError, handler_name << ": "
<< " invalid event " << getEventLabel(static_cast<int>(event)));
const unsigned int event) {
isc_throw(HttpParseError, handler_name << ": invalid event "
<< getEventLabel(static_cast<int>(event)));
}
void
......
......@@ -82,8 +82,8 @@ void runMySQLScript(const std::string& path, const std::string& script_name,
int retval = ::system(cmd.str().c_str());
if (retval) {
std::cerr << "runMySQLSchema failed:" << cmd.str() << std::endl;
isc_throw(Unexpected, "runMySQLSchema failed:" << cmd.str());
std::cerr << "runMySQLSchema failed: " << cmd.str() << std::endl;
isc_throw(Unexpected, "runMySQLSchema failed: " << cmd.str());
}
}
......
......@@ -93,8 +93,8 @@ void runPgSQLScript(const std::string& path, const std::string& script_name,
int retval = ::system(cmd.str().c_str());
if (retval) {
std::cerr << "runPgSQLSchema failed:" << cmd.str() << std::endl;
isc_throw(Unexpected, "runPgSQLSchema failed:" << cmd.str());
std::cerr << "runPgSQLSchema failed: " << cmd.str() << std::endl;
isc_throw(Unexpected, "runPgSQLSchema failed: " << cmd.str());
}
}
......
......@@ -47,7 +47,7 @@ DStubProcess::run() {
io_service->run_one();
} catch (const std::exception& ex) {
isc_throw (DProcessBaseError,
std::string("Process run method failed:") + ex.what());
std::string("Process run method failed: ") + ex.what());
}
}
};
......
......@@ -110,9 +110,9 @@ WatchSocket::clearReady() {
// or testing the fd with select_fd will fail.
const char* errstr = strerror(errno);
closeSocket();
isc_throw(WatchSocketError, "WatchSocket clearReady failed:"
<< " bytes read: " << nbytes << " : "
<< " value read: " << buf << " error :" <<errstr);
isc_throw(WatchSocketError, "WatchSocket clearReady failed: "
"bytes read: " << nbytes << " : "
"value read: " << buf << " error :" << errstr);
}
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment