Kaydet (Commit) 2a7fa39b authored tarafından Caolán McNamara's avatar Caolán McNamara

fix attempt to save and rethrow exception

Change-Id: Idff6ffef536d87d85f1092b3316d65da83527711
Reviewed-on: https://gerrit.libreoffice.org/45229Reviewed-by: 's avatarCaolán McNamara <caolanm@redhat.com>
Tested-by: 's avatarCaolán McNamara <caolanm@redhat.com>
üst bd43062c
......@@ -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
{
......
......@@ -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;
......
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