Kaydet (Commit) ec4498a3 authored tarafından Caolán McNamara's avatar Caolán McNamara

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
üst 5bd3a42b
...@@ -226,19 +226,15 @@ static void ensureContentProviderForURL( const Reference< XUniversalContentBroke ...@@ -226,19 +226,15 @@ static void ensureContentProviderForURL( const Reference< XUniversalContentBroke
} }
static Reference< XContentIdentifier > getContentIdentifier( static Reference< XContentIdentifier > getContentIdentifierThrow(
const Reference< XUniversalContentBroker > & rBroker, const Reference< XUniversalContentBroker > & rBroker,
const OUString & rURL, const OUString & rURL)
bool bThrow ) throw (ContentCreationException, RuntimeException)
throw ( ContentCreationException, RuntimeException )
{ {
Reference< XContentIdentifier > xId Reference< XContentIdentifier > xId
= rBroker->createContentIdentifier( rURL ); = rBroker->createContentIdentifier( rURL );
if ( xId.is() ) if (!xId.is())
return xId;
if ( bThrow )
{ {
ensureContentProviderForURL( rBroker, rURL ); ensureContentProviderForURL( rBroker, rURL );
...@@ -248,7 +244,15 @@ static Reference< XContentIdentifier > getContentIdentifier( ...@@ -248,7 +244,15 @@ static Reference< XContentIdentifier > getContentIdentifier(
ContentCreationError_IDENTIFIER_CREATION_FAILED ); 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, ...@@ -309,7 +313,7 @@ Content::Content( const OUString& rURL,
UniversalContentBroker::create( rCtx ) ); UniversalContentBroker::create( rCtx ) );
Reference< XContentIdentifier > xId Reference< XContentIdentifier > xId
= getContentIdentifier( pBroker, rURL, true ); = getContentIdentifierThrow(pBroker, rURL);
Reference< XContent > xContent = getContent( pBroker, xId, true ); Reference< XContent > xContent = getContent( pBroker, xId, true );
...@@ -342,7 +346,7 @@ bool Content::create( const OUString& rURL, ...@@ -342,7 +346,7 @@ bool Content::create( const OUString& rURL,
UniversalContentBroker::create( rCtx ) ); UniversalContentBroker::create( rCtx ) );
Reference< XContentIdentifier > xId Reference< XContentIdentifier > xId
= getContentIdentifier( pBroker, rURL, false ); = getContentIdentifierNoThrow(pBroker, rURL);
if ( !xId.is() ) if ( !xId.is() )
return false; return false;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment