summaryrefslogtreecommitdiff
path: root/framework
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2010-10-19 11:28:01 +0100
committerCaolán McNamara <caolanm@redhat.com>2010-10-19 11:56:57 +0100
commit5da353cab7576e38025eb5ec6fad3d25ba0d6175 (patch)
tree3bced672907d602e2281203945f3d3ade274abf0 /framework
parentc7738b754d25994449a390fc8ef5fedf546f6b96 (diff)
survive missing configuration entries gracefully
Diffstat (limited to 'framework')
-rw-r--r--framework/source/services/pathsettings.cxx22
-rw-r--r--framework/source/services/substitutepathvars.cxx23
2 files changed, 34 insertions, 11 deletions
diff --git a/framework/source/services/pathsettings.cxx b/framework/source/services/pathsettings.cxx
index 76ecd861ff..46f7d16327 100644
--- a/framework/source/services/pathsettings.cxx
+++ b/framework/source/services/pathsettings.cxx
@@ -223,17 +223,21 @@ void PathSettings::impl_readAll()
RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "framework", "Ocke.Janssen@sun.com", "PathSettings::impl_readAll" );
RTL_LOGFILE_CONTEXT(aLog, "framework (as96863) ::PathSettings::load config (all)");
- // TODO think about me
- css::uno::Reference< css::container::XNameAccess > xCfg = fa_getCfgNew();
- css::uno::Sequence< ::rtl::OUString > lPaths = xCfg->getElementNames();
-
- sal_Int32 c = lPaths.getLength();
- sal_Int32 i = 0;
+ try
+ {
+ // TODO think about me
+ css::uno::Reference< css::container::XNameAccess > xCfg = fa_getCfgNew();
+ css::uno::Sequence< ::rtl::OUString > lPaths = xCfg->getElementNames();
- for (i=0; i<c; ++i)
+ sal_Int32 c = lPaths.getLength();
+ for (sal_Int32 i = 0; i < c; ++i)
+ {
+ const ::rtl::OUString& sPath = lPaths[i];
+ impl_updatePath(sPath, sal_False);
+ }
+ }
+ catch(const css::uno::RuntimeException& )
{
- const ::rtl::OUString& sPath = lPaths[i];
- impl_updatePath(sPath, sal_False);
}
impl_rebuildPropertyDescriptor();
diff --git a/framework/source/services/substitutepathvars.cxx b/framework/source/services/substitutepathvars.cxx
index 6013f7d9e2..bb67b75849 100644
--- a/framework/source/services/substitutepathvars.cxx
+++ b/framework/source/services/substitutepathvars.cxx
@@ -718,12 +718,24 @@ rtl::OUString SubstitutePathVariables::GetWorkPath() const
{
RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "framework", "Ocke.Janssen@sun.com", "SubstitutePathVariables::GetWorkPath" );
rtl::OUString aWorkPath;
- ::comphelper::ConfigurationHelper::readDirectKey(
+
+ try
+ {
+ ::comphelper::ConfigurationHelper::readDirectKey(
m_xServiceManager,
::rtl::OUString::createFromAscii("org.openoffice.Office.Paths"),
::rtl::OUString::createFromAscii("Paths/Work"),
::rtl::OUString::createFromAscii("WritePath"),
::comphelper::ConfigurationHelper::E_READONLY) >>= aWorkPath;
+ }
+ catch(RuntimeException &)
+ {
+ }
+
+ // fallback in case config layer does not return an useable work dir value.
+ if (aWorkPath.getLength() < 1)
+ aWorkPath = GetWorkVariableValue();
+
return aWorkPath;
}
@@ -731,12 +743,19 @@ rtl::OUString SubstitutePathVariables::GetWorkVariableValue() const
{
RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "framework", "Ocke.Janssen@sun.com", "SubstitutePathVariables::GetWorkVariableValue" );
::rtl::OUString aWorkPath;
- ::comphelper::ConfigurationHelper::readDirectKey(
+
+ try
+ {
+ ::comphelper::ConfigurationHelper::readDirectKey(
m_xServiceManager,
::rtl::OUString::createFromAscii("org.openoffice.Office.Paths"),
::rtl::OUString::createFromAscii("Variables"),
::rtl::OUString::createFromAscii("Work"),
::comphelper::ConfigurationHelper::E_READONLY) >>= aWorkPath;
+ }
+ catch(RuntimeException &)
+ {
+ }
// fallback to $HOME in case platform dependend config layer does not return
// an usuable work dir value.