summaryrefslogtreecommitdiffstats
path: root/vespaclient
diff options
context:
space:
mode:
authorHenning Baldersheim <balder@yahoo-inc.com>2022-06-27 11:54:45 +0000
committerHenning Baldersheim <balder@yahoo-inc.com>2022-06-27 11:54:45 +0000
commit757b5a79324595187ae9f90f001eace76e8245f1 (patch)
treec3f53270c1aa0b808265af8d536dc477b62a9336 /vespaclient
parent971d73a56fa81fa889579f22c959f402542a5cc2 (diff)
Use 'using' for less verbose code and remove extra space in if.
Diffstat (limited to 'vespaclient')
-rw-r--r--vespaclient/src/vespa/vespaclient/vesparoute/application.cpp32
1 files changed, 16 insertions, 16 deletions
diff --git a/vespaclient/src/vespa/vespaclient/vesparoute/application.cpp b/vespaclient/src/vespa/vespaclient/vesparoute/application.cpp
index c70fd333669..f70ffcc2655 100644
--- a/vespaclient/src/vespa/vespaclient/vesparoute/application.cpp
+++ b/vespaclient/src/vespa/vespaclient/vesparoute/application.cpp
@@ -18,8 +18,10 @@
#include <vespa/fnet/frt/supervisor.h>
using config::ConfigGetter;
+using config::InvalidConfigException;
using messagebus::MessagebusConfig;
using document::DocumentTypeRepo;
+using namespace vespalib::make_string_short;
namespace vesparoute {
@@ -59,13 +61,11 @@ Application::main(int argc, char **argv)
// _P_A_R_A_N_O_I_A_
mbus::RoutingTable::SP table = _mbus->getRoutingTable(_params.getProtocol());
if ( ! table) {
- throw config::InvalidConfigException(vespalib::make_string("There is no routing table for protocol '%s'.",
- _params.getProtocol().c_str()));
+ throw InvalidConfigException(fmt("There is no routing table for protocol '%s'.", _params.getProtocol().c_str()));
}
for (const std::string & hop : _params.getHops()) {
if (table->getHop(hop) == NULL) {
- throw config::InvalidConfigException(vespalib::make_string("There is no hop named '%s' for protocol '%s'.",
- hop.c_str(), _params.getProtocol().c_str()));
+ throw InvalidConfigException(fmt("There is no hop named '%s' for protocol '%s'.", hop.c_str(), _params.getProtocol().c_str()));
}
}
@@ -108,7 +108,7 @@ Application::parseArgs(int argc, char **argv)
if (++arg < argc) {
_params.setDocumentTypesConfigId(argv[arg]);
} else {
- throw config::InvalidConfigException("Missing value for parameter 'documenttypesconfigid'.");
+ throw InvalidConfigException("Missing value for parameter 'documenttypesconfigid'.");
}
} else if (strcasecmp(argv[arg], "--dump") == 0) {
_params.setDump(true);
@@ -120,7 +120,7 @@ Application::parseArgs(int argc, char **argv)
if (++arg < argc) {
_params.getHops().push_back(argv[arg]);
} else {
- throw config::InvalidConfigException("Missing value for parameter 'hop'.");
+ throw InvalidConfigException("Missing value for parameter 'hop'.");
}
} else if (strcasecmp(argv[arg], "--hops") == 0) {
_params.setListHops(true);
@@ -128,25 +128,25 @@ Application::parseArgs(int argc, char **argv)
if (++arg < argc) {
_params.getRPCNetworkParams().setIdentity(mbus::Identity(argv[arg]));
} else {
- throw config::InvalidConfigException("Missing value for parameter 'identity'.");
+ throw InvalidConfigException("Missing value for parameter 'identity'.");
}
} else if (strcasecmp(argv[arg], "--listenport") == 0) {
if (++arg < argc) {
_params.getRPCNetworkParams().setListenPort(atoi(argv[arg]));
} else {
- throw config::InvalidConfigException("Missing value for parameter 'listenport'.");
+ throw InvalidConfigException("Missing value for parameter 'listenport'.");
}
} else if (strcasecmp(argv[arg], "--protocol") == 0) {
if (++arg < argc) {
_params.setProtocol(argv[arg]);
} else {
- throw config::InvalidConfigException("Missing value for parameter 'protocol'.");
+ throw InvalidConfigException("Missing value for parameter 'protocol'.");
}
} else if (strcasecmp(argv[arg], "--route") == 0) {
if (++arg < argc) {
_params.getRoutes().push_back(argv[arg]);
} else {
- throw config::InvalidConfigException("Missing value for parameter 'route'.");
+ throw InvalidConfigException("Missing value for parameter 'route'.");
}
} else if (strcasecmp(argv[arg], "--routes") == 0) {
_params.setListRoutes(true);
@@ -154,7 +154,7 @@ Application::parseArgs(int argc, char **argv)
if (++arg < argc) {
_params.setRoutingConfigId(argv[arg]);
} else {
- throw config::InvalidConfigException("Missing value for parameter 'routingconfigid'.");
+ throw InvalidConfigException("Missing value for parameter 'routingconfigid'.");
}
} else if (strcasecmp(argv[arg], "--services") == 0) {
_params.setListServices(true);
@@ -162,12 +162,12 @@ Application::parseArgs(int argc, char **argv)
if (++arg < argc) {
_params.setSlobrokId(argv[arg]);
} else {
- throw config::InvalidConfigException("Missing value for parameter 'slobrokconfigid'.");
+ throw InvalidConfigException("Missing value for parameter 'slobrokconfigid'.");
}
} else if (strcasecmp(argv[arg], "--verify") == 0) {
_params.setVerify(true);
} else {
- throw config::InvalidConfigException(vespalib::make_string("Unknown option '%s'.", argv[arg]));
+ throw InvalidConfigException(fmt("Unknown option '%s'.", argv[arg]));
}
}
return true;
@@ -205,7 +205,7 @@ Application::verifyRoute(const mbus::Route &route, std::set<std::string> &errors
for (std::set<std::string>::iterator err = hopErrors.begin();
err != hopErrors.end(); ++err)
{
- errors.insert(vespalib::make_string("for hop '%s', %s", str.c_str(), err->c_str()));
+ errors.insert(fmt("for hop '%s', %s", str.c_str(), err->c_str()));
}
}
}
@@ -236,7 +236,7 @@ Application::verifyHop(const mbus::HopBlueprint &hop, std::set<std::string> &err
if (hop.getDirective(0)->getType() == mbus::IHopDirective::TYPE_ROUTE) {
const mbus::RouteDirective &dir = static_cast<const mbus::RouteDirective &>(*hop.getDirective(0));
if (table.getRoute(dir.getName()) == nullptr) {
- errors.insert(vespalib::make_string("route '%s' not found", dir.getName().c_str()));
+ errors.insert(fmt("route '%s' not found", dir.getName().c_str()));
return false;
} else {
return true;
@@ -494,7 +494,7 @@ Application::isService(FRT_Supervisor &frt, const std::string &spec) const
FRT_StringValue *retList = req->GetReturn()->GetValue(2)._string_array._pt;
for (uint32_t i = 0; i < numMethods; ++i) {
- if ( mbus::RPCSendV2::isCompatible(methods[i]._str,argList[i]._str, retList[i]._str)) {
+ if (mbus::RPCSendV2::isCompatible(methods[i]._str,argList[i]._str, retList[i]._str)) {
ret = true;
break;
}