diff options
author | Caolán McNamara <caolanm@redhat.com> | 2014-04-03 20:58:07 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2014-04-04 09:35:19 +0100 |
commit | 9e8d4c439f96d52b676b933b18902a3ec80e2f38 (patch) | |
tree | b6065ce00af6db996f371d9a4aa38fe61b410c23 /ucbhelper | |
parent | 675194c83d620210f3c50448978c3ecebb62ccb9 (diff) |
coverity#707355 Uncaught exception, help coverity out here
hopefully loads of other ones too
Change-Id: I8445602adc76205448926efe23c9770cef0eb5dc
Diffstat (limited to 'ucbhelper')
-rw-r--r-- | ucbhelper/source/client/content.cxx | 35 |
1 files changed, 24 insertions, 11 deletions
diff --git a/ucbhelper/source/client/content.cxx b/ucbhelper/source/client/content.cxx index 809d6d3612a4..a0717861b2f5 100644 --- a/ucbhelper/source/client/content.cxx +++ b/ucbhelper/source/client/content.cxx @@ -255,11 +255,9 @@ static Reference< XContentIdentifier > getContentIdentifierNoThrow( return rBroker->createContentIdentifier(rURL); } - -static Reference< XContent > getContent( +static Reference< XContent > getContentThrow( const Reference< XUniversalContentBroker > & rBroker, - const Reference< XContentIdentifier > & xId, - bool bThrow ) + const Reference< XContentIdentifier > & xId) throw ( ContentCreationException, RuntimeException ) { Reference< XContent > xContent; @@ -274,10 +272,7 @@ static Reference< XContent > getContent( // handled below. } - if ( xContent.is() ) - return xContent; - - if ( bThrow ) + if ( !xContent.is() ) { ensureContentProviderForURL( rBroker, xId->getContentIdentifier() ); @@ -287,7 +282,25 @@ static Reference< XContent > getContent( ContentCreationError_CONTENT_CREATION_FAILED ); } - return Reference< XContent >(); + return xContent; +} + + +static Reference< XContent > getContentNoThrow( + const Reference< XUniversalContentBroker > & rBroker, + const Reference< XContentIdentifier > & xId) + throw ( RuntimeException ) +{ + Reference< XContent > xContent; + try + { + xContent = rBroker->queryContent( xId ); + } + catch ( IllegalIdentifierException const & e ) + { + } + + return xContent; } @@ -315,7 +328,7 @@ Content::Content( const OUString& rURL, Reference< XContentIdentifier > xId = getContentIdentifierThrow(pBroker, rURL); - Reference< XContent > xContent = getContent( pBroker, xId, true ); + Reference< XContent > xContent = getContentThrow(pBroker, xId); m_xImpl = new Content_Impl( rCtx, xContent, rEnv ); } @@ -350,7 +363,7 @@ bool Content::create( const OUString& rURL, if ( !xId.is() ) return false; - Reference< XContent > xContent = getContent( pBroker, xId, false ); + Reference< XContent > xContent = getContentNoThrow(pBroker, xId); if ( !xContent.is() ) return false; |