diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2011-09-21 23:24:18 +0200 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2011-09-21 23:35:24 +0200 |
commit | 0607102c470a67dfd7c0579a32d1c862427e2013 (patch) | |
tree | 9f549e22cf84935a42d4c5c5b1aa7c953f51e42f /desktop | |
parent | 8ab7539540924bf30a8ed88c9e91915e16dfd91b (diff) |
Improved some error reporting.
Diffstat (limited to 'desktop')
-rw-r--r-- | desktop/inc/app.hxx | 1 | ||||
-rw-r--r-- | desktop/source/app/app.cxx | 20 | ||||
-rw-r--r-- | desktop/source/app/appinit.cxx | 15 |
3 files changed, 17 insertions, 19 deletions
diff --git a/desktop/inc/app.hxx b/desktop/inc/app.hxx index 10f6de9dc7c3..87a774c5661b 100644 --- a/desktop/inc/app.hxx +++ b/desktop/inc/app.hxx @@ -144,6 +144,7 @@ class Desktop : public Application private: // Bootstrap methods static ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > CreateApplicationServiceManager(); + // returns a non-null reference or throws an exception void RegisterServices( ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xSMgr ); void DeregisterServices(); diff --git a/desktop/source/app/app.cxx b/desktop/source/app/app.cxx index bf486472d25a..1cb3f30819af 100644 --- a/desktop/source/app/app.cxx +++ b/desktop/source/app/app.cxx @@ -767,13 +767,19 @@ void Desktop::InitFinished() // on Unix command line args needs to be checked before Desktop::Init() void Desktop::ensureProcessServiceFactory() { - if( ::comphelper::getProcessServiceFactory().is()) - return; - - Reference < XMultiServiceFactory > rSMgr = CreateApplicationServiceManager(); - if( rSMgr.is() ) - { - ::comphelper::setProcessServiceFactory( rSMgr ); + if (!comphelper::getProcessServiceFactory().is()) { + try { + comphelper::setProcessServiceFactory( + CreateApplicationServiceManager()); + } catch (css::uno::Exception & e) { + OSL_TRACE( + OSL_LOG_PREFIX "caught UNO exception with message \"%s\"", + rtl::OUStringToOString( + e.Message, RTL_TEXTENCODING_UTF8).getStr()); + throw; + // let exceptions escape and tear down the process, it is + // completely broken anyway + } } } diff --git a/desktop/source/app/appinit.cxx b/desktop/source/app/appinit.cxx index cabc8ddd6c1f..0f6709db68e3 100644 --- a/desktop/source/app/appinit.cxx +++ b/desktop/source/app/appinit.cxx @@ -191,18 +191,9 @@ Reference< XMultiServiceFactory > Desktop::CreateApplicationServiceManager() { RTL_LOGFILE_CONTEXT( aLog, "desktop (cd100003) ::createApplicationServiceManager" ); - try - { - Reference<XComponentContext> xComponentContext = ::cppu::defaultBootstrap_InitialComponentContext(); - Reference<XMultiServiceFactory> xMS(xComponentContext->getServiceManager(), UNO_QUERY); - - return xMS; - } - catch (const ::com::sun::star::uno::Exception&) - { - } - - return Reference< XMultiServiceFactory >(); + return Reference<XMultiServiceFactory>( + cppu::defaultBootstrap_InitialComponentContext()->getServiceManager(), + UNO_QUERY_THROW); } void Desktop::DestroyApplicationServiceManager( Reference< XMultiServiceFactory >& xSMgr ) |