summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2011-09-21 23:24:18 +0200
committerStephan Bergmann <sbergman@redhat.com>2011-09-21 23:35:24 +0200
commit0607102c470a67dfd7c0579a32d1c862427e2013 (patch)
tree9f549e22cf84935a42d4c5c5b1aa7c953f51e42f
parent8ab7539540924bf30a8ed88c9e91915e16dfd91b (diff)
Improved some error reporting.
-rw-r--r--cppuhelper/source/shlib.cxx2
-rw-r--r--desktop/inc/app.hxx1
-rw-r--r--desktop/source/app/app.cxx20
-rw-r--r--desktop/source/app/appinit.cxx15
4 files changed, 18 insertions, 20 deletions
diff --git a/cppuhelper/source/shlib.cxx b/cppuhelper/source/shlib.cxx
index 8e8fc33cf447..9414e34e3b04 100644
--- a/cppuhelper/source/shlib.cxx
+++ b/cppuhelper/source/shlib.cxx
@@ -263,7 +263,7 @@ static OUString makeComponentPath(
OUString out( buf.makeStringAndClear() );
#if OSL_DEBUG_LEVEL > 1
OString str( OUStringToOString( out, RTL_TEXTENCODING_ASCII_US ) );
- OSL_TRACE( "component path=%s", str.getStr() );
+ OSL_TRACE(OSL_LOG_PREFIX "component path=%s", str.getStr());
#endif
return out;
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 )