From: Scott Cantor Date: Tue, 28 Sep 2010 19:08:34 +0000 (+0000) Subject: Fix JSON array punctuation. X-Git-Tag: 2.4RC1~21 X-Git-Url: http://www.project-moonshot.org/gitweb/?p=shibboleth%2Fcpp-opensaml.git;a=commitdiff_plain;h=3458f782da3d1638b087d9e935e0d177db29d31b Fix JSON array punctuation. --- diff --git a/saml/saml2/metadata/impl/ChainingMetadataProvider.cpp b/saml/saml2/metadata/impl/ChainingMetadataProvider.cpp index 3e5f312..ef2a3ec 100644 --- a/saml/saml2/metadata/impl/ChainingMetadataProvider.cpp +++ b/saml/saml2/metadata/impl/ChainingMetadataProvider.cpp @@ -76,13 +76,15 @@ namespace opensaml { os << "[\n"; // Lock each provider in turn and suck in its feed. for (vector::const_iterator m = m_providers.begin(); m != m_providers.end(); ++m) { + if (m != m_providers.begin()) + os << ",\n"; DiscoverableMetadataProvider* d = dynamic_cast(*m); if (d) { Locker locker(d); d->outputFeed(os); } } - os << "]\n"; + os << ']'; return os; } diff --git a/saml/saml2/metadata/impl/DiscoverableMetadataProvider.cpp b/saml/saml2/metadata/impl/DiscoverableMetadataProvider.cpp index 5274446..1e3a9bc 100644 --- a/saml/saml2/metadata/impl/DiscoverableMetadataProvider.cpp +++ b/saml/saml2/metadata/impl/DiscoverableMetadataProvider.cpp @@ -35,7 +35,7 @@ using namespace xmltooling; using namespace std; namespace { - void disco(string& s, const EntityDescriptor* entity, bool first) { + void disco(string& s, const EntityDescriptor* entity, bool& first) { if (entity) { const vector& idps = entity->getIDPSSODescriptors(); if (!idps.empty()) { @@ -161,7 +161,7 @@ namespace { } } - void disco(string& s, const EntitiesDescriptor* group, bool first) { + void disco(string& s, const EntitiesDescriptor* group, bool& first) { if (group) { const vector& groups = group->getEntitiesDescriptors(); for (vector::const_iterator i = groups.begin(); i != groups.end(); ++i) @@ -189,7 +189,7 @@ void DiscoverableMetadataProvider::generateFeed() const XMLObject* object = getMetadata(); disco(m_feed, dynamic_cast(object), first); disco(m_feed, dynamic_cast(object), first); - m_feed += "\n]\n"; + m_feed += "\n]"; SAMLConfig::getConfig().generateRandomBytes(m_feedTag, 4); m_feedTag = SAMLArtifact::toHex(m_feedTag);