diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2013-10-20 22:22:05 +0200 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2013-10-20 22:22:05 +0200 |
commit | 79502678d091b90f9b76c37fbd97f8710a075655 (patch) | |
tree | fb34f23c7594adad2e34c272aab1a9fa4d7167c2 /stoc | |
parent | ef57fc043109b8498600a30b71b3f6b590993fce (diff) |
Clean-up std::bad_alloc handling
...post 0bc89aac4c64bb833e387657f680e194c26aef97 "cppumaker: Allow UNO interface functions to throw std::exception."
Change-Id: I5fede822d279c3c758103192a813447bb4906679
Diffstat (limited to 'stoc')
3 files changed, 16 insertions, 32 deletions
diff --git a/stoc/source/uriproc/UriReferenceFactory.cxx b/stoc/source/uriproc/UriReferenceFactory.cxx index 6d42c49011dc..856f5fbbd8f6 100644 --- a/stoc/source/uriproc/UriReferenceFactory.cxx +++ b/stoc/source/uriproc/UriReferenceFactory.cxx @@ -49,6 +49,7 @@ #include <algorithm> #include /*MSVC trouble: <cstdlib>*/ <stdlib.h> +#include <exception> #include <new> #include <vector> @@ -191,7 +192,6 @@ private: stoc::uriproc::UriReference m_base; }; -// throws std::bad_alloc css::uno::Reference< css::uri::XUriReference > parseGeneric( OUString const & scheme, OUString const & schemeSpecificPart) { @@ -291,7 +291,7 @@ public: virtual css::uno::Reference< css::uri::XUriReference > SAL_CALL parse(OUString const & uriReference) - throw (css::uno::RuntimeException); + throw (css::uno::RuntimeException, std::exception); virtual css::uno::Reference< css::uri::XUriReference > SAL_CALL makeAbsolute( @@ -343,7 +343,8 @@ css::uno::Sequence< OUString > Factory::getSupportedServiceNames() } css::uno::Reference< css::uri::XUriReference > Factory::parse( - OUString const & uriReference) throw (css::uno::RuntimeException) + OUString const & uriReference) + throw (css::uno::RuntimeException, std::exception) { sal_Int32 fragment = uriReference.indexOf('#'); if (fragment == -1) { @@ -403,18 +404,10 @@ css::uno::Reference< css::uri::XUriReference > Factory::parse( } } } - css::uno::Reference< css::uri::XUriReference > uriRef; - if (parser.is()) { - uriRef = parser->parse(scheme, schemeSpecificPart); - } else { - try { - uriRef = parseGeneric(scheme, schemeSpecificPart); - } catch (std::bad_alloc &) { - throw css::uno::RuntimeException( - OUString("std::bad_alloc"), - static_cast< cppu::OWeakObject * >(this)); - } - } + css::uno::Reference< css::uri::XUriReference > uriRef( + parser.is() + ? parser->parse(scheme, schemeSpecificPart) + : parseGeneric(scheme, schemeSpecificPart)); if (uriRef.is() && fragment != uriReference.getLength()) { uriRef->setFragment(uriReference.copy(fragment + 1)); } diff --git a/stoc/source/uriproc/UriSchemeParser_vndDOTsunDOTstarDOTexpand.cxx b/stoc/source/uriproc/UriSchemeParser_vndDOTsunDOTstarDOTexpand.cxx index d8545d692a0c..ee95a0c08344 100644 --- a/stoc/source/uriproc/UriSchemeParser_vndDOTsunDOTstarDOTexpand.cxx +++ b/stoc/source/uriproc/UriSchemeParser_vndDOTsunDOTstarDOTexpand.cxx @@ -21,6 +21,7 @@ #include "stocservices.hxx" +#include <exception> #include <new> #include "com/sun/star/lang/IllegalArgumentException.hpp" @@ -172,7 +173,7 @@ public: parse( OUString const & scheme, OUString const & schemeSpecificPart) - throw (css::uno::RuntimeException); + throw (css::uno::RuntimeException, std::exception); private: Parser(Parser &); // not defined @@ -204,18 +205,12 @@ css::uno::Sequence< OUString > Parser::getSupportedServiceNames() css::uno::Reference< css::uri::XUriReference > Parser::parse( OUString const & scheme, OUString const & schemeSpecificPart) - throw (css::uno::RuntimeException) + throw (css::uno::RuntimeException, std::exception) { if (!parseSchemeSpecificPart(schemeSpecificPart)) { return css::uno::Reference< css::uri::XUriReference >(); } - try { - return new UrlReference(scheme, schemeSpecificPart); - } catch (::std::bad_alloc &) { - throw css::uno::RuntimeException( - OUString("std::bad_alloc"), - css::uno::Reference< css::uno::XInterface >()); - } + return new UrlReference(scheme, schemeSpecificPart); } } diff --git a/stoc/source/uriproc/UriSchemeParser_vndDOTsunDOTstarDOTscript.cxx b/stoc/source/uriproc/UriSchemeParser_vndDOTsunDOTstarDOTscript.cxx index f82178fa57a1..3351390fb288 100644 --- a/stoc/source/uriproc/UriSchemeParser_vndDOTsunDOTstarDOTscript.cxx +++ b/stoc/source/uriproc/UriSchemeParser_vndDOTsunDOTstarDOTscript.cxx @@ -41,6 +41,7 @@ #include "rtl/ustring.hxx" #include "sal/types.h" +#include <exception> #include <new> namespace { @@ -394,7 +395,7 @@ public: virtual css::uno::Reference< css::uri::XUriReference > SAL_CALL parse( OUString const & scheme, OUString const & schemeSpecificPart) - throw (css::uno::RuntimeException); + throw (css::uno::RuntimeException, std::exception); private: Parser(Parser &); // not implemented @@ -427,17 +428,12 @@ css::uno::Sequence< OUString > Parser::getSupportedServiceNames() css::uno::Reference< css::uri::XUriReference > Parser::parse( OUString const & scheme, OUString const & schemeSpecificPart) - throw (css::uno::RuntimeException) + throw (css::uno::RuntimeException, std::exception) { if (!parseSchemeSpecificPart(schemeSpecificPart)) { return 0; } - try { - return new UrlReference(scheme, schemeSpecificPart); - } catch (std::bad_alloc &) { - throw css::uno::RuntimeException( - OUString("std::bad_alloc"), 0); - } + return new UrlReference(scheme, schemeSpecificPart); } } |