Kaydet (Commit) f31a9365 authored tarafından Caolán McNamara's avatar Caolán McNamara Kaydeden (comit) Andras Timar

uncaught exceptions in parallel deflate threads on re-export of HTB23106 odgs

Change-Id: Ib6aef478b8dcf1c7a7262ab60eef4d44da0de632
(cherry picked from commit 05661623)
üst 58fa7827
...@@ -42,6 +42,7 @@ class ZipOutputEntry ...@@ -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::XCipherContext > m_xCipherContext;
::com::sun::star::uno::Reference< ::com::sun::star::xml::crypto::XDigestContext > m_xDigestContext; ::com::sun::star::uno::Reference< ::com::sun::star::xml::crypto::XDigestContext > m_xDigestContext;
::css::uno::Any m_aParallelDeflateException;
CRC32 m_aCRC; CRC32 m_aCRC;
ZipEntry *m_pCurrentEntry; ZipEntry *m_pCurrentEntry;
...@@ -62,6 +63,9 @@ public: ...@@ -62,6 +63,9 @@ public:
ZipPackageStream* getZipPackageStream() { return m_pCurrentStream; } ZipPackageStream* getZipPackageStream() { return m_pCurrentStream; }
bool isEncrypt() { return m_bEncryptCurrentEntry; } 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 closeEntry();
void write(const css::uno::Sequence< sal_Int8 >& rBuffer); void write(const css::uno::Sequence< sal_Int8 >& rBuffer);
......
...@@ -23,6 +23,7 @@ ...@@ -23,6 +23,7 @@
#include <com/sun/star/io/XInputStream.hpp> #include <com/sun/star/io/XInputStream.hpp>
#include <com/sun/star/io/XOutputStream.hpp> #include <com/sun/star/io/XOutputStream.hpp>
#include <comphelper/storagehelper.hxx> #include <comphelper/storagehelper.hxx>
#include <cppuhelper/exc_hlp.hxx>
#include <osl/diagnose.h> #include <osl/diagnose.h>
#include <osl/time.h> #include <osl/time.h>
...@@ -101,6 +102,11 @@ void ZipOutputStream::finish() ...@@ -101,6 +102,11 @@ void ZipOutputStream::finish()
m_rSharedThreadPool.waitUntilEmpty(); m_rSharedThreadPool.waitUntilEmpty();
for (size_t i = 0; i < m_aEntries.size(); i++) 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()); writeLOC(m_aEntries[i]->getZipEntry(), m_aEntries[i]->isEncrypt());
sal_Int32 nRead; sal_Int32 nRead;
......
...@@ -46,6 +46,7 @@ ...@@ -46,6 +46,7 @@
#include <comphelper/processfactory.hxx> #include <comphelper/processfactory.hxx>
#include <comphelper/seekableinput.hxx> #include <comphelper/seekableinput.hxx>
#include <comphelper/storagehelper.hxx> #include <comphelper/storagehelper.hxx>
#include <cppuhelper/exc_hlp.hxx>
#include <cppuhelper/supportsservice.hxx> #include <cppuhelper/supportsservice.hxx>
#include <cppuhelper/typeprovider.hxx> #include <cppuhelper/typeprovider.hxx>
...@@ -471,8 +472,15 @@ public: ...@@ -471,8 +472,15 @@ public:
private: private:
virtual void doWork() SAL_OVERRIDE virtual void doWork() SAL_OVERRIDE
{ {
deflateZipEntry(mpEntry, mxInStream); try
mxInStream.clear(); {
deflateZipEntry(mpEntry, mxInStream);
mxInStream.clear();
}
catch (const uno::Exception&)
{
mpEntry->setParallelDeflateException(::cppu::getCaughtException());
}
} }
}; };
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment