diff options
author | Michael Stahl <mstahl@redhat.com> | 2012-10-23 14:50:24 +0200 |
---|---|---|
committer | Michael Stahl <mstahl@redhat.com> | 2012-10-23 15:12:43 +0200 |
commit | 48c9586e0797871e519d1cf68aa59bcc4ba02651 (patch) | |
tree | c06f2b58aa8b52e99e2839af85cc7f09e116d0ae /writerfilter | |
parent | 85b6a93cf41fb05e726027e34fcd805330e20414 (diff) |
RtfFilter::filter: not allowed to throw WrongFormatException:
throw a WrappedTargetRuntimeException instead :(
Change-Id: Iebf2b709beea738ba513ec5ce884874b76fbf243
Diffstat (limited to 'writerfilter')
-rw-r--r-- | writerfilter/qa/cppunittests/rtftok/testrtftok.cxx | 10 | ||||
-rw-r--r-- | writerfilter/source/filter/RtfFilter.cxx | 7 |
2 files changed, 13 insertions, 4 deletions
diff --git a/writerfilter/qa/cppunittests/rtftok/testrtftok.cxx b/writerfilter/qa/cppunittests/rtftok/testrtftok.cxx index 7cdec4979f9d..e5e656c8d549 100644 --- a/writerfilter/qa/cppunittests/rtftok/testrtftok.cxx +++ b/writerfilter/qa/cppunittests/rtftok/testrtftok.cxx @@ -30,6 +30,7 @@ #include <test/bootstrapfixture.hxx> #include <com/sun/star/document/XFilter.hpp> #include <com/sun/star/io/WrongFormatException.hpp> +#include <com/sun/star/lang/WrappedTargetRuntimeException.hpp> #include <osl/file.hxx> #include <osl/process.h> @@ -70,9 +71,14 @@ bool RtfTest::load(const OUString &, const OUString &rURL, const OUString &) { return m_xFilter->filter(aDescriptor); } - catch (const io::WrongFormatException&) + catch (const lang::WrappedTargetRuntimeException& rWrapped) { - return false; + io::WrongFormatException e; + if (rWrapped.TargetException >>= e) + { + return false; + } + throw; } } diff --git a/writerfilter/source/filter/RtfFilter.cxx b/writerfilter/source/filter/RtfFilter.cxx index 9b7a87900b95..f80d1b064069 100644 --- a/writerfilter/source/filter/RtfFilter.cxx +++ b/writerfilter/source/filter/RtfFilter.cxx @@ -28,6 +28,7 @@ #include <com/sun/star/frame/XFrame.hpp> #include <com/sun/star/task/XStatusIndicator.hpp> #include <com/sun/star/io/WrongFormatException.hpp> +#include <com/sun/star/lang/WrappedTargetRuntimeException.hpp> #ifdef DBG_COPYPASTE #include <unotools/localfilehelper.hxx> #include <tools/stream.hxx> @@ -117,9 +118,11 @@ sal_Bool RtfFilter::filter( const uno::Sequence< beans::PropertyValue >& aDescri sal_uInt32 nEndTime = osl_getGlobalTimer(); SAL_INFO("writerfilter.profile", OSL_THIS_FUNC << " finished in " << nEndTime - nStartTime << " ms"); } - catch (const io::WrongFormatException&) + catch (const io::WrongFormatException& e) { - throw; + // cannot throw WrongFormatException directly :( + throw lang::WrappedTargetRuntimeException("", + static_cast<OWeakObject*>(this), uno::makeAny(e)); } catch (const uno::Exception& e) { |