summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--package/source/zipapi/XBufferedThreadedStream.cxx20
-rw-r--r--package/source/zipapi/XBufferedThreadedStream.hxx4
2 files changed, 7 insertions, 17 deletions
diff --git a/package/source/zipapi/XBufferedThreadedStream.cxx b/package/source/zipapi/XBufferedThreadedStream.cxx
index 82bb992f0128..2c36b73ea409 100644
--- a/package/source/zipapi/XBufferedThreadedStream.cxx
+++ b/package/source/zipapi/XBufferedThreadedStream.cxx
@@ -9,6 +9,7 @@
#include "XBufferedThreadedStream.hxx"
#include <com/sun/star/packages/zip/ZipIOException.hpp>
+#include <cppuhelper/exc_hlp.hxx>
using namespace css::uno;
using com::sun::star::packages::zip::ZipIOException;
@@ -27,20 +28,10 @@ private:
{
mxStream.produce();
}
- catch( const RuntimeException &e )
- {
- SAL_WARN("package", "RuntimeException from unbuffered Stream " << e );
- mxStream.saveException( new RuntimeException( e ) );
- }
- catch( const ZipIOException &e )
- {
- SAL_WARN("package", "ZipIOException from unbuffered Stream " << e );
- mxStream.saveException( new ZipIOException( e ) );
- }
- catch( const Exception &e )
+ catch (const css::uno::Exception &e)
{
SAL_WARN("package", "Unexpected " << e );
- mxStream.saveException( new Exception( e ) );
+ mxStream.saveException(cppu::getCaughtException());
}
mxStream.setTerminateThread();
@@ -58,7 +49,6 @@ XBufferedThreadedStream::XBufferedThreadedStream(
, mnOffset( 0 )
, mxUnzippingThread( new UnzippingThread(*this) )
, mbTerminateThread( false )
-, maSavedException( nullptr )
{
mxUnzippingThread->launch();
}
@@ -116,8 +106,8 @@ const Buffer& XBufferedThreadedStream::getNextBlock()
if( maPendingBuffers.empty() )
{
maInUseBuffer = Buffer();
- if( maSavedException )
- throw *maSavedException;
+ if (maSavedException.hasValue())
+ cppu::throwException(maSavedException);
}
else
{
diff --git a/package/source/zipapi/XBufferedThreadedStream.hxx b/package/source/zipapi/XBufferedThreadedStream.hxx
index 8bf3c5eb1283..b99864fbb268 100644
--- a/package/source/zipapi/XBufferedThreadedStream.hxx
+++ b/package/source/zipapi/XBufferedThreadedStream.hxx
@@ -37,7 +37,7 @@ private:
std::condition_variable maBufferProduceResume;
bool mbTerminateThread; /// indicates the failure of one of the threads
- css::uno::Exception *maSavedException; /// exception caught during unzipping is saved to be thrown during reading
+ css::uno::Any maSavedException; /// exception caught during unzipping is saved to be thrown during reading
static const size_t nBufferLowWater = 2;
static const size_t nBufferHighWater = 4;
@@ -66,7 +66,7 @@ public:
void produce();
void setTerminateThread();
- void saveException( css::uno::Exception *e ) { maSavedException = e; }
+ void saveException(const css::uno::Any &rAny) { maSavedException = rAny; }
// XInputStream
virtual sal_Int32 SAL_CALL readBytes( css::uno::Sequence< sal_Int8 >& aData, sal_Int32 nBytesToRead ) override;