From: Eduardo Ramos Testillano (eramedu) Date: Sun, 17 May 2020 18:26:24 +0000 (+0200) Subject: Fix xml representations X-Git-Url: https://git.teslayout.com/public/public/public/?a=commitdiff_plain;h=e782294456d0877aa8fc05aa931291ac79808eb3;p=anna.git Fix xml representations < is not allowed (should be <). Changed to [ to avoid problems --- diff --git a/docker-images/anna-adml-http/Dockerfile b/docker-images/anna-adml-http/Dockerfile index c08c1e1..b27fecd 100644 --- a/docker-images/anna-adml-http/Dockerfile +++ b/docker-images/anna-adml-http/Dockerfile @@ -11,5 +11,7 @@ COPY starter.sh /var/starter.sh EXPOSE 8074 WORKDIR /opt/adml +#ENV TZ=Europe/Madrid + ENTRYPOINT ["sh", "/var/starter.sh"] CMD [] diff --git a/example/diameter/launcher/EventOperation.cpp b/example/diameter/launcher/EventOperation.cpp index a3ee7ba..4d80410 100644 --- a/example/diameter/launcher/EventOperation.cpp +++ b/example/diameter/launcher/EventOperation.cpp @@ -357,7 +357,7 @@ bool EventOperation::sendmsg_hex_2e(std::string &response, const std::string & d if(my_app.getOperatedHost()->logEnabled()) { anna::diameter::comm::Server *usedServer = my_app.getOperatedEntity()->getLastUsedResource(); anna::diameter::comm::ClientSession *usedClientSession = usedServer ? usedServer->getLastUsedResource() : NULL; - std::string detail = usedClientSession ? usedClientSession->asString() : ""; // shouldn't happen + std::string detail = usedClientSession ? usedClientSession->asString() : "[null client session]"; // shouldn't happen my_app.getOperatedHost()->writeLogFile(codecMsg, (success ? "sent2e" : "send2eError"), detail); } @@ -422,7 +422,7 @@ bool EventOperation::sendmsg_hex_2c(std::string &response, const std::string & d // Detailed log: if(my_app.getOperatedHost()->logEnabled()) { anna::diameter::comm::ServerSession *usedServerSession = my_app.getOperatedServer()->getLastUsedResource(); - std::string detail = usedServerSession ? usedServerSession->asString() : ""; // shouldn't happen + std::string detail = usedServerSession ? usedServerSession->asString() : "[null server session]"; // shouldn't happen my_app.getOperatedHost()->writeLogFile(codecMsg, (success ? "sent2c" : "send2cError"), detail); } @@ -877,12 +877,12 @@ bool EventOperation::test__ip_limit(std::string &response, int amount) { if (amount > -2) { testManager.setInProgressLimit(amount); response = "New in-progress limit: "; - response += (amount != -1) ? anna::functions::asString(amount) : ""; + response += (amount != -1) ? anna::functions::asString(amount) : "[no limit]"; } else { response = "In-progress limit amount: "; int limit = testManager.getInProgressLimit(); - response += (limit != -1) ? anna::functions::asString(limit) : ""; + response += (limit != -1) ? anna::functions::asString(limit) : "[no limit]"; response += "; currently there are "; response += anna::functions::asString(testManager.getInProgressCount()); response += " test cases running"; diff --git a/example/diameter/launcher/Launcher.cpp b/example/diameter/launcher/Launcher.cpp index 0fe55a0..487c632 100644 --- a/example/diameter/launcher/Launcher.cpp +++ b/example/diameter/launcher/Launcher.cpp @@ -1201,7 +1201,7 @@ bool Launcher::eventOperation(const std::string &operation, std::string &respons if(getOperatedHost()->logEnabled()) { anna::diameter::comm::Server *usedServer = getOperatedEntity()->getLastUsedResource(); anna::diameter::comm::ClientSession *usedClientSession = usedServer ? usedServer->getLastUsedResource() : NULL; - std::string detail = usedClientSession ? usedClientSession->asString() : ""; // shouldn't happen + std::string detail = usedClientSession ? usedClientSession->asString() : "[null client session]"; // shouldn't happen getOperatedHost()->writeLogFile(codecMsg, (success ? "sent2e" : "send2eError"), detail); } } else if((opType == "sendxml2c") || (opType == "sendhex2c")) { @@ -1230,7 +1230,7 @@ bool Launcher::eventOperation(const std::string &operation, std::string &respons // Detailed log: if(getOperatedHost()->logEnabled()) { anna::diameter::comm::ServerSession *usedServerSession = getOperatedServer()->getLastUsedResource(); - std::string detail = usedServerSession ? usedServerSession->asString() : ""; // shouldn't happen + std::string detail = usedServerSession ? usedServerSession->asString() : "[null server session]"; // shouldn't happen getOperatedHost()->writeLogFile(codecMsg, (success ? "sent2c" : "send2cError"), detail); } } else if(opType == "answerxml2e") { @@ -1441,12 +1441,12 @@ bool Launcher::eventOperation(const std::string &operation, std::string &respons limit = atoi(param2.c_str()); testManager.setInProgressLimit(limit); opt_response = "new in-progress limit: "; - opt_response += (limit != UINT_MAX) ? anna::functions::asString(limit) : ""; + opt_response += (limit != UINT_MAX) ? anna::functions::asString(limit) : "[no limit]"; } else { opt_response = "in-progress limit amount: "; limit = testManager.getInProgressLimit(); - opt_response += (limit != UINT_MAX) ? anna::functions::asString(limit) : ""; + opt_response += (limit != UINT_MAX) ? anna::functions::asString(limit) : "[no limit]"; opt_response += "; currently there are "; opt_response += anna::functions::asString(testManager.getInProgressCount()); opt_response += " test cases running"; diff --git a/example/diameter/launcher/MyDiameterEntity.cpp b/example/diameter/launcher/MyDiameterEntity.cpp index f0864df..3e50d70 100644 --- a/example/diameter/launcher/MyDiameterEntity.cpp +++ b/example/diameter/launcher/MyDiameterEntity.cpp @@ -125,7 +125,7 @@ throw(anna::RuntimeException) { // Detailed log: if(my_node->logEnabled()) { anna::diameter::comm::ServerSession *usedServerSession = localServer->getLastUsedResource(); - std::string detail = usedServerSession ? usedServerSession->asString() : ""; // esto no deberia ocurrir + std::string detail = usedServerSession ? usedServerSession->asString() : "[null server session]"; // esto no deberia ocurrir my_node->writeLogFile(message, (success ? "fwd2c" : "fwd2cError"), detail); } } catch(anna::RuntimeException &ex) { @@ -208,7 +208,7 @@ throw(anna::RuntimeException) { // Detailed log: anna::diameter::comm::ServerSession *usedServerSession = my_node->getCommEngine()->findServerSession(request->getRequestServerSessionKey()); - std::string detail = usedServerSession ? usedServerSession->asString() : ""; // esto no deberia ocurrir + std::string detail = usedServerSession ? usedServerSession->asString() : "[null server session]"; // esto no deberia ocurrir if(my_node->logEnabled()) { my_node->writeLogFile(*message, (success ? "fwd2c" : "fwd2cError"), detail); diff --git a/example/diameter/launcher/MyLocalServer.cpp b/example/diameter/launcher/MyLocalServer.cpp index 50ab634..f18653f 100644 --- a/example/diameter/launcher/MyLocalServer.cpp +++ b/example/diameter/launcher/MyLocalServer.cpp @@ -65,7 +65,7 @@ throw(anna::RuntimeException) { if(my_node->logEnabled()) { anna::diameter::comm::Server *usedServer = entity->getLastUsedResource(); anna::diameter::comm::ClientSession *usedClientSession = usedServer ? usedServer->getLastUsedResource() : NULL; - std::string detail = usedClientSession ? usedClientSession->asString() : ""; // esto no deberia ocurrir + std::string detail = usedClientSession ? usedClientSession->asString() : "[null client session]"; // esto no deberia ocurrir my_node->writeLogFile(message, (success ? "fwd2e" : "fwd2eError"), detail); // forwarded } @@ -199,7 +199,7 @@ throw(anna::RuntimeException) { anna::diameter::comm::ClientSession *usedClientSession = my_node->getCommEngine()->findClientSession(request->getRequestClientSessionKey()); std::string detail; - if(my_node->logEnabled()) detail = usedClientSession ? usedClientSession->asString() : ""; // this should not happen + if(my_node->logEnabled()) detail = usedClientSession ? usedClientSession->asString() : "[null client session]"; // this should not happen anna::diameter::comm::Message *msg; try { diff --git a/include/anna/time/internal/Timezone.hpp b/include/anna/time/internal/Timezone.hpp index 0dff2f4..532ccc4 100644 --- a/include/anna/time/internal/Timezone.hpp +++ b/include/anna/time/internal/Timezone.hpp @@ -99,10 +99,10 @@ public: bool apply() const throw() { // http://stackoverflow.com/questions/5873029/questions-about-putenv-and-setenv if(unsetTZ()) { - unsetenv("TZ"); - } - else { - setenv("TZ", a_value.c_str(), 1 /* overwrite */); + unsetenv("TZ"); + } + else { + setenv("TZ", a_value.c_str(), 1 /* overwrite */); /* // If TZ has an invalid setting, tzset() uses GMT0: @@ -115,15 +115,15 @@ public: if (!success) std::cerr << "Invalid TZ '" << a_value << "'. Probably GMT0 is going to be used instead !" << std::endl; return success; */ - } + } return true; } std::string asString() const throw() { std::string result = getValue(); - if (unsetTZ()) return ""; - if (result == "") return ""; + if (unsetTZ()) return "[TZ unset]"; + if (result == "") return "[TZ empty]"; return result; } }; diff --git a/source/comm/INetAddress.cpp b/source/comm/INetAddress.cpp index 924c3bd..f9dbd2d 100644 --- a/source/comm/INetAddress.cpp +++ b/source/comm/INetAddress.cpp @@ -49,7 +49,7 @@ throw(RuntimeException) { if(a_device != NULL) a_device->asAttribute(result); else - result->createAttribute("Device", ""); + result->createAttribute("Device", "[null]"); result->createAttribute("Port", a_port); return result; diff --git a/source/diameter.comm/ClassCode.cpp b/source/diameter.comm/ClassCode.cpp index 0c8cfc0..40d2c37 100644 --- a/source/diameter.comm/ClassCode.cpp +++ b/source/diameter.comm/ClassCode.cpp @@ -15,12 +15,12 @@ using namespace std; //throw() { // static const char* text [] = { "Undefined", "Bind", "ApplicationMessage" }; // string result("ClassCode: "); -// return result += (v >= Min && v < Max) ? text [v] : ""; +// return result += (v >= Min && v < Max) ? text [v] : "[null]"; //} string anna::diameter::comm::ClassCode::asText(const ClassCode::_v v) throw() { static const char* text [] = { "Undefined", "Bind", "ApplicationMessage" }; - return string((v >= Min && v < Max) ? text [v] : ""); + return string((v >= Min && v < Max) ? text [v] : "[null]"); } diff --git a/source/diameter.comm/Entity.cpp b/source/diameter.comm/Entity.cpp index 7bc1411..fc07148 100644 --- a/source/diameter.comm/Entity.cpp +++ b/source/diameter.comm/Entity.cpp @@ -354,9 +354,9 @@ std::string Entity::asString() const throw() { std::string originHost = a_engine->getOriginHostName(); result += "Parent Engine Origin-Realm: "; - result += (originRealm != "") ? originRealm:""; + result += (originRealm != "") ? originRealm:"[not configured]"; result += " | Parent Engine Origin-Host: "; - result += (originHost != "") ? originHost:""; + result += (originHost != "") ? originHost:"[not configured]"; result += " | Category: "; result += anna::functions::asString(a_category); diff --git a/source/diameter.comm/OriginHost.cpp b/source/diameter.comm/OriginHost.cpp index ed181bd..498c6fa 100644 --- a/source/diameter.comm/OriginHost.cpp +++ b/source/diameter.comm/OriginHost.cpp @@ -351,7 +351,7 @@ bool OriginHost::sendBurstMessage(bool anyway) throw() { if(logEnabled()) { anna::diameter::comm::Server *usedServer = a_entity->getLastUsedResource(); anna::diameter::comm::ClientSession *usedClientSession = usedServer ? usedServer->getLastUsedResource() : NULL; - std::string detail = usedClientSession ? usedClientSession->asString() : ""; // esto no deberia ocurrir + std::string detail = usedClientSession ? usedClientSession->asString() : "[null client session]"; // esto no deberia ocurrir writeLogFile(msg->getBody(), (result ? "sent2e" : "send2eError"), detail); // el del nodo de trabajo } diff --git a/source/diameter/codec/EngineImpl.cpp b/source/diameter/codec/EngineImpl.cpp index 268cb06..50b8134 100644 --- a/source/diameter/codec/EngineImpl.cpp +++ b/source/diameter/codec/EngineImpl.cpp @@ -110,7 +110,7 @@ std::string EngineImpl::asString(void) const throw() { result += "\nFixMode: "; result += asText(a_fixMode); result += "\nActivated Dictionary: "; - result += a_dictionary ? (a_dictionary->getName()) : ""; + result += a_dictionary ? (a_dictionary->getName()) : "[null]"; return result; } diff --git a/source/testing/TestManager.cpp b/source/testing/TestManager.cpp index c8c65e3..8b72efa 100644 --- a/source/testing/TestManager.cpp +++ b/source/testing/TestManager.cpp @@ -553,7 +553,7 @@ throw() { result->createAttribute("PoolCycle", a_poolCycle); a_statSummary.asXML(result); if (a_inProgressLimit == UINT_MAX) - result->createAttribute("InProgressLimit", ""); + result->createAttribute("InProgressLimit", "[no limit]"); else result->createAttribute("InProgressLimit", a_inProgressLimit); result->createAttribute("DumpInitializedReports", (a_dumpInitializedReports ? "yes":"no")); diff --git a/source/testing/TestStep.cpp b/source/testing/TestStep.cpp index 5355024..84c577c 100644 --- a/source/testing/TestStep.cpp +++ b/source/testing/TestStep.cpp @@ -374,7 +374,7 @@ throw() { // Message if (TestManager::instantiate().getDumpHex()) { if (a_message.isEmpty()) { - msg = ""; + msg = "[empty]"; } else { msg = "\n"; msg += a_message.asString(); msg += "\n"; @@ -387,7 +387,7 @@ throw() { xmlmsg += "\n"; } else { - xmlmsg = ""; + xmlmsg = "[unable to decode, check traces]"; } if (msg != "") result->createAttribute("Message", msg); @@ -478,7 +478,7 @@ bool TestStepSendDiameterXml::do_execute() throw() { // Detailed log: if(a_originHost->logEnabled()) { if (decodeMessage(true /* trust */)) { - std::string detail = usedClientSession ? usedClientSession->asString() : ""; // shouldn't happen + std::string detail = usedClientSession ? usedClientSession->asString() : "[null client session]"; // shouldn't happen a_originHost->writeLogFile(*a_messageCodec, (success ? "sent2e" : "send2eError"), detail); } } @@ -512,7 +512,7 @@ bool TestStepSendDiameterXml::do_execute() throw() { // Detailed log: if(a_originHost->logEnabled()) { if (decodeMessage(true /* trust */)) { - std::string detail = usedServerSession ? usedServerSession->asString() : ""; // shouldn't happen + std::string detail = usedServerSession ? usedServerSession->asString() : "[null server session]"; // shouldn't happen a_originHost->writeLogFile(*a_messageCodec, (success ? "sent2c" : "send2cError"), detail); } } @@ -642,7 +642,7 @@ throw() { // Message if (TestManager::instantiate().getDumpHex()) { if (a_message.isEmpty()) { - msg = ""; + msg = "[empty]"; } else { msg = "\n"; msg += a_message.asString(); msg += "\n"; @@ -650,7 +650,7 @@ throw() { } if (a_message.isEmpty()) { - xmlmsg = ""; + xmlmsg = "[empty]"; } else { if (decodeMessage()) { @@ -659,7 +659,7 @@ throw() { xmlmsg += "\n"; } else { - xmlmsg = ""; + xmlmsg = "[unable to decode, check traces]"; } } @@ -713,7 +713,7 @@ throw() { anna::xml::Node* result = TestStep::asXML(parent); //parent->createChild("TestStepCmd"); - result->createAttribute("Script", (a_script != "") ? a_script:""); + result->createAttribute("Script", (a_script != "") ? a_script:"[no script]"); if (a_errorMsg != "") result->createAttribute("ErrorMessage", a_errorMsg); if (a_threadRunning) { if (a_childPid != -1) @@ -795,7 +795,7 @@ void TestStepCmd::do_reset() throw() { anna::xml::Node* TestStepIpLimit::asXML(anna::xml::Node* parent) throw() { anna::xml::Node* result = TestStep::asXML(parent); - std::string limit = (a_ipLimit != UINT_MAX) ? anna::functions::asString(a_ipLimit) : ""; + std::string limit = (a_ipLimit != UINT_MAX) ? anna::functions::asString(a_ipLimit) : "[no limit]"; result->createAttribute("IpLimit", limit); return result; @@ -809,7 +809,7 @@ bool TestStepIpLimit::do_execute() throw() { void TestStepIpLimit::do_complete() throw() { if (TestManager::instantiate().getDumpStdout()) { - std::string limit = (a_ipLimit != UINT_MAX) ? anna::functions::asString(a_ipLimit) : ""; + std::string limit = (a_ipLimit != UINT_MAX) ? anna::functions::asString(a_ipLimit) : "[no limit]"; std::cout << "Executed IpLimit Test Step (value = " << limit << ")" << std::endl; } }