diff options
author | Caolán McNamara <caolanm@redhat.com> | 2015-06-05 11:45:36 +0100 |
---|---|---|
committer | Miklos Vajna <vmiklos@collabora.co.uk> | 2015-06-09 08:55:32 +0000 |
commit | c6427d1d5fe398967801ae5f5cd5888afa2a8b14 (patch) | |
tree | 42bda0c6f207a159ec76f1de26156b182fe21c7a /package | |
parent | a78f63f513cee4e1caeb730dae270e76b1009e14 (diff) |
uncaught exceptions in parallel deflate threads on re-export of HTB23106 odgs
Change-Id: Ib6aef478b8dcf1c7a7262ab60eef4d44da0de632
(cherry picked from commit 05661623c7e328c536814354bafd8294de0e9ee0)
(cherry picked from commit 56b5b8aac8729a37814f82b83ebba0d16f87e407)
Reviewed-on: https://gerrit.libreoffice.org/16096
Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk>
Tested-by: Miklos Vajna <vmiklos@collabora.co.uk>
Diffstat (limited to 'package')
-rw-r--r-- | package/inc/ZipOutputEntry.hxx | 4 | ||||
-rw-r--r-- | package/source/zipapi/ZipOutputStream.cxx | 6 | ||||
-rw-r--r-- | package/source/zippackage/ZipPackageStream.cxx | 12 |
3 files changed, 20 insertions, 2 deletions
diff --git a/package/inc/ZipOutputEntry.hxx b/package/inc/ZipOutputEntry.hxx index 48e33ebb546f..2a5aa0483ce8 100644 --- a/package/inc/ZipOutputEntry.hxx +++ b/package/inc/ZipOutputEntry.hxx @@ -42,6 +42,7 @@ class ZipOutputEntry ::com::sun::star::uno::Reference< ::com::sun::star::xml::crypto::XCipherContext > m_xCipherContext; ::com::sun::star::uno::Reference< ::com::sun::star::xml::crypto::XDigestContext > m_xDigestContext; + ::css::uno::Any m_aParallelDeflateException; CRC32 m_aCRC; ZipEntry *m_pCurrentEntry; @@ -62,6 +63,9 @@ public: ZipPackageStream* getZipPackageStream() { return m_pCurrentStream; } bool isEncrypt() { return m_bEncryptCurrentEntry; } + void setParallelDeflateException(const ::css::uno::Any &rAny) { m_aParallelDeflateException = rAny; } + ::css::uno::Any getParallelDeflateException() const { return m_aParallelDeflateException; } + void closeEntry(); void write(const css::uno::Sequence< sal_Int8 >& rBuffer); diff --git a/package/source/zipapi/ZipOutputStream.cxx b/package/source/zipapi/ZipOutputStream.cxx index 9c56f45702cf..a8853409f8fe 100644 --- a/package/source/zipapi/ZipOutputStream.cxx +++ b/package/source/zipapi/ZipOutputStream.cxx @@ -23,6 +23,7 @@ #include <com/sun/star/io/XInputStream.hpp> #include <com/sun/star/io/XOutputStream.hpp> #include <comphelper/storagehelper.hxx> +#include <cppuhelper/exc_hlp.hxx> #include <osl/diagnose.h> #include <osl/time.h> @@ -101,6 +102,11 @@ void ZipOutputStream::finish() m_rSharedThreadPool.waitUntilEmpty(); for (size_t i = 0; i < m_aEntries.size(); i++) { + //Any exceptions thrown in the threads were caught and stored for now + ::css::uno::Any aCaughtException(m_aEntries[i]->getParallelDeflateException()); + if (aCaughtException.hasValue()) + ::cppu::throwException(aCaughtException); + writeLOC(m_aEntries[i]->getZipEntry(), m_aEntries[i]->isEncrypt()); sal_Int32 nRead; diff --git a/package/source/zippackage/ZipPackageStream.cxx b/package/source/zippackage/ZipPackageStream.cxx index c34ba01bf7dc..bd3ab209f877 100644 --- a/package/source/zippackage/ZipPackageStream.cxx +++ b/package/source/zippackage/ZipPackageStream.cxx @@ -46,6 +46,7 @@ #include <comphelper/processfactory.hxx> #include <comphelper/seekableinput.hxx> #include <comphelper/storagehelper.hxx> +#include <cppuhelper/exc_hlp.hxx> #include <cppuhelper/supportsservice.hxx> #include <cppuhelper/typeprovider.hxx> @@ -471,8 +472,15 @@ public: private: virtual void doWork() SAL_OVERRIDE { - deflateZipEntry(mpEntry, mxInStream); - mxInStream.clear(); + try + { + deflateZipEntry(mpEntry, mxInStream); + mxInStream.clear(); + } + catch (const uno::Exception&) + { + mpEntry->setParallelDeflateException(::cppu::getCaughtException()); + } } }; |