diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2017-01-27 16:09:54 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2017-01-28 09:22:55 +0000 |
commit | f1d83ac45f08270f7f2dd7128056effd0251dc5e (patch) | |
tree | 55d924eaa7f55627039d44458d869ef65130fdf8 /ucb/source/ucp/tdoc | |
parent | 53d3755972bfd3bd2cd650edf91f1483038028c8 (diff) |
loplugin:stringconstant check for unnecessary OUString constructor..
..calls when creating exceptions
Change-Id: I3bc58a5aa4dc6f0508ecb88b3a843b96b8c7ebfe
Reviewed-on: https://gerrit.libreoffice.org/33617
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'ucb/source/ucp/tdoc')
-rw-r--r-- | ucb/source/ucp/tdoc/tdoc_content.cxx | 89 | ||||
-rw-r--r-- | ucb/source/ucp/tdoc/tdoc_documentcontentfactory.cxx | 3 | ||||
-rw-r--r-- | ucb/source/ucp/tdoc/tdoc_provider.cxx | 11 | ||||
-rw-r--r-- | ucb/source/ucp/tdoc/tdoc_storage.cxx | 33 |
4 files changed, 59 insertions, 77 deletions
diff --git a/ucb/source/ucp/tdoc/tdoc_content.cxx b/ucb/source/ucp/tdoc/tdoc_content.cxx index 5b5e5ec9f506..91eb14ca520c 100644 --- a/ucb/source/ucp/tdoc/tdoc_content.cxx +++ b/ucb/source/ucp/tdoc/tdoc_content.cxx @@ -363,7 +363,7 @@ uno::Any SAL_CALL Content::execute( { ucbhelper::cancelCommandExecution( uno::makeAny( lang::IllegalArgumentException( - OUString( "Wrong argument type!" ), + "Wrong argument type!", static_cast< cppu::OWeakObject * >( this ), -1 ) ), Environment ); @@ -383,7 +383,7 @@ uno::Any SAL_CALL Content::execute( { ucbhelper::cancelCommandExecution( uno::makeAny( lang::IllegalArgumentException( - OUString( "Wrong argument type!" ), + "Wrong argument type!", static_cast< cppu::OWeakObject * >( this ), -1 ) ), Environment ); @@ -394,7 +394,7 @@ uno::Any SAL_CALL Content::execute( { ucbhelper::cancelCommandExecution( uno::makeAny( lang::IllegalArgumentException( - OUString( "No properties!" ), + "No properties!", static_cast< cppu::OWeakObject * >( this ), -1 ) ), Environment ); @@ -430,7 +430,7 @@ uno::Any SAL_CALL Content::execute( { ucbhelper::cancelCommandExecution( uno::makeAny( lang::IllegalArgumentException( - OUString( "Wrong argument type!" ), + "Wrong argument type!", static_cast< cppu::OWeakObject * >( this ), -1 ) ), Environment ); @@ -450,8 +450,8 @@ uno::Any SAL_CALL Content::execute( { ucbhelper::cancelCommandExecution( uno::makeAny( ucb::UnsupportedCommandException( - OUString( "insert command only supported by " - "folders and streams!" ), + "insert command only supported by " + "folders and streams!", static_cast< cppu::OWeakObject * >( this ) ) ), Environment ); // Unreachable @@ -466,9 +466,9 @@ uno::Any SAL_CALL Content::execute( { ucbhelper::cancelCommandExecution( uno::makeAny( ucb::UnsupportedCommandException( - OUString( "insert command not supported by " - "streams that are direct children " - "of document root!" ), + "insert command not supported by " + "streams that are direct children " + "of document root!", static_cast< cppu::OWeakObject * >( this ) ) ), Environment ); @@ -481,7 +481,7 @@ uno::Any SAL_CALL Content::execute( { ucbhelper::cancelCommandExecution( uno::makeAny( lang::IllegalArgumentException( - OUString( "Wrong argument type!" ), + "Wrong argument type!", static_cast< cppu::OWeakObject * >( this ), -1 ) ), Environment ); @@ -507,8 +507,8 @@ uno::Any SAL_CALL Content::execute( { ucbhelper::cancelCommandExecution( uno::makeAny( ucb::UnsupportedCommandException( - OUString( "delete command only supported by " - "folders and streams!" ), + "delete command only supported by " + "folders and streams!", static_cast< cppu::OWeakObject * >( this ) ) ), Environment ); @@ -557,8 +557,8 @@ uno::Any SAL_CALL Content::execute( { ucbhelper::cancelCommandExecution( uno::makeAny( ucb::UnsupportedCommandException( - OUString( "transfer command only supported " - "by folders and documents!" ), + "transfer command only supported " + "by folders and documents!", static_cast< cppu::OWeakObject * >( this ) ) ), Environment ); @@ -572,7 +572,7 @@ uno::Any SAL_CALL Content::execute( OSL_FAIL( "Wrong argument type!" ); ucbhelper::cancelCommandExecution( uno::makeAny( lang::IllegalArgumentException( - OUString( "Wrong argument type!" ), + "Wrong argument type!", static_cast< cppu::OWeakObject * >( this ), -1 ) ), Environment ); @@ -595,9 +595,9 @@ uno::Any SAL_CALL Content::execute( { ucbhelper::cancelCommandExecution( uno::makeAny( ucb::UnsupportedCommandException( - OUString( "createNewContent command only " - "supported by folders and " - "documents!" ), + "createNewContent command only " + "supported by folders and " + "documents!", static_cast< cppu::OWeakObject * >( this ) ) ), Environment ); @@ -611,7 +611,7 @@ uno::Any SAL_CALL Content::execute( OSL_FAIL( "Wrong argument type!" ); ucbhelper::cancelCommandExecution( uno::makeAny( lang::IllegalArgumentException( - OUString( "Wrong argument type!" ), + "Wrong argument type!", static_cast< cppu::OWeakObject * >( this ), -1 ) ), Environment ); @@ -1129,28 +1129,28 @@ uno::Sequence< uno::Any > Content::setPropertyValues( { // Read-only property! aRet[ n ] <<= lang::IllegalAccessException( - OUString( "Property is read-only!" ), + "Property is read-only!", static_cast< cppu::OWeakObject * >( this ) ); } else if ( rValue.Name == "IsDocument" ) { // Read-only property! aRet[ n ] <<= lang::IllegalAccessException( - OUString( "Property is read-only!" ), + "Property is read-only!", static_cast< cppu::OWeakObject * >( this ) ); } else if ( rValue.Name == "IsFolder" ) { // Read-only property! aRet[ n ] <<= lang::IllegalAccessException( - OUString( "Property is read-only!" ), + "Property is read-only!", static_cast< cppu::OWeakObject * >( this ) ); } else if ( rValue.Name == "CreatableContentsInfo" ) { // Read-only property! aRet[ n ] <<= lang::IllegalAccessException( - OUString( "Property is read-only!" ), + "Property is read-only!", static_cast< cppu::OWeakObject * >( this ) ); } else if ( rValue.Name == "Title" ) @@ -1160,7 +1160,7 @@ uno::Sequence< uno::Any > Content::setPropertyValues( if ( ( eType == ROOT ) || ( eType == DOCUMENT ) ) { aRet[ n ] <<= lang::IllegalAccessException( - OUString( "Property is read-only!" ), + "Property is read-only!", static_cast< cppu::OWeakObject * >( this ) ); } else @@ -1190,7 +1190,7 @@ uno::Sequence< uno::Any > Content::setPropertyValues( else { aRet[ n ] <<= lang::IllegalArgumentException( - OUString( "Empty Title not allowed!" ), + "Empty Title not allowed!", static_cast< cppu::OWeakObject * >( this ), -1 ); } @@ -1198,7 +1198,7 @@ uno::Sequence< uno::Any > Content::setPropertyValues( else { aRet[ n ] <<= beans::IllegalTypeException( - OUString( "Title Property value has wrong type!" ), + "Title Property value has wrong type!", static_cast< cppu::OWeakObject * >( this ) ); } } @@ -1209,14 +1209,14 @@ uno::Sequence< uno::Any > Content::setPropertyValues( if ( eType == FOLDER ) { aRet[ n ] <<= lang::IllegalAccessException( - OUString( "Property is read-only!" ), + "Property is read-only!", static_cast< cppu::OWeakObject * >( this ) ); } else { // Storage is only supported by folders. aRet[ n ] <<= beans::UnknownPropertyException( - OUString( "Storage property only supported by folders" ), + "Storage property only supported by folders", static_cast< cppu::OWeakObject * >( this ) ); } } @@ -1226,15 +1226,14 @@ uno::Sequence< uno::Any > Content::setPropertyValues( if ( eType == DOCUMENT ) { aRet[ n ] <<= lang::IllegalAccessException( - OUString( "Property is read-only!" ), + "Property is read-only!", static_cast< cppu::OWeakObject * >( this ) ); } else { // Storage is only supported by folders. aRet[ n ] <<= beans::UnknownPropertyException( - OUString( "DocumentModel property only supported by " - "documents" ), + "DocumentModel property only supported by documents", static_cast< cppu::OWeakObject * >( this ) ); } } @@ -1287,7 +1286,7 @@ uno::Sequence< uno::Any > Content::setPropertyValues( else { aRet[ n ] <<= uno::Exception( - OUString( "No property set for storing the value!" ), + "No property set for storing the value!", static_cast< cppu::OWeakObject * >( this ) ); } } @@ -1318,7 +1317,7 @@ uno::Sequence< uno::Any > Content::setPropertyValues( // Set error . aRet[ nTitlePos ] <<= uno::Exception( - OUString("Exchange failed!"), + "Exchange failed!", static_cast< cppu::OWeakObject * >( this ) ); } } @@ -1650,7 +1649,7 @@ void Content::insert( const uno::Reference< io::XInputStream >& xData, ucbhelper::cancelCommandExecution( uno::makeAny( ucb::UnsupportedNameClashException( - OUString( "Unable to resolve name clash!" ), + "Unable to resolve name clash!", static_cast< cppu::OWeakObject * >( this ), nNameClashResolve ) ), xEnv ); @@ -1742,7 +1741,7 @@ void Content::destroy( bool bDeletePhysical, { ucbhelper::cancelCommandExecution( uno::makeAny( ucb::UnsupportedCommandException( - OUString( "Not persistent!" ), + "Not persistent!", static_cast< cppu::OWeakObject * >( this ) ) ), xEnv ); // Unreachable @@ -1881,7 +1880,7 @@ void Content::transfer( { ucbhelper::cancelCommandExecution( uno::makeAny( ucb::UnsupportedCommandException( - OUString( "Not persistent!" ), + "Not persistent!", static_cast< cppu::OWeakObject * >( this ) ) ), xEnv ); // Unreachable @@ -1920,7 +1919,7 @@ void Content::transfer( { ucbhelper::cancelCommandExecution( uno::makeAny( lang::IllegalArgumentException( - OUString( "Invalid source URI! Syntax!" ), + "Invalid source URI! Syntax!", static_cast< cppu::OWeakObject * >( this ), -1 ) ), xEnv ); @@ -1931,8 +1930,7 @@ void Content::transfer( { ucbhelper::cancelCommandExecution( uno::makeAny( lang::IllegalArgumentException( - OUString( "Invalid source URI! " - "Must describe a folder or stream!" ), + "Invalid source URI! Must describe a folder or stream!", static_cast< cppu::OWeakObject * >( this ), -1 ) ), xEnv ); @@ -1984,9 +1982,9 @@ void Content::transfer( { ucbhelper::cancelCommandExecution( uno::makeAny( lang::IllegalArgumentException( - OUString( "Invalid source URI! " - "Streams cannot be created as " - "children of document root!" ), + "Invalid source URI! " + "Streams cannot be created as " + "children of document root!", static_cast< cppu::OWeakObject * >( this ), -1 ) ), @@ -2013,8 +2011,7 @@ void Content::transfer( { ucbhelper::cancelCommandExecution( uno::makeAny( lang::IllegalArgumentException( - OUString( "Invalid source URI! " - "Unable to determine source type!" ), + "Invalid source URI! Unable to determine source type!", static_cast< cppu::OWeakObject * >( this ), -1 ) ), xEnv ); @@ -2729,7 +2726,7 @@ static OUString obtainPassword( if ( xAbort.is() ) { throw ucb::CommandFailedException( - OUString( "Abort requested by Interaction Handler." ), + "Abort requested by Interaction Handler.", uno::Reference< uno::XInterface >(), xRequest->getRequest() ); } @@ -2743,7 +2740,7 @@ static OUString obtainPassword( // Unknown selection. Should never happen. throw ucb::CommandFailedException( - OUString( "Interaction Handler selected unknown continuation!" ), + "Interaction Handler selected unknown continuation!", uno::Reference< uno::XInterface >(), xRequest->getRequest() ); } diff --git a/ucb/source/ucp/tdoc/tdoc_documentcontentfactory.cxx b/ucb/source/ucp/tdoc/tdoc_documentcontentfactory.cxx index 0ec5fbfe00e3..aa459df2601e 100644 --- a/ucb/source/ucp/tdoc/tdoc_documentcontentfactory.cxx +++ b/ucb/source/ucp/tdoc/tdoc_documentcontentfactory.cxx @@ -113,8 +113,7 @@ DocumentContentFactory::createDocumentContent( return xDocFac->createDocumentContent( Model ); throw uno::RuntimeException( - OUString( - "Unable to obtain document content factory!" ), + "Unable to obtain document content factory!", static_cast< cppu::OWeakObject * >( this ) ); } diff --git a/ucb/source/ucp/tdoc/tdoc_provider.cxx b/ucb/source/ucp/tdoc/tdoc_provider.cxx index 4c80a626035d..f3b7e36e4baf 100644 --- a/ucb/source/ucp/tdoc/tdoc_provider.cxx +++ b/ucb/source/ucp/tdoc/tdoc_provider.cxx @@ -134,7 +134,7 @@ ContentProvider::queryContent( Uri aUri( Identifier->getContentIdentifier() ); if ( !aUri.isValid() ) throw ucb::IllegalIdentifierException( - OUString( "Invalid URL!" ), + "Invalid URL!", Identifier ); // Normalize URI. @@ -196,16 +196,14 @@ ContentProvider::createDocumentContent( // no content. throw lang::IllegalArgumentException( - OUString( - "Illegal Content Identifier!" ), + "Illegal Content Identifier!", static_cast< cppu::OWeakObject * >( this ), 1 ); } else { throw lang::IllegalArgumentException( - OUString( - "Unable to obtain document id from model!" ), + "Unable to obtain document id from model!", static_cast< cppu::OWeakObject * >( this ), 1 ); } @@ -213,8 +211,7 @@ ContentProvider::createDocumentContent( else { throw lang::IllegalArgumentException( - OUString( - "No Document Manager!" ), + "No Document Manager!", static_cast< cppu::OWeakObject * >( this ), 1 ); } diff --git a/ucb/source/ucp/tdoc/tdoc_storage.cxx b/ucb/source/ucp/tdoc/tdoc_storage.cxx index a8055241522b..2fcc63561a40 100644 --- a/ucb/source/ucp/tdoc/tdoc_storage.cxx +++ b/ucb/source/ucp/tdoc/tdoc_storage.cxx @@ -85,8 +85,7 @@ StorageElementFactory::createStorage( const OUString & rUri, ( eMode != READ_WRITE_NOCREATE ) && ( eMode != READ_WRITE_CREATE ) ) throw lang::IllegalArgumentException( - OUString( - "Invalid open mode!" ), + "Invalid open mode!", uno::Reference< uno::XInterface >(), sal_Int16( 2 ) ); @@ -94,8 +93,7 @@ StorageElementFactory::createStorage( const OUString & rUri, if ( aUri.isRoot() ) { throw lang::IllegalArgumentException( - OUString( - "Root never has a storage!" ), + "Root never has a storage!", uno::Reference< uno::XInterface >(), sal_Int16( 1 ) ); } @@ -369,14 +367,12 @@ uno::Reference< embed::XStorage > StorageElementFactory::queryStorage( { if ( eMode == READ_WRITE_CREATE ) throw lang::IllegalArgumentException( - OUString( - "Invalid open mode: document storages cannot be " - "created!" ), + "Invalid open mode: document storages cannot be created!", uno::Reference< uno::XInterface >(), sal_Int16( 2 ) ); else throw embed::InvalidStorageException( - OUString( "Invalid document id!" ), + "Invalid document id!", uno::Reference< uno::XInterface >() ); } @@ -432,8 +428,7 @@ uno::Reference< embed::XStorage > StorageElementFactory::queryStorage( OSL_FAIL( "Property OpenMode not supported!" ); throw embed::StorageWrappedTargetException( - OUString( - "Bug! Value of property OpenMode has wrong type!" ), + "Bug! Value of property OpenMode has wrong type!", uno::Reference< uno::XInterface >(), uno::makeAny( e ) ); } @@ -442,8 +437,7 @@ uno::Reference< embed::XStorage > StorageElementFactory::queryStorage( OSL_FAIL( "Caught WrappedTargetException!" ); throw embed::StorageWrappedTargetException( - OUString( - "WrappedTargetException during getPropertyValue!" ), + "WrappedTargetException during getPropertyValue!", uno::Reference< uno::XInterface >(), uno::makeAny( e ) ); } @@ -500,8 +494,7 @@ StorageElementFactory::queryStream( if ( !xParentStorage.is() ) { throw lang::IllegalArgumentException( - OUString( - "No parent storage!" ), + "No parent storage!", uno::Reference< uno::XInterface >(), sal_Int16( 2 ) ); } @@ -510,16 +503,14 @@ StorageElementFactory::queryStream( if ( aUri.isRoot() ) { throw lang::IllegalArgumentException( - OUString( - "Root never is a stream!" ), + "Root never is a stream!", uno::Reference< uno::XInterface >(), sal_Int16( 2 ) ); } else if ( aUri.isDocument() ) { throw lang::IllegalArgumentException( - OUString( - "A document never is a stream!" ), + "A document never is a stream!", uno::Reference< uno::XInterface >(), sal_Int16( 2 ) ); } @@ -556,8 +547,7 @@ StorageElementFactory::queryStream( OSL_FAIL( "StorageElementFactory::queryStream : Unknown open mode!" ); throw embed::InvalidStorageException( - OUString( - "Unknown open mode!" ), + "Unknown open mode!", uno::Reference< uno::XInterface >() ); } @@ -613,8 +603,7 @@ StorageElementFactory::queryStream( if ( !xStream.is() ) { throw embed::InvalidStorageException( - OUString( - "No stream!" ), + "No stream!", uno::Reference< uno::XInterface >() ); } |