summaryrefslogtreecommitdiff
path: root/sax
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2014-10-02 14:29:45 +0100
committerCaolán McNamara <caolanm@redhat.com>2014-10-02 14:49:11 +0100
commitf1694b3f189c0893d7987bcb19f1c682c7afc368 (patch)
treee348e84217656c98e3187bfd72c3172d86cf94ac /sax
parentfd8682cc34826229f67d51c387f6f6aa0b2c228a (diff)
coverity#1158274 Uncaught exception
Change-Id: Icfbe30efa3ebd63620a900e345e4b4a74070b021
Diffstat (limited to 'sax')
-rw-r--r--sax/source/expatwrap/saxwriter.cxx31
1 files changed, 21 insertions, 10 deletions
diff --git a/sax/source/expatwrap/saxwriter.cxx b/sax/source/expatwrap/saxwriter.cxx
index 79374ab4cd92..b6629161ee95 100644
--- a/sax/source/expatwrap/saxwriter.cxx
+++ b/sax/source/expatwrap/saxwriter.cxx
@@ -23,6 +23,7 @@
#include <set>
#include <stack>
+#include <com/sun/star/lang/WrappedTargetRuntimeException.hpp>
#include <com/sun/star/lang/XServiceInfo.hpp>
#include <com/sun/star/uno/XComponentContext.hpp>
#include <com/sun/star/util/XCloneable.hpp>
@@ -891,17 +892,27 @@ public: // XActiveDataSource
virtual void SAL_CALL setOutputStream(const Reference< XOutputStream > & aStream)
throw (RuntimeException, std::exception) SAL_OVERRIDE
{
- // temporary: set same stream again to clear buffer
- if ( m_out == aStream && m_pSaxWriterHelper && m_bDocStarted )
- m_pSaxWriterHelper->clearBuffer();
- else
+ try
+ {
+ // temporary: set same stream again to clear buffer
+ if ( m_out == aStream && m_pSaxWriterHelper && m_bDocStarted )
+ m_pSaxWriterHelper->clearBuffer();
+ else
+ {
+ m_out = aStream;
+ delete m_pSaxWriterHelper;
+ m_pSaxWriterHelper = new SaxWriterHelper(m_out);
+ m_bDocStarted = false;
+ m_nLevel = 0;
+ m_bIsCDATA = false;
+ }
+ }
+ catch (const SAXException& e)
{
- m_out = aStream;
- delete m_pSaxWriterHelper;
- m_pSaxWriterHelper = new SaxWriterHelper(m_out);
- m_bDocStarted = false;
- m_nLevel = 0;
- m_bIsCDATA = false;
+ throw css::lang::WrappedTargetRuntimeException(
+ e.Message,
+ static_cast < OWeakObject * > ( this ),
+ e.WrappedException);
}
}
virtual Reference< XOutputStream > SAL_CALL getOutputStream(void)