diff options
author | Caolán McNamara <caolanm@redhat.com> | 2014-03-06 11:36:15 +0000 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2014-03-06 16:35:43 +0000 |
commit | e1d89089cf82202e3762b7f1f87b6ec456400781 (patch) | |
tree | 0ffcd7c8c2796deed7b7ab908396f4615ddd6d1c /unotools | |
parent | 7d7f91aead9af7e0d3d262663dea4b3c96c3072b (diff) |
coverity#1190364 Uncaught exception
Change-Id: I647c7f7bf29c81c3ecafac4a8d18a61663e7738e
Diffstat (limited to 'unotools')
-rw-r--r-- | unotools/source/config/fontcfg.cxx | 56 |
1 files changed, 25 insertions, 31 deletions
diff --git a/unotools/source/config/fontcfg.cxx b/unotools/source/config/fontcfg.cxx index f3a78382f73b..682721e67bb9 100644 --- a/unotools/source/config/fontcfg.cxx +++ b/unotools/source/config/fontcfg.cxx @@ -370,43 +370,37 @@ FontSubstConfiguration::FontSubstConfiguration() : // get service provider Reference< XComponentContext > xContext( comphelper::getProcessComponentContext() ); // create configuration hierachical access name - try + m_xConfigProvider = theDefaultProvider::get( xContext ); + Sequence< Any > aArgs(1); + PropertyValue aVal; + aVal.Name = "nodepath"; + aVal.Value <<= OUString( "/org.openoffice.VCL/FontSubstitutions" ); + aArgs.getArray()[0] <<= aVal; + m_xConfigAccess = + Reference< XNameAccess >( + m_xConfigProvider->createInstanceWithArguments( OUString( "com.sun.star.configuration.ConfigurationAccess" ), + aArgs ), + UNO_QUERY ); + if( m_xConfigAccess.is() ) { - m_xConfigProvider = theDefaultProvider::get( xContext ); - Sequence< Any > aArgs(1); - PropertyValue aVal; - aVal.Name = "nodepath"; - aVal.Value <<= OUString( "/org.openoffice.VCL/FontSubstitutions" ); - aArgs.getArray()[0] <<= aVal; - m_xConfigAccess = - Reference< XNameAccess >( - m_xConfigProvider->createInstanceWithArguments( OUString( "com.sun.star.configuration.ConfigurationAccess" ), - aArgs ), - UNO_QUERY ); - if( m_xConfigAccess.is() ) + Sequence< OUString > aLocales = m_xConfigAccess->getElementNames(); + // fill config hash with empty interfaces + int nLocales = aLocales.getLength(); + const OUString* pLocaleStrings = aLocales.getConstArray(); + for( int i = 0; i < nLocales; i++ ) { - Sequence< OUString > aLocales = m_xConfigAccess->getElementNames(); - // fill config hash with empty interfaces - int nLocales = aLocales.getLength(); - const OUString* pLocaleStrings = aLocales.getConstArray(); - for( int i = 0; i < nLocales; i++ ) - { - // Feed through LanguageTag for casing. - OUString aLoc( LanguageTag( pLocaleStrings[i], true).getBcp47( false)); - m_aSubst[ aLoc ] = LocaleSubst(); - m_aSubst[ aLoc ].aConfigLocaleString = pLocaleStrings[i]; - } + // Feed through LanguageTag for casing. + OUString aLoc( LanguageTag( pLocaleStrings[i], true).getBcp47( false)); + m_aSubst[ aLoc ] = LocaleSubst(); + m_aSubst[ aLoc ].aConfigLocaleString = pLocaleStrings[i]; } } - catch (const Exception&) - { - // configuration is awry - m_xConfigProvider.clear(); - m_xConfigAccess.clear(); - } } - catch (const WrappedTargetException&) + catch (const Exception&) { + // configuration is awry + m_xConfigProvider.clear(); + m_xConfigAccess.clear(); } #if OSL_DEBUG_LEVEL > 1 fprintf( stderr, "config provider: %s, config access: %s\n", |