diff options
author | Caolán McNamara <caolanm@redhat.com> | 2014-06-24 12:34:27 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2014-06-24 14:28:27 +0100 |
commit | 46b6721c030edc2c73600225c03e04125a0a911a (patch) | |
tree | 0bd88a2fe573ac2ad05dc8999f5267f0cd03caab /filter | |
parent | 4a67abb3b2b4c308cb4ca5252e70c239689feaed (diff) |
coverity#706534 Uncaught exception
Change-Id: Iac2e63ee2588148f8c29c46684288f1fc69d4ff1
Diffstat (limited to 'filter')
-rw-r--r-- | filter/source/config/cache/typedetection.cxx | 81 |
1 files changed, 40 insertions, 41 deletions
diff --git a/filter/source/config/cache/typedetection.cxx b/filter/source/config/cache/typedetection.cxx index f937f5b7a25b..315bb3db07e9 100644 --- a/filter/source/config/cache/typedetection.cxx +++ b/filter/source/config/cache/typedetection.cxx @@ -372,49 +372,47 @@ OUString SAL_CALL TypeDetection::queryTypeByDescriptor(css::uno::Sequence< css:: { // make the descriptor more useable :-) utl::MediaDescriptor stlDescriptor(lDescriptor); + OUString sType, sURL; - // SAFE -> ---------------------------------- - ::osl::ResettableMutexGuard aLock(m_aLock); - + try + { + // SAFE -> ---------------------------------- + ::osl::ResettableMutexGuard aLock(m_aLock); - // parse given URL to split it into e.g. main and jump marks ... - OUString sURL = stlDescriptor.getUnpackedValueOrDefault(utl::MediaDescriptor::PROP_URL(), OUString()); + // parse given URL to split it into e.g. main and jump marks ... + sURL = stlDescriptor.getUnpackedValueOrDefault(utl::MediaDescriptor::PROP_URL(), OUString()); #if OSL_DEBUG_LEVEL > 0 - if (stlDescriptor.find( "FileName" ) != stlDescriptor.end()) - OSL_FAIL("Detect using of deprecated and already unsupported MediaDescriptor property \"FileName\"!"); + if (stlDescriptor.find( "FileName" ) != stlDescriptor.end()) + OSL_FAIL("Detect using of deprecated and already unsupported MediaDescriptor property \"FileName\"!"); #endif - css::util::URL aURL; - aURL.Complete = sURL; - css::uno::Reference< css::util::XURLTransformer > xParser(css::util::URLTransformer::create(m_xContext)); - xParser->parseStrict(aURL); + css::util::URL aURL; + aURL.Complete = sURL; + css::uno::Reference< css::util::XURLTransformer > xParser(css::util::URLTransformer::create(m_xContext)); + xParser->parseStrict(aURL); - OUString aSelectedFilter = stlDescriptor.getUnpackedValueOrDefault( - utl::MediaDescriptor::PROP_FILTERNAME(), OUString()); - if (!aSelectedFilter.isEmpty()) - { - // Caller specified the filter type. Honor it. Just get the default - // type for that filter, and bail out. - if (impl_validateAndSetFilterOnDescriptor(stlDescriptor, aSelectedFilter)) - return stlDescriptor[utl::MediaDescriptor::PROP_TYPENAME()].get<OUString>(); - } + OUString aSelectedFilter = stlDescriptor.getUnpackedValueOrDefault( + utl::MediaDescriptor::PROP_FILTERNAME(), OUString()); + if (!aSelectedFilter.isEmpty()) + { + // Caller specified the filter type. Honor it. Just get the default + // type for that filter, and bail out. + if (impl_validateAndSetFilterOnDescriptor(stlDescriptor, aSelectedFilter)) + return stlDescriptor[utl::MediaDescriptor::PROP_TYPENAME()].get<OUString>(); + } - FlatDetection lFlatTypes; - impl_getAllFormatTypes(aURL, stlDescriptor, lFlatTypes); + FlatDetection lFlatTypes; + impl_getAllFormatTypes(aURL, stlDescriptor, lFlatTypes); - aLock.clear(); - // <- SAFE ---------------------------------- + aLock.clear(); + // <- SAFE ---------------------------------- - // Properly prioritize all candidate types. - lFlatTypes.sort(SortByPriority()); - lFlatTypes.unique(EqualByType()); + // Properly prioritize all candidate types. + lFlatTypes.sort(SortByPriority()); + lFlatTypes.unique(EqualByType()); - OUString sType ; - OUString sLastChance; - - try - { + OUString sLastChance; // verify every flat detected (or preselected!) type // by calling its registered deep detection service. @@ -445,16 +443,17 @@ OUString SAL_CALL TypeDetection::queryTypeByDescriptor(css::uno::Sequence< css:: } } catch(const css::uno::RuntimeException&) - { throw; } + { + throw; + } catch(const css::uno::Exception& e) - { - SAL_WARN( - "filter.config", - "caught Exception \"" << e.Message - << "\" while querying type of <" << sURL << ">"); - sType = OUString(); - } - + { + SAL_WARN( + "filter.config", + "caught Exception \"" << e.Message + << "\" while querying type of <" << sURL << ">"); + sType = OUString(); + } // adapt media descriptor, so it contains the right values // for type/filter name/document service/ etcpp. |