X-Git-Url: http://www.project-moonshot.org/gitweb/?a=blobdiff_plain;f=xmltooling%2Fexceptions.cpp;h=170f9d9b11b3d8c22ece6d5c7e46ca0cc52630b7;hb=1f81c52bf8c75a02d6d1e7cc56d361ffcdc5a1aa;hp=ea8aa40f44832f99485c6597c61b07fa510fd550;hpb=033df5e662eacf00a6e96e82dfab459501c0020f;p=shibboleth%2Fcpp-xmltooling.git diff --git a/xmltooling/exceptions.cpp b/xmltooling/exceptions.cpp index ea8aa40..170f9d9 100644 --- a/xmltooling/exceptions.cpp +++ b/xmltooling/exceptions.cpp @@ -1,5 +1,5 @@ /* - * Copyright 2001-2007 Internet2 + * Copyright 2001-2009 Internet2 * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -249,9 +249,10 @@ string XMLToolingException::toString() const const char* msg=getMessage(); if (msg) xml_encode(xml, "", msg, ""); + const URLEncoder* encoder = XMLToolingConfig::getConfig().getURLEncoder(); for (map::const_iterator i=m_params.begin(); i!=m_params.end(); i++) { xml_encode(xml, "", i->second.c_str(), ""); + xml_encode(xml, ">", encoder->encode(i->second.c_str()).c_str(), ""); } xml+=""; return xml; @@ -295,13 +296,16 @@ XMLToolingException* XMLToolingException::fromStream(std::istream& in) excep->setMessage(m.get()); } + const URLEncoder* encoder = XMLToolingConfig::getConfig().getURLEncoder(); child=XMLHelper::getFirstChildElement(root,XMLTOOLING_NS,param); while (child && child->hasChildNodes()) { auto_ptr_char n(child->getAttributeNS(NULL,name)); - char* v=toUTF8(child->getFirstChild()->getNodeValue()); - if (n.get() && v) - excep->addProperty(n.get(), v); - delete[] v; + char* encoded = XMLString::transcode(child->getFirstChild()->getNodeValue()); + if (n.get() && encoded) { + encoder->decode(encoded); + excep->addProperty(n.get(), encoded); + } + XMLString::release(&encoded); child=XMLHelper::getNextSiblingElement(child,XMLTOOLING_NS,param); }