From 9e8d4c439f96d52b676b933b18902a3ec80e2f38 Mon Sep 17 00:00:00 2001 From: Caolán McNamara Date: Thu, 3 Apr 2014 20:58:07 +0100 Subject: coverity#707355 Uncaught exception, help coverity out here hopefully loads of other ones too Change-Id: I8445602adc76205448926efe23c9770cef0eb5dc --- ucbhelper/source/client/content.cxx | 35 ++++++++++++++++++++++++----------- 1 file changed, 24 insertions(+), 11 deletions(-) (limited to 'ucbhelper') 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; -- cgit