writerfilter/source/dmapper/SdtHelper.cxx | 20 ++++++++++++++++++-- writerfilter/source/filter/ImportFilter.cxx | 17 ++++++++++++++--- 2 files changed, 32 insertions(+), 5 deletions(-)
New commits: commit b871fad7a5b482c6ad1c0054adf0e068701395bd Author: Stephan Bergmann <sberg...@redhat.com> Date: Wed Feb 11 11:50:38 2015 +0100 Guard against createInstance throwing non-Runtime-Exception ...leading to exception specification violations down the road Change-Id: If017ffd18953d1200fde476ba7e400298dcd5b29 diff --git a/writerfilter/source/dmapper/SdtHelper.cxx b/writerfilter/source/dmapper/SdtHelper.cxx index f5a3bd1..bc91634 100644 --- a/writerfilter/source/dmapper/SdtHelper.cxx +++ b/writerfilter/source/dmapper/SdtHelper.cxx @@ -9,7 +9,9 @@ #include <SdtHelper.hxx> #include <com/sun/star/drawing/XControlShape.hpp> +#include <com/sun/star/lang/WrappedTargetRuntimeException.hpp> #include <com/sun/star/text/VertOrientation.hpp> +#include <cppuhelper/exc_hlp.hxx> #include <editeng/unoprnms.hxx> #include <vcl/svapp.hxx> #include <unotools/datetime.hxx> @@ -90,8 +92,22 @@ void SdtHelper::createDropDownControl() void SdtHelper::createDateControl(OUString& rContentText, beans::PropertyValue aCharFormat) { - uno::Reference<awt::XControlModel> xControlModel(m_rDM_Impl.GetTextFactory()->createInstance("com.sun.star.form.component.DateField"), uno::UNO_QUERY); - uno::Reference<beans::XPropertySet> xPropertySet(xControlModel, uno::UNO_QUERY); + uno::Reference<awt::XControlModel> xControlModel; + try { + xControlModel.set( + m_rDM_Impl.GetTextFactory()->createInstance( + "com.sun.star.form.component.DateField"), + uno::UNO_QUERY_THROW); + } catch (css::uno::RuntimeException &) { + throw; + } catch (css::uno::Exception & e) { + css::uno::Any a(cppu::getCaughtException()); + throw css::lang::WrappedTargetRuntimeException( + "wrapped " + a.getValueTypeName() + ": " + e.Message, + css::uno::Reference<css::uno::XInterface>(), a); + } + uno::Reference<beans::XPropertySet> xPropertySet( + xControlModel, uno::UNO_QUERY_THROW); xPropertySet->setPropertyValue("Dropdown", uno::makeAny(sal_True)); diff --git a/writerfilter/source/filter/ImportFilter.cxx b/writerfilter/source/filter/ImportFilter.cxx index 4c4b1af..35f6402 100644 --- a/writerfilter/source/filter/ImportFilter.cxx +++ b/writerfilter/source/filter/ImportFilter.cxx @@ -27,6 +27,7 @@ #include <com/sun/star/io/WrongFormatException.hpp> #include <com/sun/star/xml/sax/SAXParseException.hpp> #include <unotools/mediadescriptor.hxx> +#include <cppuhelper/exc_hlp.hxx> #include <cppuhelper/supportsservice.hxx> #include <oox/core/filterdetect.hxx> #include <dmapper/DomainMapperFactory.hxx> @@ -89,9 +90,19 @@ sal_Bool WriterFilter::filter( const uno::Sequence< beans::PropertyValue >& aDes if( m_xSrcDoc.is() ) { uno::Reference< lang::XMultiServiceFactory > xMSF(m_xContext->getServiceManager(), uno::UNO_QUERY_THROW); - uno::Reference< uno::XInterface > xIfc( xMSF->createInstance("com.sun.star.comp.Writer.DocxExport"), uno::UNO_QUERY_THROW); - if (!xIfc.is()) - return sal_False; + uno::Reference< uno::XInterface > xIfc; + try { + xIfc.set( + xMSF->createInstance("com.sun.star.comp.Writer.DocxExport"), + uno::UNO_QUERY_THROW); + } catch (css::uno::RuntimeException &) { + throw; + } catch (css::uno::Exception & e) { + css::uno::Any a(cppu::getCaughtException()); + throw css::lang::WrappedTargetRuntimeException( + "wrapped " + a.getValueTypeName() + ": " + e.Message, + css::uno::Reference<css::uno::XInterface>(), a); + } uno::Reference< document::XExporter > xExprtr(xIfc, uno::UNO_QUERY_THROW); uno::Reference< document::XFilter > xFltr(xIfc, uno::UNO_QUERY_THROW); if (!xExprtr.is() || !xFltr.is()) _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits