From 8e90e18426cf9465a2127aa4661a598c8ab98281 Mon Sep 17 00:00:00 2001 From: Scott Cantor Date: Thu, 28 Jun 2007 23:41:25 +0000 Subject: [PATCH] Expose detection of duplicate insertions. --- saml/binding/impl/ArtifactMap.cpp | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/saml/binding/impl/ArtifactMap.cpp b/saml/binding/impl/ArtifactMap.cpp index c22c6ef..2028ac0 100644 --- a/saml/binding/impl/ArtifactMap.cpp +++ b/saml/binding/impl/ArtifactMap.cpp @@ -204,9 +204,14 @@ void ArtifactMap::storeContent(XMLObject* content, const SAMLArtifact* artifact, // Serialize the root element, whatever it is, for storage. string xmlbuf; XMLHelper::serialize(root, xmlbuf); - m_storage->createText( - m_context.c_str(), SAMLArtifact::toHex(artifact->getMessageHandle()).c_str(), xmlbuf.c_str(), time(NULL) + m_artifactTTL - ); + if (!m_storage->createText( + m_context.c_str(), + SAMLArtifact::toHex(artifact->getMessageHandle()).c_str(), + xmlbuf.c_str(), + time(NULL) + m_artifactTTL + )) { + throw IOException("Attempt to insert duplicate artifact into map."); + } // Cleanup by destroying XML. delete content; -- 2.1.4