diff options
author | Caolán McNamara <caolanm@redhat.com> | 2014-03-09 21:10:17 +0000 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2014-03-09 21:20:13 +0000 |
commit | ec4498a39323c99295b9864c72ecab0c21daf159 (patch) | |
tree | db972fe810d422ecd6fd55ce6ed7a266939b7129 /ucbhelper | |
parent | 5bd3a42baf1fe3bed945d5f630c800ce7300a763 (diff) |
coverity#1078944 Uncaught exception
a false positive but easier to fix it by helping coverity out
for any other cases it triggers
Change-Id: I7c61298a95fa427d279599110b7aab263d039c5d
Diffstat (limited to 'ucbhelper')
-rw-r--r-- | ucbhelper/source/client/content.cxx | 26 |
1 files changed, 15 insertions, 11 deletions
diff --git a/ucbhelper/source/client/content.cxx b/ucbhelper/source/client/content.cxx index f4b9beba6891..0dcd2ab21ebb 100644 --- a/ucbhelper/source/client/content.cxx +++ b/ucbhelper/source/client/content.cxx @@ -226,19 +226,15 @@ static void ensureContentProviderForURL( const Reference< XUniversalContentBroke } -static Reference< XContentIdentifier > getContentIdentifier( +static Reference< XContentIdentifier > getContentIdentifierThrow( const Reference< XUniversalContentBroker > & rBroker, - const OUString & rURL, - bool bThrow ) - throw ( ContentCreationException, RuntimeException ) + const OUString & rURL) + throw (ContentCreationException, RuntimeException) { Reference< XContentIdentifier > xId = rBroker->createContentIdentifier( rURL ); - if ( xId.is() ) - return xId; - - if ( bThrow ) + if (!xId.is()) { ensureContentProviderForURL( rBroker, rURL ); @@ -248,7 +244,15 @@ static Reference< XContentIdentifier > getContentIdentifier( ContentCreationError_IDENTIFIER_CREATION_FAILED ); } - return Reference< XContentIdentifier >(); + return xId; +} + +static Reference< XContentIdentifier > getContentIdentifierNoThrow( + const Reference< XUniversalContentBroker > & rBroker, + const OUString & rURL) + throw (RuntimeException) +{ + return rBroker->createContentIdentifier(rURL); } @@ -309,7 +313,7 @@ Content::Content( const OUString& rURL, UniversalContentBroker::create( rCtx ) ); Reference< XContentIdentifier > xId - = getContentIdentifier( pBroker, rURL, true ); + = getContentIdentifierThrow(pBroker, rURL); Reference< XContent > xContent = getContent( pBroker, xId, true ); @@ -342,7 +346,7 @@ bool Content::create( const OUString& rURL, UniversalContentBroker::create( rCtx ) ); Reference< XContentIdentifier > xId - = getContentIdentifier( pBroker, rURL, false ); + = getContentIdentifierNoThrow(pBroker, rURL); if ( !xId.is() ) return false; |