[Libreoffice-commits] core.git: package/source
Caolán McNamara
caolanm at redhat.com
Fri Nov 24 19:57:16 UTC 2017
package/source/zipapi/XBufferedThreadedStream.cxx | 20 +++++---------------
package/source/zipapi/XBufferedThreadedStream.hxx | 4 ++--
2 files changed, 7 insertions(+), 17 deletions(-)
New commits:
commit 2a7fa39bc1fb3a81fdcc632853aef224f4793f8a
Author: Caolán McNamara <caolanm at redhat.com>
Date: Fri Nov 24 14:05:58 2017 +0000
fix attempt to save and rethrow exception
Change-Id: Idff6ffef536d87d85f1092b3316d65da83527711
Reviewed-on: https://gerrit.libreoffice.org/45229
Reviewed-by: Caolán McNamara <caolanm at redhat.com>
Tested-by: Caolán McNamara <caolanm at redhat.com>
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;
More information about the Libreoffice-commits
mailing list