diff --git a/components/common/cpp/include/ftl/configuration.hpp b/components/common/cpp/include/ftl/configuration.hpp index bdbc4a5904b4161f3ec740bc02441dd1292caeab..ec8357155d93e2a9d67d8d2617d3a4f282ad0fe3 100644 --- a/components/common/cpp/include/ftl/configuration.hpp +++ b/components/common/cpp/include/ftl/configuration.hpp @@ -172,11 +172,12 @@ T *ftl::config::create(json_t &link, ARGS ...args) { cfg->patchPtr(link); } - try { - return dynamic_cast<T*>(cfg); - } catch(...) { + T* ptr = dynamic_cast<T*>(cfg); + if (ptr) { + return ptr + } + else { throw FTL_Error("Configuration URI object is of wrong type: " << id); - //return nullptr; } } diff --git a/components/common/cpp/src/uri.cpp b/components/common/cpp/src/uri.cpp index fa059a0a8f8c1c021268dced551518e5d87fe0b5..71b6e195d401f55c53b054c80820daa063c62b17 100644 --- a/components/common/cpp/src/uri.cpp +++ b/components/common/cpp/src/uri.cpp @@ -72,7 +72,7 @@ void URI::_parse(uri_t puri) { m_frag = ""; } else { m_host = std::string(uri.hostText.first, uri.hostText.afterLast - uri.hostText.first); - + std::string prototext = std::string(uri.scheme.first, uri.scheme.afterLast - uri.scheme.first); if (prototext == "tcp") m_proto = SCHEME_TCP; else if (prototext == "udp") m_proto = SCHEME_UDP; @@ -106,7 +106,7 @@ void URI::_parse(uri_t puri) { uri.query.afterLast) != URI_SUCCESS) { // Failure } - + UriQueryListA *item = queryList; while (item) { m_qmap[item->key] = item->value; @@ -140,9 +140,12 @@ void URI::_parse(uri_t puri) { else if (uri.fragment.first != NULL) { m_base += std::string(start, uri.fragment.first - start - 1); } - else { + else if (start) { m_base += std::string(start); } + else { + m_base += std::string(""); + } } } }