From 64f57612e3010594a8a72532cabfd0ff5fb39dff Mon Sep 17 00:00:00 2001 From: Stephan Bergmann Date: Thu, 28 Nov 2013 11:12:36 +0100 Subject: [PATCH] Catching std::bad_alloc in UNO implementations no longer necessary ...since 0bc89aac4c64bb833e387657f680e194c26aef97 "cppumaker: Allow UNO interface functions to throw std::exception." Change-Id: Ia28f02ea10d45267fd951e80da01ffdfdb420885 --- stoc/source/uriproc/ExternalUriReferenceTranslator.cxx | 9 +-------- stoc/source/uriproc/UriReferenceFactory.cxx | 7 +------ .../UriSchemeParser_vndDOTsunDOTstarDOTexpand.cxx | 9 +-------- .../UriSchemeParser_vndDOTsunDOTstarDOTscript.cxx | 8 +------- stoc/source/uriproc/VndSunStarPkgUrlReferenceFactory.cxx | 9 +-------- 5 files changed, 5 insertions(+), 37 deletions(-) diff --git a/stoc/source/uriproc/ExternalUriReferenceTranslator.cxx b/stoc/source/uriproc/ExternalUriReferenceTranslator.cxx index 32d1553dc8f2..f314d158ec9f 100644 --- a/stoc/source/uriproc/ExternalUriReferenceTranslator.cxx +++ b/stoc/source/uriproc/ExternalUriReferenceTranslator.cxx @@ -40,8 +40,6 @@ #include "rtl/ustring.hxx" #include "sal/types.h" -#include - namespace { class Translator: public cppu::WeakImplHelper2< @@ -201,12 +199,7 @@ css::uno::Reference< css::uno::XInterface > create( css::uno::Reference< css::uno::XComponentContext > const & context) SAL_THROW((css::uno::Exception)) { - try { - return static_cast< cppu::OWeakObject * >(new Translator(context)); - } catch (std::bad_alloc &) { - throw css::uno::RuntimeException( - OUString("std::bad_alloc"), 0); - } + return static_cast< cppu::OWeakObject * >(new Translator(context)); } OUString getImplementationName() { diff --git a/stoc/source/uriproc/UriReferenceFactory.cxx b/stoc/source/uriproc/UriReferenceFactory.cxx index 13e54533e48c..903e2c0ffcb5 100644 --- a/stoc/source/uriproc/UriReferenceFactory.cxx +++ b/stoc/source/uriproc/UriReferenceFactory.cxx @@ -23,7 +23,6 @@ #include #include #include -#include #include #include "com/sun/star/lang/WrappedTargetRuntimeException.hpp" @@ -641,11 +640,7 @@ css::uno::Reference< css::uno::XInterface > create( css::uno::Reference< css::uno::XComponentContext > const & context) SAL_THROW((css::uno::Exception)) { - try { - return static_cast< cppu::OWeakObject * >(new Factory(context)); - } catch (std::bad_alloc &) { - throw css::uno::RuntimeException("std::bad_alloc", 0); - } + return static_cast< cppu::OWeakObject * >(new Factory(context)); } OUString getImplementationName() { diff --git a/stoc/source/uriproc/UriSchemeParser_vndDOTsunDOTstarDOTexpand.cxx b/stoc/source/uriproc/UriSchemeParser_vndDOTsunDOTstarDOTexpand.cxx index 1b3034e25576..ad4008dd9eb7 100644 --- a/stoc/source/uriproc/UriSchemeParser_vndDOTsunDOTstarDOTexpand.cxx +++ b/stoc/source/uriproc/UriSchemeParser_vndDOTsunDOTstarDOTexpand.cxx @@ -22,7 +22,6 @@ #include "stocservices.hxx" #include -#include #include "com/sun/star/lang/IllegalArgumentException.hpp" #include "com/sun/star/lang/XServiceInfo.hpp" @@ -222,13 +221,7 @@ css::uno::Reference< css::uno::XInterface > create( SAL_THROW((css::uno::Exception)) { //TODO: single instance - try { - return static_cast< ::cppu::OWeakObject * >(new Parser); - } catch (::std::bad_alloc &) { - throw css::uno::RuntimeException( - OUString("std::bad_alloc"), - css::uno::Reference< css::uno::XInterface >()); - } + return static_cast< ::cppu::OWeakObject * >(new Parser); } OUString getImplementationName() { diff --git a/stoc/source/uriproc/UriSchemeParser_vndDOTsunDOTstarDOTscript.cxx b/stoc/source/uriproc/UriSchemeParser_vndDOTsunDOTstarDOTscript.cxx index 2326574a20b6..da17cbc4b82e 100644 --- a/stoc/source/uriproc/UriSchemeParser_vndDOTsunDOTstarDOTscript.cxx +++ b/stoc/source/uriproc/UriSchemeParser_vndDOTsunDOTstarDOTscript.cxx @@ -42,7 +42,6 @@ #include "sal/types.h" #include -#include namespace { @@ -446,12 +445,7 @@ css::uno::Reference< css::uno::XInterface > create( SAL_THROW((css::uno::Exception)) { //TODO: single instance - try { - return static_cast< cppu::OWeakObject * >(new Parser); - } catch (std::bad_alloc &) { - throw css::uno::RuntimeException( - OUString("std::bad_alloc"), 0); - } + return static_cast< cppu::OWeakObject * >(new Parser); } OUString getImplementationName() { diff --git a/stoc/source/uriproc/VndSunStarPkgUrlReferenceFactory.cxx b/stoc/source/uriproc/VndSunStarPkgUrlReferenceFactory.cxx index f8234f2397c8..3b7883f54f21 100644 --- a/stoc/source/uriproc/VndSunStarPkgUrlReferenceFactory.cxx +++ b/stoc/source/uriproc/VndSunStarPkgUrlReferenceFactory.cxx @@ -42,8 +42,6 @@ #include "rtl/ustring.hxx" #include "sal/types.h" -#include - namespace { class Factory: public cppu::WeakImplHelper2< @@ -130,12 +128,7 @@ css::uno::Reference< css::uno::XInterface > create( css::uno::Reference< css::uno::XComponentContext > const & context) SAL_THROW((css::uno::Exception)) { - try { - return static_cast< cppu::OWeakObject * >(new Factory(context)); - } catch (std::bad_alloc &) { - throw css::uno::RuntimeException( - OUString("std::bad_alloc"), 0); - } + return static_cast< cppu::OWeakObject * >(new Factory(context)); } OUString getImplementationName() {