diff options
author | Noel Grandin <noelgrandin@gmail.com> | 2017-01-29 11:57:08 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2017-02-01 12:17:56 +0000 |
commit | 4739b31dafc5154a2c7d6b3f0ee90686863656f0 (patch) | |
tree | 0437d82f929131f3c900b5feb74cee4b1595499b /ucb | |
parent | 385c207e3a0b2d946ff29a9003b36f81a8946c55 (diff) |
cancelCommandExecution - no need to pass exception by Any
all the call sites are passing an uno::Exception subtype
Change-Id: I6de1f00810e063e75ef620314561d7e2d6445ada
Reviewed-on: https://gerrit.libreoffice.org/33657
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'ucb')
-rw-r--r-- | ucb/source/core/ucb.cxx | 12 | ||||
-rw-r--r-- | ucb/source/core/ucbcmds.cxx | 25 | ||||
-rw-r--r-- | ucb/source/ucp/cmis/cmis_content.cxx | 70 | ||||
-rw-r--r-- | ucb/source/ucp/cmis/cmis_content.hxx | 2 | ||||
-rw-r--r-- | ucb/source/ucp/cmis/cmis_repo_content.cxx | 6 | ||||
-rw-r--r-- | ucb/source/ucp/cmis/cmis_repo_content.hxx | 2 | ||||
-rw-r--r-- | ucb/source/ucp/ext/ucpext_content.cxx | 20 | ||||
-rw-r--r-- | ucb/source/ucp/file/filglob.cxx | 42 | ||||
-rw-r--r-- | ucb/source/ucp/ftp/ftpcontent.cxx | 104 | ||||
-rw-r--r-- | ucb/source/ucp/gio/gio_content.cxx | 165 | ||||
-rw-r--r-- | ucb/source/ucp/gio/gio_content.hxx | 6 | ||||
-rw-r--r-- | ucb/source/ucp/hierarchy/hierarchycontent.cxx | 67 | ||||
-rw-r--r-- | ucb/source/ucp/package/pkgcontent.cxx | 73 | ||||
-rw-r--r-- | ucb/source/ucp/tdoc/tdoc_content.cxx | 109 | ||||
-rw-r--r-- | ucb/source/ucp/webdav-neon/webdavcontent.cxx | 153 | ||||
-rw-r--r-- | ucb/source/ucp/webdav-neon/webdavcontent.hxx | 2 | ||||
-rw-r--r-- | ucb/source/ucp/webdav/webdavcontent.cxx | 4 | ||||
-rw-r--r-- | ucb/source/ucp/webdav/webdavcontent.hxx | 2 |
18 files changed, 399 insertions, 465 deletions
diff --git a/ucb/source/core/ucb.cxx b/ucb/source/core/ucb.cxx index d363044f6d19..9449061a2fac 100644 --- a/ucb/source/core/ucb.cxx +++ b/ucb/source/core/ucb.cxx @@ -637,10 +637,10 @@ Any SAL_CALL UniversalContentBroker::execute( if ( !( aCommand.Argument >>= aArg ) ) { ucbhelper::cancelCommandExecution( - makeAny( IllegalArgumentException( + IllegalArgumentException( "Wrong argument type!", static_cast< cppu::OWeakObject * >( this ), - -1 ) ), + -1 ), Environment ); // Unreachable } @@ -661,10 +661,10 @@ Any SAL_CALL UniversalContentBroker::execute( if ( !( aCommand.Argument >>= aCheckinArg ) ) { ucbhelper::cancelCommandExecution( - makeAny( IllegalArgumentException( + IllegalArgumentException( "Wrong argument type!", static_cast< cppu::OWeakObject * >( this ), - -1 ) ), + -1 ), Environment ); // Unreachable } @@ -677,9 +677,9 @@ Any SAL_CALL UniversalContentBroker::execute( ucbhelper::cancelCommandExecution( - makeAny( UnsupportedCommandException( + UnsupportedCommandException( OUString(), - static_cast< cppu::OWeakObject * >( this ) ) ), + static_cast< cppu::OWeakObject * >( this ) ), Environment ); // Unreachable } diff --git a/ucb/source/core/ucbcmds.cxx b/ucb/source/core/ucbcmds.cxx index 988efa3ab0f9..20fa1c5e72e3 100644 --- a/ucb/source/core/ucbcmds.cxx +++ b/ucb/source/core/ucbcmds.cxx @@ -640,10 +640,10 @@ uno::Reference< ucb::XContent > createNew( else { ucbhelper::cancelCommandExecution( - uno::makeAny( lang::IllegalArgumentException( + lang::IllegalArgumentException( "Unknown transfer operation!", rContext.xProcessor, - -1 ) ), + -1 ), rContext.xOrigEnv ); // Unreachable } @@ -1027,9 +1027,9 @@ void handleNameClashRename( if ( aOldTitle.isEmpty() ) { ucbhelper::cancelCommandExecution( - uno::makeAny( beans::UnknownPropertyException( + beans::UnknownPropertyException( "Unable to get property 'Title' from new object!", - rContext.xProcessor ) ), + rContext.xProcessor ), rContext.xOrigEnv ); // Unreachable } @@ -1141,11 +1141,10 @@ void handleNameClashRename( if ( nTry == 50 ) { ucbhelper::cancelCommandExecution( - uno::makeAny( ucb::UnsupportedNameClashException( "Unable to resolve name clash!", rContext.xProcessor, - ucb::NameClash::RENAME ) ), + ucb::NameClash::RENAME ), rContext.xOrigEnv ); // Unreachable } @@ -1163,9 +1162,9 @@ void globalTransfer_( if ( !bSourceIsFolder && xSourceProps->wasNull() ) { ucbhelper::cancelCommandExecution( - uno::makeAny( beans::UnknownPropertyException( + beans::UnknownPropertyException( "Unable to get property 'IsFolder' from source object!", - rContext.xProcessor ) ), + rContext.xProcessor ), rContext.xOrigEnv ); // Unreachable } @@ -1175,9 +1174,9 @@ void globalTransfer_( if ( !bSourceIsDocument && xSourceProps->wasNull() ) { ucbhelper::cancelCommandExecution( - uno::makeAny( beans::UnknownPropertyException( + beans::UnknownPropertyException( "Unable to get property 'IsDocument' from source object!", - rContext.xProcessor ) ), + rContext.xProcessor ), rContext.xOrigEnv ); // Unreachable } @@ -1361,12 +1360,11 @@ void globalTransfer_( case ucb::NameClash::OVERWRITE: { ucbhelper::cancelCommandExecution( - uno::makeAny( ucb::UnsupportedNameClashException( "BUG: insert + replace == true MUST NOT " "throw NameClashException.", rContext.xProcessor, - rContext.aArg.NameClash ) ), + rContext.aArg.NameClash ), rContext.xOrigEnv ); SAL_FALLTHROUGH; // Unreachable } @@ -1457,12 +1455,11 @@ void globalTransfer_( default: { ucbhelper::cancelCommandExecution( - uno::makeAny( ucb::UnsupportedNameClashException( "default action, don't know how to " "handle name clash", rContext.xProcessor, - rContext.aArg.NameClash ) ), + rContext.aArg.NameClash ), rContext.xOrigEnv ); // Unreachable } diff --git a/ucb/source/ucp/cmis/cmis_content.cxx b/ucb/source/ucp/cmis/cmis_content.cxx index 6818f6d94aaf..fbc0e0711c9d 100644 --- a/ucb/source/ucp/cmis/cmis_content.cxx +++ b/ucb/source/ucp/cmis/cmis_content.cxx @@ -592,11 +592,11 @@ namespace cmis return bIsFolder; } - uno::Any Content::getBadArgExcept() + lang::IllegalArgumentException Content::getBadArgExcept() { - return uno::makeAny( lang::IllegalArgumentException( + return lang::IllegalArgumentException( "Wrong argument type!", - static_cast< cppu::OWeakObject * >( this ), -1) ); + static_cast< cppu::OWeakObject * >( this ), -1); } libcmis::ObjectPtr Content::updateProperties( @@ -980,13 +980,12 @@ namespace cmis { uno::Sequence< uno::Any > aArgs( 1 ); aArgs[ 0 ] <<= m_xIdentifier->getContentIdentifier(); - uno::Any aErr = uno::makeAny( + + ucbhelper::cancelCommandExecution( ucb::InteractiveAugmentedIOException(OUString(), static_cast< cppu::OWeakObject * >( this ), task::InteractionClassification_ERROR, - bIsFolder ? ucb::IOErrorCode_NOT_EXISTING_PATH : ucb::IOErrorCode_NOT_EXISTING, aArgs) - ); - - ucbhelper::cancelCommandExecution(aErr, xEnv); + bIsFolder ? ucb::IOErrorCode_NOT_EXISTING_PATH : ucb::IOErrorCode_NOT_EXISTING, aArgs), + xEnv); } uno::Any aRet; @@ -1011,9 +1010,9 @@ namespace cmis ) { ucbhelper::cancelCommandExecution( - uno::makeAny ( ucb::UnsupportedOpenModeException + ucb::UnsupportedOpenModeException ( OUString(), static_cast< cppu::OWeakObject * >( this ), - sal_Int16( rOpenCommand.Mode ) ) ), + sal_Int16( rOpenCommand.Mode ) ), xEnv ); } @@ -1025,9 +1024,9 @@ namespace cmis SAL_INFO( "ucb.ucp.cmis", "Failed to copy data to sink" ); ucbhelper::cancelCommandExecution( - uno::makeAny (ucb::UnsupportedDataSinkException + ucb::UnsupportedDataSinkException ( OUString(), static_cast< cppu::OWeakObject * >( this ), - rOpenCommand.Sink ) ), + rOpenCommand.Sink ), xEnv ); } } @@ -1270,10 +1269,9 @@ namespace cmis if ( sSrcBindingUrl != m_aURL.getBindingUrl( ) ) { ucbhelper::cancelCommandExecution( - uno::makeAny( - ucb::InteractiveBadTransferURLException( + ucb::InteractiveBadTransferURLException( "Unsupported URL scheme!", - static_cast< cppu::OWeakObject * >( this ) ) ), + static_cast< cppu::OWeakObject * >( this ) ), xEnv ); } } @@ -1287,9 +1285,9 @@ namespace cmis { if ( !xInputStream.is() ) { - ucbhelper::cancelCommandExecution( uno::makeAny - ( ucb::MissingInputStreamException - ( OUString(), static_cast< cppu::OWeakObject * >( this ) ) ), + ucbhelper::cancelCommandExecution( + ucb::MissingInputStreamException + ( OUString(), static_cast< cppu::OWeakObject * >( this ) ), xEnv ); } @@ -1314,9 +1312,9 @@ namespace cmis map< string, libcmis::PropertyPtr >::iterator it = m_pObjectProps.find( "cmis:name" ); if ( it == m_pObjectProps.end( ) ) { - ucbhelper::cancelCommandExecution( uno::makeAny - ( uno::RuntimeException( "Missing name property", - static_cast< cppu::OWeakObject * >( this ) ) ), + ucbhelper::cancelCommandExecution( + uno::RuntimeException( "Missing name property", + static_cast< cppu::OWeakObject * >( this ) ), xEnv ); } string newName = it->second->getStrings( ).front( ); @@ -1342,9 +1340,9 @@ namespace cmis // Are the base type matching? if ( object->getBaseType( ) != m_pObjectType->getBaseType( )->getId() ) { - ucbhelper::cancelCommandExecution( uno::makeAny - ( uno::RuntimeException( "Can't change a folder into a document and vice-versa.", - static_cast< cppu::OWeakObject * >( this ) ) ), + ucbhelper::cancelCommandExecution( + uno::RuntimeException( "Can't change a folder into a document and vice-versa.", + static_cast< cppu::OWeakObject * >( this ) ), xEnv ); } @@ -1361,9 +1359,9 @@ namespace cmis } catch ( const libcmis::Exception& ) { - ucbhelper::cancelCommandExecution( uno::makeAny - ( uno::RuntimeException( "Error when setting document content", - static_cast< cppu::OWeakObject * >( this ) ) ), + ucbhelper::cancelCommandExecution( + uno::RuntimeException( "Error when setting document content", + static_cast< cppu::OWeakObject * >( this ) ), xEnv ); } } @@ -1383,9 +1381,9 @@ namespace cmis } catch ( const libcmis::Exception& ) { - ucbhelper::cancelCommandExecution( uno::makeAny - ( uno::RuntimeException( "Error when creating folder", - static_cast< cppu::OWeakObject * >( this ) ) ), + ucbhelper::cancelCommandExecution( + uno::RuntimeException( "Error when creating folder", + static_cast< cppu::OWeakObject * >( this ) ), xEnv ); } } @@ -1401,9 +1399,9 @@ namespace cmis } catch ( const libcmis::Exception& ) { - ucbhelper::cancelCommandExecution( uno::makeAny - ( uno::RuntimeException( "Error when creating document", - static_cast< cppu::OWeakObject * >( this ) ) ), + ucbhelper::cancelCommandExecution( + uno::RuntimeException( "Error when creating document", + static_cast< cppu::OWeakObject * >( this ) ), xEnv ); } } @@ -1885,10 +1883,10 @@ namespace cmis { SAL_INFO( "ucb.ucp.cmis", "Unknown command to execute" ); - ucbhelper::cancelCommandExecution - ( uno::makeAny( ucb::UnsupportedCommandException + ucbhelper::cancelCommandExecution( + ucb::UnsupportedCommandException ( OUString(), - static_cast< cppu::OWeakObject * >( this ) ) ), + static_cast< cppu::OWeakObject * >( this ) ), xEnv ); } diff --git a/ucb/source/ucp/cmis/cmis_content.hxx b/ucb/source/ucp/cmis/cmis_content.hxx index 366b1a488228..357845cd9a26 100644 --- a/ucb/source/ucp/cmis/cmis_content.hxx +++ b/ucb/source/ucp/cmis/cmis_content.hxx @@ -81,7 +81,7 @@ private: void setCmisProperty(const std::string& rName, const std::string& rValue, const css::uno::Reference< css::ucb::XCommandEnvironment >& xEnv ); - css::uno::Any getBadArgExcept(); + css::lang::IllegalArgumentException getBadArgExcept(); css::uno::Reference< css::sdbc::XRow > getPropertyValues( diff --git a/ucb/source/ucp/cmis/cmis_repo_content.cxx b/ucb/source/ucp/cmis/cmis_repo_content.cxx index f130b83b054c..552532b79cd2 100644 --- a/ucb/source/ucp/cmis/cmis_repo_content.cxx +++ b/ucb/source/ucp/cmis/cmis_repo_content.cxx @@ -69,11 +69,11 @@ namespace cmis { } - uno::Any RepoContent::getBadArgExcept() + lang::IllegalArgumentException RepoContent::getBadArgExcept() { - return uno::makeAny( lang::IllegalArgumentException( + return lang::IllegalArgumentException( "Wrong argument type!", - static_cast< cppu::OWeakObject * >( this ), -1) ); + static_cast< cppu::OWeakObject * >( this ), -1); } uno::Reference< sdbc::XRow > RepoContent::getPropertyValues( diff --git a/ucb/source/ucp/cmis/cmis_repo_content.hxx b/ucb/source/ucp/cmis/cmis_repo_content.hxx index 4be969ee1c24..2ce3b5df83a5 100644 --- a/ucb/source/ucp/cmis/cmis_repo_content.hxx +++ b/ucb/source/ucp/cmis/cmis_repo_content.hxx @@ -57,7 +57,7 @@ private: private: - css::uno::Any getBadArgExcept(); + css::lang::IllegalArgumentException getBadArgExcept(); css::uno::Reference< css::sdbc::XRow > getPropertyValues( diff --git a/ucb/source/ucp/ext/ucpext_content.cxx b/ucb/source/ucp/ext/ucpext_content.cxx index 950a953fed99..562d81030dcb 100644 --- a/ucb/source/ucp/ext/ucpext_content.cxx +++ b/ucb/source/ucp/ext/ucpext_content.cxx @@ -191,8 +191,8 @@ namespace ucb { namespace ucp { namespace ext Sequence< Property > Properties; if ( !( aCommand.Argument >>= Properties ) ) { - ::ucbhelper::cancelCommandExecution( makeAny( IllegalArgumentException( - OUString(), *this, -1 ) ), + ::ucbhelper::cancelCommandExecution( IllegalArgumentException( + OUString(), *this, -1 ), i_rEvironment ); // unreachable } @@ -204,16 +204,16 @@ namespace ucb { namespace ucp { namespace ext Sequence< PropertyValue > aProperties; if ( !( aCommand.Argument >>= aProperties ) ) { - ::ucbhelper::cancelCommandExecution( makeAny( IllegalArgumentException( - OUString(), *this, -1 ) ), + ::ucbhelper::cancelCommandExecution( IllegalArgumentException( + OUString(), *this, -1 ), i_rEvironment ); // unreachable } if ( !aProperties.getLength() ) { - ::ucbhelper::cancelCommandExecution( makeAny( IllegalArgumentException( - OUString(), *this, -1 ) ), + ::ucbhelper::cancelCommandExecution( IllegalArgumentException( + OUString(), *this, -1 ), i_rEvironment ); // unreachable } @@ -235,8 +235,8 @@ namespace ucb { namespace ucp { namespace ext OpenCommandArgument2 aOpenCommand; if ( !( aCommand.Argument >>= aOpenCommand ) ) { - ::ucbhelper::cancelCommandExecution( makeAny( IllegalArgumentException( - OUString(), *this, -1 ) ), + ::ucbhelper::cancelCommandExecution( IllegalArgumentException( + OUString(), *this, -1 ), i_rEvironment ); // unreachable } @@ -263,8 +263,8 @@ namespace ucb { namespace ucp { namespace ext else { - ::ucbhelper::cancelCommandExecution( makeAny( UnsupportedCommandException( - OUString(), *this ) ), + ::ucbhelper::cancelCommandExecution( UnsupportedCommandException( + OUString(), *this ), i_rEvironment ); // unreachable } diff --git a/ucb/source/ucp/file/filglob.cxx b/ucb/source/ucp/file/filglob.cxx index 32010ebf050e..782407ba58ce 100644 --- a/ucb/source/ucp/file/filglob.cxx +++ b/ucb/source/ucp/file/filglob.cxx @@ -245,13 +245,11 @@ namespace fileaccess { bool isHandled ) { Reference<XCommandProcessor> xComProc(pContent); - Any aAny; IOErrorCode ioErrorCode; if( errorCode == TASKHANDLER_UNSUPPORTED_COMMAND ) { - aAny <<= UnsupportedCommandException( OSL_LOG_PREFIX ); - cancelCommandExecution( aAny,xEnv ); + cancelCommandExecution( UnsupportedCommandException( OSL_LOG_PREFIX ), xEnv ); } else if( errorCode == TASKHANDLING_WRONG_SETPROPERTYVALUES_ARGUMENT || errorCode == TASKHANDLING_WRONG_GETPROPERTYVALUES_ARGUMENT || @@ -263,13 +261,13 @@ namespace fileaccess { { IllegalArgumentException excep; excep.ArgumentPosition = 0; - cancelCommandExecution(Any(excep), xEnv); + cancelCommandExecution(excep, xEnv); } else if( errorCode == TASKHANDLING_UNSUPPORTED_OPEN_MODE ) { UnsupportedOpenModeException excep; excep.Mode = sal::static_int_cast< sal_Int16 >(minorCode); - cancelCommandExecution( Any(excep),xEnv ); + cancelCommandExecution( excep,xEnv ); } else if(errorCode == TASKHANDLING_DELETED_STATE_IN_OPEN_COMMAND || errorCode == TASKHANDLING_INSERTED_STATE_IN_OPEN_COMMAND || @@ -505,11 +503,12 @@ namespace fileaccess { OUString("Title") : OUString("ContentType"); - aAny <<= MissingPropertiesException( - "a property is missing, necessary to create a content", - xComProc, - aSeq); - cancelCommandExecution(aAny,xEnv); + cancelCommandExecution( + MissingPropertiesException( + "a property is missing, necessary to create a content", + xComProc, + aSeq), + xEnv); } else if( errorCode == TASKHANDLING_FILESIZE_FOR_WRITE ) { @@ -535,11 +534,11 @@ namespace fileaccess { } else if(errorCode == TASKHANDLING_INPUTSTREAM_FOR_WRITE) { - aAny <<= + cancelCommandExecution( MissingInputStreamException( "the inputstream is missing, necessary to create a content", - xComProc); - cancelCommandExecution(aAny,xEnv); + xComProc), + xEnv); } else if( errorCode == TASKHANDLING_NOREPLACE_FOR_WRITE ) // Overwrite = false and file exists @@ -549,7 +548,7 @@ namespace fileaccess { excep.Classification = InteractionClassification_ERROR; excep.Context = Reference<XInterface>( xComProc, UNO_QUERY ); excep.Message = "file exists and overwrite forbidden"; - cancelCommandExecution( Any(excep), xEnv ); + cancelCommandExecution( excep, xEnv ); } else if( errorCode == TASKHANDLING_INVALID_NAME_MKDIR ) { @@ -573,7 +572,7 @@ namespace fileaccess { if(isHandled) throw excep; else { - cancelCommandExecution( Any(excep), xEnv ); + cancelCommandExecution( excep, xEnv ); } // ioErrorCode = IOErrorCode_INVALID_CHARACTER; // cancelCommandExecution( @@ -593,7 +592,7 @@ namespace fileaccess { if(isHandled) throw excep; else { - cancelCommandExecution( Any(excep), xEnv ); + cancelCommandExecution( excep, xEnv ); } // ioErrorCode = IOErrorCode_ALREADY_EXISTING; // cancelCommandExecution( @@ -779,10 +778,11 @@ namespace fileaccess { } else if( errorCode == TASKHANDLING_TRANSFER_INVALIDSCHEME ) { - aAny <<= InteractiveBadTransferURLException( + cancelCommandExecution( + InteractiveBadTransferURLException( "bad transfer url", - xComProc); - cancelCommandExecution( aAny,xEnv ); + xComProc), + xEnv ); } else if( errorCode == TASKHANDLING_OVERWRITE_FOR_MOVE || errorCode == TASKHANDLING_OVERWRITE_FOR_COPY || @@ -845,7 +845,7 @@ namespace fileaccess { excep.Context = Reference<XInterface>( xComProc, UNO_QUERY ); excep.Message = "name clash during copy or move"; - cancelCommandExecution(Any(excep), xEnv); + cancelCommandExecution(excep, xEnv); } else if( errorCode == TASKHANDLING_NAMECLASHSUPPORT_FOR_MOVE || errorCode == TASKHANDLING_NAMECLASHSUPPORT_FOR_COPY ) @@ -855,7 +855,7 @@ namespace fileaccess { excep.Context = Reference<XInterface>( xComProc, UNO_QUERY ); excep.Message = "name clash value not supported during copy or move"; - cancelCommandExecution(Any(excep), xEnv); + cancelCommandExecution(excep, xEnv); } else { diff --git a/ucb/source/ucp/ftp/ftpcontent.cxx b/ucb/source/ucp/ftp/ftpcontent.cxx index 6fcea525b790..846a6127412c 100644 --- a/ucb/source/ucp/ftp/ftpcontent.cxx +++ b/ucb/source/ucp/ftp/ftpcontent.cxx @@ -296,21 +296,6 @@ Any SAL_CALL FTPContent::execute( const Command& aCommand, aRet = p->getRequest(); } -// if(aCommand.Name.equalsAscii( -// "getPropertyValues") && -// action != NOACTION) { -// // It is not allowed to throw if -// // command is getPropertyValues -// rtl::Reference<ucbhelper::PropertyValueSet> xRow = -// new ucbhelper::PropertyValueSet(m_xSMgr); -// Sequence<Property> Properties; -// aCommand.Argument >>= Properties; -// for(int i = 0; i < Properties.getLength(); ++i) -// xRow->appendVoid(Properties[i]); -// aRet <<= Reference<XRow>(xRow.get()); -// return aRet; -// } - switch (action) { case NOACTION: @@ -318,7 +303,7 @@ Any SAL_CALL FTPContent::execute( const Command& aCommand, case THROWAUTHENTICATIONREQUEST: ucbhelper::cancelCommandExecution( - aRet, + aRet.get<css::uno::Exception>(), Reference<XCommandEnvironment>(nullptr)); break; @@ -341,9 +326,8 @@ Any SAL_CALL FTPContent::execute( const Command& aCommand, { InteractiveNetworkConnectException excep; excep.Server = m_aFTPURL.host(); - aRet <<= excep; ucbhelper::cancelCommandExecution( - aRet, + excep, Environment); break; } @@ -351,9 +335,8 @@ Any SAL_CALL FTPContent::execute( const Command& aCommand, { InteractiveNetworkResolveNameException excep; excep.Server = m_aFTPURL.host(); - aRet <<= excep; ucbhelper::cancelCommandExecution( - aRet, + excep, Environment); break; } @@ -385,11 +368,12 @@ Any SAL_CALL FTPContent::execute( const Command& aCommand, Sequence<Property> Properties; if(!(aCommand.Argument >>= Properties)) { - aRet <<= IllegalArgumentException( + ucbhelper::cancelCommandExecution( + IllegalArgumentException( "Wrong argument type!", static_cast< cppu::OWeakObject * >(this), - -1); - ucbhelper::cancelCommandExecution(aRet,Environment); + -1), + Environment); } aRet <<= getPropertyValues(Properties,Environment); @@ -399,11 +383,12 @@ Any SAL_CALL FTPContent::execute( const Command& aCommand, Sequence<PropertyValue> propertyValues; if( ! ( aCommand.Argument >>= propertyValues ) ) { - aRet <<= IllegalArgumentException( + ucbhelper::cancelCommandExecution( + IllegalArgumentException( "Wrong argument type!", static_cast< cppu::OWeakObject * >(this), - -1); - ucbhelper::cancelCommandExecution(aRet,Environment); + -1), + Environment); } aRet <<= setPropertyValues(propertyValues); @@ -420,11 +405,12 @@ Any SAL_CALL FTPContent::execute( const Command& aCommand, { InsertCommandArgument aInsertArgument; if ( ! ( aCommand.Argument >>= aInsertArgument ) ) { - aRet <<= IllegalArgumentException( + ucbhelper::cancelCommandExecution( + IllegalArgumentException( "Wrong argument type!", static_cast< cppu::OWeakObject * >(this), - -1); - ucbhelper::cancelCommandExecution(aRet,Environment); + -1), + Environment); } insert(aInsertArgument,Environment); } @@ -435,12 +421,12 @@ Any SAL_CALL FTPContent::execute( const Command& aCommand, else if(aCommand.Name == "open") { OpenCommandArgument2 aOpenCommand; if ( !( aCommand.Argument >>= aOpenCommand ) ) { - aRet <<= IllegalArgumentException( + ucbhelper::cancelCommandExecution( + IllegalArgumentException( "Wrong argument type!", static_cast< cppu::OWeakObject * >(this), - -1); - - ucbhelper::cancelCommandExecution(aRet,Environment); + -1), + Environment); } if(aOpenCommand.Mode == OpenMode::DOCUMENT) { @@ -491,11 +477,12 @@ Any SAL_CALL FTPContent::execute( const Command& aCommand, } } else { - aRet <<= UnsupportedDataSinkException( - OUString(), - static_cast< cppu::OWeakObject * >(this), - aOpenCommand.Sink); - ucbhelper::cancelCommandExecution(aRet,Environment); + ucbhelper::cancelCommandExecution( + UnsupportedDataSinkException( + OUString(), + static_cast< cppu::OWeakObject * >(this), + aOpenCommand.Sink), + Environment); } } else if(aOpenCommand.Mode == OpenMode::ALL || @@ -518,38 +505,39 @@ Any SAL_CALL FTPContent::execute( const Command& aCommand, aOpenCommand.Mode == OpenMode::DOCUMENT_SHARE_DENY_WRITE) { // Unsupported OpenMode - aRet <<= UnsupportedOpenModeException( - OUString(), - static_cast< cppu::OWeakObject * >(this), - static_cast< sal_Int16 >(aOpenCommand.Mode)); - ucbhelper::cancelCommandExecution(aRet,Environment); + ucbhelper::cancelCommandExecution( + UnsupportedOpenModeException( + OUString(), + static_cast< cppu::OWeakObject * >(this), + static_cast< sal_Int16 >(aOpenCommand.Mode)), + Environment); } else { - aRet <<= IllegalArgumentException( + ucbhelper::cancelCommandExecution( + IllegalArgumentException( "Unexpected OpenMode!", static_cast< cppu::OWeakObject * >(this), - -1); - - ucbhelper::cancelCommandExecution(aRet,Environment); + -1), + Environment); } } else if(aCommand.Name == "createNewContent") { ContentInfo aArg; if (!(aCommand.Argument >>= aArg)) { ucbhelper::cancelCommandExecution( - makeAny( - IllegalArgumentException( + IllegalArgumentException( "Wrong argument type!", static_cast< cppu::OWeakObject * >(this), - -1)), + -1), Environment); // Unreachable } aRet <<= createNewContent(aArg); } else { - aRet <<= UnsupportedCommandException( - aCommand.Name, - static_cast< cppu::OWeakObject * >(this)); - ucbhelper::cancelCommandExecution(aRet,Environment); + ucbhelper::cancelCommandExecution( + UnsupportedCommandException( + aCommand.Name, + static_cast< cppu::OWeakObject * >(this)), + Environment); } return aRet; @@ -688,7 +676,7 @@ void FTPContent::insert(const InsertCommandArgument& aInsertCommand, MissingPropertiesException excep; excep.Properties.realloc(1); excep.Properties[0] = "Title"; - ucbhelper::cancelCommandExecution(Any(excep), Env); + ucbhelper::cancelCommandExecution(excep, Env); } if(m_bInserted && @@ -696,7 +684,7 @@ void FTPContent::insert(const InsertCommandArgument& aInsertCommand, !aInsertCommand.Data.is()) { MissingInputStreamException excep; - ucbhelper::cancelCommandExecution(Any(excep), Env); + ucbhelper::cancelCommandExecution(excep, Env); } bool bReplace(aInsertCommand.ReplaceExisting); @@ -714,7 +702,7 @@ void FTPContent::insert(const InsertCommandArgument& aInsertCommand, // Deprecated, not used anymore: NameClashException excep; excep.Name = m_aFTPURL.child(); - ucbhelper::cancelCommandExecution(Any(excep), Env); + ucbhelper::cancelCommandExecution(excep, Env); } else if(e.code() == FOLDER_MIGHT_EXIST_DURING_INSERT || e.code() == FILE_MIGHT_EXIST_DURING_INSERT) { // Interact @@ -726,7 +714,7 @@ void FTPContent::insert(const InsertCommandArgument& aInsertCommand, excep.NameClash = 0; //NameClash::ERROR; if(!xInt.is()) { - ucbhelper::cancelCommandExecution(Any(excep), Env); + ucbhelper::cancelCommandExecution(excep, Env); } XInteractionRequestImpl request; diff --git a/ucb/source/ucp/gio/gio_content.cxx b/ucb/source/ucp/gio/gio_content.cxx index a6467d548b76..61d8c0aa83a0 100644 --- a/ucb/source/ucp/gio/gio_content.cxx +++ b/ucb/source/ucp/gio/gio_content.cxx @@ -139,13 +139,13 @@ OUString SAL_CALL Content::getContentType() #define EXCEPT(aExcept) \ do { \ - if (bThrow) throw aExcept;\ - aRet = uno::makeAny( aExcept );\ + aRet.reset(new aExcept); \ + if (bThrow) throw *aRet;\ } while(false) -uno::Any convertToException(GError *pError, const uno::Reference< uno::XInterface >& rContext, bool bThrow) +std::unique_ptr<uno::Exception> convertToException(GError *pError, const uno::Reference< uno::XInterface >& rContext, bool bThrow) { - uno::Any aRet; + std::unique_ptr<uno::Exception> aRet; gint eCode = pError->code; OUString sMessage(pError->message, strlen(pError->message), RTL_TEXTENCODING_UTF8); @@ -160,108 +160,88 @@ uno::Any convertToException(GError *pError, const uno::Reference< uno::XInterfac switch (eCode) { case G_IO_ERROR_FAILED: - { io::IOException aExcept(sMessage, rContext); - EXCEPT(aExcept); } + EXCEPT(io::IOException(sMessage, rContext)); break; case G_IO_ERROR_NOT_MOUNTED: - { ucb::InteractiveAugmentedIOException aExcept(sMessage, rContext, - task::InteractionClassification_ERROR, ucb::IOErrorCode_NOT_EXISTING_PATH, aArgs); - EXCEPT(aExcept); } + EXCEPT( ucb::InteractiveAugmentedIOException(sMessage, rContext, + task::InteractionClassification_ERROR, ucb::IOErrorCode_NOT_EXISTING_PATH, aArgs)); break; case G_IO_ERROR_NOT_FOUND: - { ucb::InteractiveAugmentedIOException aExcept(sMessage, rContext, - task::InteractionClassification_ERROR, ucb::IOErrorCode_NOT_EXISTING, aArgs); - EXCEPT(aExcept); } + EXCEPT( ucb::InteractiveAugmentedIOException(sMessage, rContext, + task::InteractionClassification_ERROR, ucb::IOErrorCode_NOT_EXISTING, aArgs)); break; case G_IO_ERROR_EXISTS: - { ucb::NameClashException aExcept(sMessage, rContext, - task::InteractionClassification_ERROR, sName); - EXCEPT(aExcept); } + EXCEPT( ucb::NameClashException(sMessage, rContext, + task::InteractionClassification_ERROR, sName)); break; case G_IO_ERROR_INVALID_ARGUMENT: - { lang::IllegalArgumentException aExcept(sMessage, rContext, -1 ); - EXCEPT(aExcept); } + EXCEPT( lang::IllegalArgumentException(sMessage, rContext, -1 ) ); break; case G_IO_ERROR_PERMISSION_DENIED: - { ucb::InteractiveAugmentedIOException aExcept(sMessage, rContext, - task::InteractionClassification_ERROR, ucb::IOErrorCode_ACCESS_DENIED, aArgs); - EXCEPT(aExcept); } + EXCEPT( ucb::InteractiveAugmentedIOException(sMessage, rContext, + task::InteractionClassification_ERROR, ucb::IOErrorCode_ACCESS_DENIED, aArgs)); break; case G_IO_ERROR_IS_DIRECTORY: - { ucb::InteractiveAugmentedIOException aExcept(sMessage, rContext, - task::InteractionClassification_ERROR, ucb::IOErrorCode_NO_FILE, aArgs); - EXCEPT(aExcept); } + EXCEPT( ucb::InteractiveAugmentedIOException(sMessage, rContext, + task::InteractionClassification_ERROR, ucb::IOErrorCode_NO_FILE, aArgs)); break; case G_IO_ERROR_NOT_REGULAR_FILE: - { ucb::InteractiveAugmentedIOException aExcept(sMessage, rContext, - task::InteractionClassification_ERROR, ucb::IOErrorCode_NO_FILE, aArgs); - EXCEPT(aExcept); } + EXCEPT( ucb::InteractiveAugmentedIOException(sMessage, rContext, + task::InteractionClassification_ERROR, ucb::IOErrorCode_NO_FILE, aArgs)); break; case G_IO_ERROR_NOT_DIRECTORY: - { ucb::InteractiveAugmentedIOException aExcept(sMessage, rContext, - task::InteractionClassification_ERROR, ucb::IOErrorCode_NO_DIRECTORY, aArgs); - EXCEPT(aExcept); } + EXCEPT( ucb::InteractiveAugmentedIOException(sMessage, rContext, + task::InteractionClassification_ERROR, ucb::IOErrorCode_NO_DIRECTORY, aArgs)); break; case G_IO_ERROR_FILENAME_TOO_LONG: - { ucb::InteractiveAugmentedIOException aExcept(sMessage, rContext, - task::InteractionClassification_ERROR, ucb::IOErrorCode_NAME_TOO_LONG, aArgs); - EXCEPT(aExcept); } + EXCEPT( ucb::InteractiveAugmentedIOException(sMessage, rContext, + task::InteractionClassification_ERROR, ucb::IOErrorCode_NAME_TOO_LONG, aArgs)); break; case G_IO_ERROR_PENDING: - { ucb::InteractiveAugmentedIOException aExcept(sMessage, rContext, - task::InteractionClassification_ERROR, ucb::IOErrorCode_PENDING, aArgs); - EXCEPT(aExcept); } + EXCEPT( ucb::InteractiveAugmentedIOException(sMessage, rContext, + task::InteractionClassification_ERROR, ucb::IOErrorCode_PENDING, aArgs)); break; case G_IO_ERROR_CLOSED: case G_IO_ERROR_CANCELLED: case G_IO_ERROR_TOO_MANY_LINKS: case G_IO_ERROR_WRONG_ETAG: - { ucb::InteractiveAugmentedIOException aExcept(sMessage, rContext, - task::InteractionClassification_ERROR, ucb::IOErrorCode_GENERAL, aArgs); - EXCEPT(aExcept); } + EXCEPT( ucb::InteractiveAugmentedIOException(sMessage, rContext, + task::InteractionClassification_ERROR, ucb::IOErrorCode_GENERAL, aArgs)); break; case G_IO_ERROR_NOT_SUPPORTED: case G_IO_ERROR_CANT_CREATE_BACKUP: case G_IO_ERROR_WOULD_MERGE: - { ucb::InteractiveAugmentedIOException aExcept(sMessage, rContext, - task::InteractionClassification_ERROR, ucb::IOErrorCode_NOT_SUPPORTED, aArgs); - EXCEPT(aExcept); } + EXCEPT( ucb::InteractiveAugmentedIOException(sMessage, rContext, + task::InteractionClassification_ERROR, ucb::IOErrorCode_NOT_SUPPORTED, aArgs)); break; case G_IO_ERROR_NO_SPACE: - { ucb::InteractiveAugmentedIOException aExcept(sMessage, rContext, - task::InteractionClassification_ERROR, ucb::IOErrorCode_OUT_OF_DISK_SPACE, aArgs); - EXCEPT(aExcept); } + EXCEPT( ucb::InteractiveAugmentedIOException(sMessage, rContext, + task::InteractionClassification_ERROR, ucb::IOErrorCode_OUT_OF_DISK_SPACE, aArgs)); break; case G_IO_ERROR_INVALID_FILENAME: - { ucb::InteractiveAugmentedIOException aExcept(sMessage, rContext, - task::InteractionClassification_ERROR, ucb::IOErrorCode_INVALID_CHARACTER, aArgs); - EXCEPT(aExcept); } + EXCEPT( ucb::InteractiveAugmentedIOException(sMessage, rContext, + task::InteractionClassification_ERROR, ucb::IOErrorCode_INVALID_CHARACTER, aArgs)); break; case G_IO_ERROR_READ_ONLY: - { ucb::InteractiveAugmentedIOException aExcept(sMessage, rContext, - task::InteractionClassification_ERROR, ucb::IOErrorCode_WRITE_PROTECTED, aArgs); - EXCEPT(aExcept); } + EXCEPT( ucb::InteractiveAugmentedIOException(sMessage, rContext, + task::InteractionClassification_ERROR, ucb::IOErrorCode_WRITE_PROTECTED, aArgs)); break; case G_IO_ERROR_TIMED_OUT: - { ucb::InteractiveAugmentedIOException aExcept(sMessage, rContext, - task::InteractionClassification_ERROR, ucb::IOErrorCode_DEVICE_NOT_READY, aArgs); - EXCEPT(aExcept); } + EXCEPT( ucb::InteractiveAugmentedIOException(sMessage, rContext, + task::InteractionClassification_ERROR, ucb::IOErrorCode_DEVICE_NOT_READY, aArgs)); break; case G_IO_ERROR_WOULD_RECURSE: - { ucb::InteractiveAugmentedIOException aExcept(sMessage, rContext, - task::InteractionClassification_ERROR, ucb::IOErrorCode_RECURSIVE, aArgs); - EXCEPT(aExcept); } + EXCEPT( ucb::InteractiveAugmentedIOException(sMessage, rContext, + task::InteractionClassification_ERROR, ucb::IOErrorCode_RECURSIVE, aArgs)); break; case G_IO_ERROR_BUSY: case G_IO_ERROR_WOULD_BLOCK: - { ucb::InteractiveAugmentedIOException aExcept(sMessage, rContext, - task::InteractionClassification_ERROR, ucb::IOErrorCode_LOCKING_VIOLATION, aArgs); - EXCEPT(aExcept); } + EXCEPT( ucb::InteractiveAugmentedIOException(sMessage, rContext, + task::InteractionClassification_ERROR, ucb::IOErrorCode_LOCKING_VIOLATION, aArgs)); break; case G_IO_ERROR_HOST_NOT_FOUND: - { ucb::InteractiveNetworkResolveNameException aExcept(sMessage, rContext, - task::InteractionClassification_ERROR, sHost); - EXCEPT(aExcept);} + EXCEPT( ucb::InteractiveNetworkResolveNameException(sMessage, rContext, + task::InteractionClassification_ERROR, sHost)); break; default: case G_IO_ERROR_ALREADY_MOUNTED: @@ -269,9 +249,8 @@ uno::Any convertToException(GError *pError, const uno::Reference< uno::XInterfac case G_IO_ERROR_NOT_SYMBOLIC_LINK: case G_IO_ERROR_NOT_MOUNTABLE_FILE: case G_IO_ERROR_FAILED_HANDLED: - { ucb::InteractiveNetworkGeneralException aExcept(sMessage, rContext, - task::InteractionClassification_ERROR); - EXCEPT(aExcept);} + EXCEPT( ucb::InteractiveNetworkGeneralException(sMessage, rContext, + task::InteractionClassification_ERROR)); break; } return aRet; @@ -300,19 +279,19 @@ void convertToIOException(GError *pError, const uno::Reference< uno::XInterface } } -uno::Any Content::mapGIOError( GError *pError ) +std::unique_ptr<uno::Exception> Content::mapGIOError( GError *pError ) { if (!pError) - return getBadArgExcept(); + return std::unique_ptr<uno::Exception>(new lang::IllegalArgumentException(getBadArgExcept())); return convertToException(pError, static_cast< cppu::OWeakObject * >(this), false); } -uno::Any Content::getBadArgExcept() +lang::IllegalArgumentException Content::getBadArgExcept() { - return uno::makeAny( lang::IllegalArgumentException( + return lang::IllegalArgumentException( "Wrong argument type!", - static_cast< cppu::OWeakObject * >( this ), -1) ); + static_cast< cppu::OWeakObject * >( this ), -1); } class MountOperation @@ -656,7 +635,7 @@ uno::Sequence< uno::Any > Content::setPropertyValues( else { if (!mbTransient) - ucbhelper::cancelCommandExecution(mapGIOError(pError), xEnv); + ucbhelper::cancelCommandExecution(*mapGIOError(pError), xEnv); else { if (pError) @@ -745,7 +724,7 @@ uno::Sequence< uno::Any > Content::setPropertyValues( if ((bOk = doSetFileInfo(pNewInfo))) { for (sal_Int32 i = 0; i < nChanged; ++i) - aRet[ i ] = getBadArgExcept(); + aRet[ i ] = uno::Any(getBadArgExcept()); } } @@ -859,13 +838,11 @@ uno::Any Content::open(const ucb::OpenCommandArgument2 & rOpenCommand, { uno::Sequence< uno::Any > aArgs( 1 ); aArgs[ 0 ] <<= m_xIdentifier->getContentIdentifier(); - uno::Any aErr = uno::makeAny( + ucbhelper::cancelCommandExecution( ucb::InteractiveAugmentedIOException(OUString(), static_cast< cppu::OWeakObject * >( this ), task::InteractionClassification_ERROR, - bIsFolder ? ucb::IOErrorCode_NOT_EXISTING_PATH : ucb::IOErrorCode_NOT_EXISTING, aArgs) - ); - - ucbhelper::cancelCommandExecution(aErr, xEnv); + bIsFolder ? ucb::IOErrorCode_NOT_EXISTING_PATH : ucb::IOErrorCode_NOT_EXISTING, aArgs), + xEnv); } uno::Any aRet; @@ -890,10 +867,10 @@ uno::Any Content::open(const ucb::OpenCommandArgument2 & rOpenCommand, ) { ucbhelper::cancelCommandExecution( - uno::makeAny ( ucb::UnsupportedOpenModeException + ucb::UnsupportedOpenModeException ( OUString(), static_cast< cppu::OWeakObject * >( this ), - sal_Int16( rOpenCommand.Mode ) ) ), - xEnv ); + sal_Int16( rOpenCommand.Mode ) ), + xEnv ); } if ( !feedSink( rOpenCommand.Sink, xEnv ) ) @@ -904,10 +881,10 @@ uno::Any Content::open(const ucb::OpenCommandArgument2 & rOpenCommand, SAL_WARN("ucb.ucp.gio", "Failed to load data from '" << m_xIdentifier->getContentIdentifier() << "'"); ucbhelper::cancelCommandExecution( - uno::makeAny (ucb::UnsupportedDataSinkException - ( OUString(), static_cast< cppu::OWeakObject * >( this ), - rOpenCommand.Sink ) ), - xEnv ); + ucb::UnsupportedDataSinkException( + OUString(), static_cast< cppu::OWeakObject * >( this ), + rOpenCommand.Sink ), + xEnv ); } } else @@ -984,7 +961,7 @@ uno::Any SAL_CALL Content::execute( { GError *pError = nullptr; if (!g_file_delete( getGFile(), nullptr, &pError)) - ucbhelper::cancelCommandExecution(mapGIOError(pError), xEnv); + ucbhelper::cancelCommandExecution(*mapGIOError(pError), xEnv); } destroy( bDeletePhysical ); @@ -994,9 +971,9 @@ uno::Any SAL_CALL Content::execute( SAL_WARN("ucb.ucp.gio", "Unknown command " << aCommand.Name << "\n"); ucbhelper::cancelCommandExecution - ( uno::makeAny( ucb::UnsupportedCommandException + ( ucb::UnsupportedCommandException ( OUString(), - static_cast< cppu::OWeakObject * >( this ) ) ), + static_cast< cppu::OWeakObject * >( this ) ), xEnv ); } @@ -1034,15 +1011,15 @@ void Content::insert(const uno::Reference< io::XInputStream > &xInputStream, { SAL_INFO("ucb.ucp.gio", "Make directory"); if( !g_file_make_directory( getGFile(), nullptr, &pError)) - ucbhelper::cancelCommandExecution(mapGIOError(pError), xEnv); + ucbhelper::cancelCommandExecution(*mapGIOError(pError), xEnv); return; } if ( !xInputStream.is() ) { - ucbhelper::cancelCommandExecution( uno::makeAny - ( ucb::MissingInputStreamException - ( OUString(), static_cast< cppu::OWeakObject * >( this ) ) ), + ucbhelper::cancelCommandExecution( + ucb::MissingInputStreamException + ( OUString(), static_cast< cppu::OWeakObject * >( this ) ), xEnv ); } @@ -1050,12 +1027,12 @@ void Content::insert(const uno::Reference< io::XInputStream > &xInputStream, if ( bReplaceExisting ) { if (!(pOutStream = g_file_replace(getGFile(), nullptr, false, G_FILE_CREATE_PRIVATE, nullptr, &pError))) - ucbhelper::cancelCommandExecution(mapGIOError(pError), xEnv); + ucbhelper::cancelCommandExecution(*mapGIOError(pError), xEnv); } else { if (!(pOutStream = g_file_create (getGFile(), G_FILE_CREATE_PRIVATE, nullptr, &pError))) - ucbhelper::cancelCommandExecution(mapGIOError(pError), xEnv); + ucbhelper::cancelCommandExecution(*mapGIOError(pError), xEnv); } uno::Reference < io::XOutputStream > xOutput = new ::gio::OutputStream(pOutStream); @@ -1094,7 +1071,7 @@ void Content::transfer( const ucb::TransferInfo& aTransferInfo, const uno::Refer g_object_unref(pSource); g_object_unref(pDest); if (!bSuccess) - ucbhelper::cancelCommandExecution(mapGIOError(pError), xEnv); + ucbhelper::cancelCommandExecution(*mapGIOError(pError), xEnv); } uno::Sequence< ucb::ContentInfo > Content::queryCreatableContentsInfo( diff --git a/ucb/source/ucp/gio/gio_content.hxx b/ucb/source/ucp/gio/gio_content.hxx index 366eb721f0c7..d76de9d1e832 100644 --- a/ucb/source/ucp/gio/gio_content.hxx +++ b/ucb/source/ucp/gio/gio_content.hxx @@ -53,7 +53,7 @@ namespace gio #define GIO_FILE_TYPE "application/vnd.sun.staroffice.gio-file" #define GIO_FOLDER_TYPE "application/vnd.sun.staroffice.gio-folder" -css::uno::Any convertToException(GError *pError, +std::unique_ptr<css::uno::Exception> convertToException(GError *pError, const css::uno::Reference< css::uno::XInterface >& rContext, bool bThrow=true); /// @throws css::io::IOException /// @throws css::uno::RuntimeException @@ -73,8 +73,8 @@ private: GError **ppError=nullptr); bool isFolder(const css::uno::Reference< css::ucb::XCommandEnvironment >& xEnv); - css::uno::Any mapGIOError( GError *error ); - css::uno::Any getBadArgExcept(); + std::unique_ptr<css::uno::Exception> mapGIOError( GError *error ); + css::lang::IllegalArgumentException getBadArgExcept(); css::uno::Reference< css::sdbc::XRow > getPropertyValues( diff --git a/ucb/source/ucp/hierarchy/hierarchycontent.cxx b/ucb/source/ucp/hierarchy/hierarchycontent.cxx index db8da992afde..08be7646aff8 100644 --- a/ucb/source/ucp/hierarchy/hierarchycontent.cxx +++ b/ucb/source/ucp/hierarchy/hierarchycontent.cxx @@ -342,10 +342,10 @@ uno::Any SAL_CALL HierarchyContent::execute( if ( !( aCommand.Argument >>= Properties ) ) { ucbhelper::cancelCommandExecution( - uno::makeAny( lang::IllegalArgumentException( + lang::IllegalArgumentException( "Wrong argument type!", static_cast< cppu::OWeakObject * >( this ), - -1 ) ), + -1 ), Environment ); // Unreachable } @@ -362,10 +362,10 @@ uno::Any SAL_CALL HierarchyContent::execute( if ( !( aCommand.Argument >>= aProperties ) ) { ucbhelper::cancelCommandExecution( - uno::makeAny( lang::IllegalArgumentException( + lang::IllegalArgumentException( "Wrong argument type!", static_cast< cppu::OWeakObject * >( this ), - -1 ) ), + -1 ), Environment ); // Unreachable } @@ -373,10 +373,10 @@ uno::Any SAL_CALL HierarchyContent::execute( if ( !aProperties.getLength() ) { ucbhelper::cancelCommandExecution( - uno::makeAny( lang::IllegalArgumentException( + lang::IllegalArgumentException( "No properties!", static_cast< cppu::OWeakObject * >( this ), - -1 ) ), + -1 ), Environment ); // Unreachable } @@ -409,10 +409,10 @@ uno::Any SAL_CALL HierarchyContent::execute( if ( !( aCommand.Argument >>= aOpenCommand ) ) { ucbhelper::cancelCommandExecution( - uno::makeAny( lang::IllegalArgumentException( + lang::IllegalArgumentException( "Wrong argument type!", static_cast< cppu::OWeakObject * >( this ), - -1 ) ), + -1 ), Environment ); // Unreachable } @@ -432,10 +432,10 @@ uno::Any SAL_CALL HierarchyContent::execute( if ( !( aCommand.Argument >>= aArg ) ) { ucbhelper::cancelCommandExecution( - uno::makeAny( lang::IllegalArgumentException( + lang::IllegalArgumentException( "Wrong argument type!", static_cast< cppu::OWeakObject * >( this ), - -1 ) ), + -1 ), Environment ); // Unreachable } @@ -491,10 +491,10 @@ uno::Any SAL_CALL HierarchyContent::execute( { OSL_FAIL( "Wrong argument type!" ); ucbhelper::cancelCommandExecution( - uno::makeAny( lang::IllegalArgumentException( + lang::IllegalArgumentException( "Wrong argument type!", static_cast< cppu::OWeakObject * >( this ), - -1 ) ), + -1 ), Environment ); // Unreachable } @@ -513,10 +513,10 @@ uno::Any SAL_CALL HierarchyContent::execute( { OSL_FAIL( "Wrong argument type!" ); ucbhelper::cancelCommandExecution( - uno::makeAny( lang::IllegalArgumentException( + lang::IllegalArgumentException( "Wrong argument type!", static_cast< cppu::OWeakObject * >( this ), - -1 ) ), + -1 ), Environment ); // Unreachable } @@ -530,9 +530,9 @@ uno::Any SAL_CALL HierarchyContent::execute( ucbhelper::cancelCommandExecution( - uno::makeAny( ucb::UnsupportedCommandException( + ucb::UnsupportedCommandException( OUString(), - static_cast< cppu::OWeakObject * >( this ) ) ), + static_cast< cppu::OWeakObject * >( this ) ), Environment ); // Unreachable } @@ -1357,9 +1357,9 @@ void HierarchyContent::insert( sal_Int32 nNameClashResolve, if ( m_eKind == ROOT ) { ucbhelper::cancelCommandExecution( - uno::makeAny( ucb::UnsupportedCommandException( + ucb::UnsupportedCommandException( "Not supported by root folder!", - static_cast< cppu::OWeakObject * >( this ) ) ), + static_cast< cppu::OWeakObject * >( this ) ), xEnv ); // Unreachable } @@ -1369,10 +1369,10 @@ void HierarchyContent::insert( sal_Int32 nNameClashResolve, { uno::Sequence<OUString> aProps { "Title" }; ucbhelper::cancelCommandExecution( - uno::makeAny( ucb::MissingPropertiesException( + ucb::MissingPropertiesException( OUString(), static_cast< cppu::OWeakObject * >( this ), - aProps ) ), + aProps ), xEnv ); // Unreachable } @@ -1391,12 +1391,11 @@ void HierarchyContent::insert( sal_Int32 nNameClashResolve, if ( hasData( xId ) ) { ucbhelper::cancelCommandExecution( - uno::makeAny( ucb::NameClashException( OUString(), static_cast< cppu::OWeakObject * >( this ), task::InteractionClassification_ERROR, - m_aProps.getTitle() ) ), + m_aProps.getTitle() ), xEnv ); // Unreachable } @@ -1424,11 +1423,10 @@ void HierarchyContent::insert( sal_Int32 nNameClashResolve, if ( nTry == 1000 ) { ucbhelper::cancelCommandExecution( - uno::makeAny( ucb::UnsupportedNameClashException( "Unable to resolve name clash!", static_cast< cppu::OWeakObject * >( this ), - nNameClashResolve ) ), + nNameClashResolve ), xEnv ); // Unreachable } @@ -1448,11 +1446,10 @@ void HierarchyContent::insert( sal_Int32 nNameClashResolve, if ( hasData( xId ) ) { ucbhelper::cancelCommandExecution( - uno::makeAny( - ucb::UnsupportedNameClashException( + ucb::UnsupportedNameClashException( OUString(), static_cast< cppu::OWeakObject * >( this ), - nNameClashResolve ) ), + nNameClashResolve ), xEnv ); // Unreachable } @@ -1506,9 +1503,9 @@ void HierarchyContent::destroy( bool bDeletePhysical, if ( m_eState != PERSISTENT ) { ucbhelper::cancelCommandExecution( - uno::makeAny( ucb::UnsupportedCommandException( + ucb::UnsupportedCommandException( "Not persistent!", - static_cast< cppu::OWeakObject * >( this ) ) ), + static_cast< cppu::OWeakObject * >( this ) ), xEnv ); // Unreachable } @@ -1517,9 +1514,9 @@ void HierarchyContent::destroy( bool bDeletePhysical, if ( m_eKind == ROOT ) { ucbhelper::cancelCommandExecution( - uno::makeAny( ucb::UnsupportedCommandException( + ucb::UnsupportedCommandException( "Not supported by root folder!", - static_cast< cppu::OWeakObject * >( this ) ) ), + static_cast< cppu::OWeakObject * >( this ) ), xEnv ); // Unreachable } @@ -1558,9 +1555,9 @@ void HierarchyContent::transfer( if ( m_eState != PERSISTENT ) { ucbhelper::cancelCommandExecution( - uno::makeAny( ucb::UnsupportedCommandException( + ucb::UnsupportedCommandException( "Not persistent!", - static_cast< cppu::OWeakObject * >( this ) ) ), + static_cast< cppu::OWeakObject * >( this ) ), xEnv ); // Unreachable } @@ -1569,9 +1566,9 @@ void HierarchyContent::transfer( if ( !rInfo.SourceURL.startsWith( HIERARCHY_URL_SCHEME ":/" ) ) { ucbhelper::cancelCommandExecution( - uno::makeAny( ucb::InteractiveBadTransferURLException( + ucb::InteractiveBadTransferURLException( OUString(), - static_cast< cppu::OWeakObject * >( this ) ) ), + static_cast< cppu::OWeakObject * >( this ) ), xEnv ); // Unreachable } diff --git a/ucb/source/ucp/package/pkgcontent.cxx b/ucb/source/ucp/package/pkgcontent.cxx index 2fe01f03aff3..6f179a8d17ee 100644 --- a/ucb/source/ucp/package/pkgcontent.cxx +++ b/ucb/source/ucp/package/pkgcontent.cxx @@ -437,10 +437,10 @@ uno::Any SAL_CALL Content::execute( if ( !( aCommand.Argument >>= Properties ) ) { ucbhelper::cancelCommandExecution( - uno::makeAny( lang::IllegalArgumentException( + lang::IllegalArgumentException( "Wrong argument type!", static_cast< cppu::OWeakObject * >( this ), - -1 ) ), + -1 ), Environment ); // Unreachable } @@ -457,10 +457,10 @@ uno::Any SAL_CALL Content::execute( if ( !( aCommand.Argument >>= aProperties ) ) { ucbhelper::cancelCommandExecution( - uno::makeAny( lang::IllegalArgumentException( + lang::IllegalArgumentException( "Wrong argument type!", static_cast< cppu::OWeakObject * >( this ), - -1 ) ), + -1 ), Environment ); // Unreachable } @@ -468,10 +468,10 @@ uno::Any SAL_CALL Content::execute( if ( !aProperties.getLength() ) { ucbhelper::cancelCommandExecution( - uno::makeAny( lang::IllegalArgumentException( + lang::IllegalArgumentException( "No properties!", static_cast< cppu::OWeakObject * >( this ), - -1 ) ), + -1 ), Environment ); // Unreachable } @@ -506,10 +506,10 @@ uno::Any SAL_CALL Content::execute( if ( !( aCommand.Argument >>= aOpenCommand ) ) { ucbhelper::cancelCommandExecution( - uno::makeAny( lang::IllegalArgumentException( + lang::IllegalArgumentException( "Wrong argument type!", static_cast< cppu::OWeakObject * >( this ), - -1 ) ), + -1 ), Environment ); // Unreachable } @@ -526,10 +526,10 @@ uno::Any SAL_CALL Content::execute( if ( !( aCommand.Argument >>= aArg ) ) { ucbhelper::cancelCommandExecution( - uno::makeAny( lang::IllegalArgumentException( + lang::IllegalArgumentException( "Wrong argument type!", static_cast< cppu::OWeakObject * >( this ), - -1 ) ), + -1 ), Environment ); // Unreachable } @@ -583,10 +583,10 @@ uno::Any SAL_CALL Content::execute( if ( !( aCommand.Argument >>= aInfo ) ) { ucbhelper::cancelCommandExecution( - uno::makeAny( lang::IllegalArgumentException( + lang::IllegalArgumentException( "Wrong argument type!", static_cast< cppu::OWeakObject * >( this ), - -1 ) ), + -1 ), Environment ); // Unreachable } @@ -605,10 +605,10 @@ uno::Any SAL_CALL Content::execute( { OSL_FAIL( "Wrong argument type!" ); ucbhelper::cancelCommandExecution( - uno::makeAny( lang::IllegalArgumentException( + lang::IllegalArgumentException( "Wrong argument type!", static_cast< cppu::OWeakObject * >( this ), - -1 ) ), + -1 ), Environment ); // Unreachable } @@ -648,9 +648,9 @@ uno::Any SAL_CALL Content::execute( ucbhelper::cancelCommandExecution( - uno::makeAny( ucb::UnsupportedCommandException( + ucb::UnsupportedCommandException( OUString(), - static_cast< cppu::OWeakObject * >( this ) ) ), + static_cast< cppu::OWeakObject * >( this ) ), Environment ); // Unreachable } @@ -1418,10 +1418,10 @@ uno::Any Content::open( { // Currently(?) unsupported. ucbhelper::cancelCommandExecution( - uno::makeAny( ucb::UnsupportedOpenModeException( + ucb::UnsupportedOpenModeException( OUString(), static_cast< cppu::OWeakObject * >( this ), - sal_Int16( rArg.Mode ) ) ), + sal_Int16( rArg.Mode ) ), xEnv ); // Unreachable } @@ -1522,11 +1522,10 @@ uno::Any Content::open( // implementation. Support for this type of // sink is optional... ucbhelper::cancelCommandExecution( - uno::makeAny( - ucb::UnsupportedDataSinkException( + ucb::UnsupportedDataSinkException( OUString(), static_cast< cppu::OWeakObject * >( this ), - rArg.Sink ) ), + rArg.Sink ), xEnv ); // Unreachable } @@ -1559,9 +1558,9 @@ void Content::insert( if ( !xStream.is() ) { ucbhelper::cancelCommandExecution( - uno::makeAny( ucb::MissingInputStreamException( + ucb::MissingInputStreamException( OUString(), - static_cast< cppu::OWeakObject * >( this ) ) ), + static_cast< cppu::OWeakObject * >( this ) ), xEnv ); // Unreachable } @@ -1586,11 +1585,11 @@ void Content::insert( if ( hasData( aNewUri ) ) { ucbhelper::cancelCommandExecution( - uno::makeAny( ucb::NameClashException( + ucb::NameClashException( OUString(), static_cast< cppu::OWeakObject * >( this ), task::InteractionClassification_ERROR, - m_aProps.aTitle ) ), + m_aProps.aTitle ), xEnv ); // Unreachable } @@ -1618,12 +1617,11 @@ void Content::insert( if ( nTry == 1000 ) { ucbhelper::cancelCommandExecution( - uno::makeAny( - ucb::UnsupportedNameClashException( + ucb::UnsupportedNameClashException( "Unable to resolve name clash!", static_cast< cppu::OWeakObject * >( this ), - nNameClashResolve ) ), - xEnv ); + nNameClashResolve ), + xEnv ); // Unreachable } else @@ -1640,11 +1638,10 @@ void Content::insert( if ( hasData( aNewUri ) ) { ucbhelper::cancelCommandExecution( - uno::makeAny( - ucb::UnsupportedNameClashException( + ucb::UnsupportedNameClashException( OUString(), static_cast< cppu::OWeakObject * >( this ), - nNameClashResolve ) ), + nNameClashResolve ), xEnv ); // Unreachable } @@ -1709,9 +1706,9 @@ void Content::destroy( if ( m_eState != PERSISTENT ) { ucbhelper::cancelCommandExecution( - uno::makeAny( ucb::UnsupportedCommandException( + ucb::UnsupportedCommandException( "Not persistent!", - static_cast< cppu::OWeakObject * >( this ) ) ), + static_cast< cppu::OWeakObject * >( this ) ), xEnv ); // Unreachable } @@ -1750,9 +1747,9 @@ void Content::transfer( if ( m_eState != PERSISTENT ) { ucbhelper::cancelCommandExecution( - uno::makeAny( ucb::UnsupportedCommandException( + ucb::UnsupportedCommandException( "Not persistent!", - static_cast< cppu::OWeakObject * >( this ) ) ), + static_cast< cppu::OWeakObject * >( this ) ), xEnv ); // Unreachable } @@ -1763,9 +1760,9 @@ void Content::transfer( m_aUri.getUri(), PACKAGE_URL_SCHEME_LENGTH + 3 ) != 0 ) ) { ucbhelper::cancelCommandExecution( - uno::makeAny( ucb::InteractiveBadTransferURLException( + ucb::InteractiveBadTransferURLException( OUString(), - static_cast< cppu::OWeakObject * >( this ) ) ), + static_cast< cppu::OWeakObject * >( this ) ), xEnv ); // Unreachable } diff --git a/ucb/source/ucp/tdoc/tdoc_content.cxx b/ucb/source/ucp/tdoc/tdoc_content.cxx index 39fec06b4f24..fdf63317df44 100644 --- a/ucb/source/ucp/tdoc/tdoc_content.cxx +++ b/ucb/source/ucp/tdoc/tdoc_content.cxx @@ -362,10 +362,10 @@ uno::Any SAL_CALL Content::execute( if ( !( aCommand.Argument >>= Properties ) ) { ucbhelper::cancelCommandExecution( - uno::makeAny( lang::IllegalArgumentException( + lang::IllegalArgumentException( "Wrong argument type!", static_cast< cppu::OWeakObject * >( this ), - -1 ) ), + -1 ), Environment ); // Unreachable } @@ -382,10 +382,10 @@ uno::Any SAL_CALL Content::execute( if ( !( aCommand.Argument >>= aProperties ) ) { ucbhelper::cancelCommandExecution( - uno::makeAny( lang::IllegalArgumentException( + lang::IllegalArgumentException( "Wrong argument type!", static_cast< cppu::OWeakObject * >( this ), - -1 ) ), + -1 ), Environment ); // Unreachable } @@ -393,10 +393,10 @@ uno::Any SAL_CALL Content::execute( if ( !aProperties.getLength() ) { ucbhelper::cancelCommandExecution( - uno::makeAny( lang::IllegalArgumentException( + lang::IllegalArgumentException( "No properties!", static_cast< cppu::OWeakObject * >( this ), - -1 ) ), + -1 ), Environment ); // Unreachable } @@ -429,10 +429,10 @@ uno::Any SAL_CALL Content::execute( if ( !( aCommand.Argument >>= aOpenCommand ) ) { ucbhelper::cancelCommandExecution( - uno::makeAny( lang::IllegalArgumentException( + lang::IllegalArgumentException( "Wrong argument type!", static_cast< cppu::OWeakObject * >( this ), - -1 ) ), + -1 ), Environment ); // Unreachable } @@ -449,10 +449,10 @@ uno::Any SAL_CALL Content::execute( if ( ( eType != FOLDER ) && ( eType != STREAM ) ) { ucbhelper::cancelCommandExecution( - uno::makeAny( ucb::UnsupportedCommandException( + ucb::UnsupportedCommandException( "insert command only supported by " "folders and streams!", - static_cast< cppu::OWeakObject * >( this ) ) ), + static_cast< cppu::OWeakObject * >( this ) ), Environment ); // Unreachable } @@ -464,12 +464,12 @@ uno::Any SAL_CALL Content::execute( if ( aParentUri.isDocument() ) { ucbhelper::cancelCommandExecution( - uno::makeAny( ucb::UnsupportedCommandException( + ucb::UnsupportedCommandException( "insert command not supported by " "streams that are direct children " "of document root!", static_cast< cppu::OWeakObject * >( - this ) ) ), + this ) ), Environment ); // Unreachable } @@ -479,10 +479,10 @@ uno::Any SAL_CALL Content::execute( if ( !( aCommand.Argument >>= aArg ) ) { ucbhelper::cancelCommandExecution( - uno::makeAny( lang::IllegalArgumentException( + lang::IllegalArgumentException( "Wrong argument type!", static_cast< cppu::OWeakObject * >( this ), - -1 ) ), + -1 ), Environment ); // Unreachable } @@ -505,11 +505,11 @@ uno::Any SAL_CALL Content::execute( if ( ( eType != FOLDER ) && ( eType != STREAM ) ) { ucbhelper::cancelCommandExecution( - uno::makeAny( ucb::UnsupportedCommandException( + ucb::UnsupportedCommandException( "delete command only supported by " "folders and streams!", static_cast< cppu::OWeakObject * >( - this ) ) ), + this ) ), Environment ); // Unreachable } @@ -555,11 +555,11 @@ uno::Any SAL_CALL Content::execute( if ( ( eType != FOLDER ) && ( eType != DOCUMENT ) ) { ucbhelper::cancelCommandExecution( - uno::makeAny( ucb::UnsupportedCommandException( + ucb::UnsupportedCommandException( "transfer command only supported " "by folders and documents!", static_cast< cppu::OWeakObject * >( - this ) ) ), + this ) ), Environment ); // Unreachable } @@ -570,10 +570,10 @@ uno::Any SAL_CALL Content::execute( { OSL_FAIL( "Wrong argument type!" ); ucbhelper::cancelCommandExecution( - uno::makeAny( lang::IllegalArgumentException( + lang::IllegalArgumentException( "Wrong argument type!", static_cast< cppu::OWeakObject * >( this ), - -1 ) ), + -1 ), Environment ); // Unreachable } @@ -593,12 +593,12 @@ uno::Any SAL_CALL Content::execute( if ( ( eType != FOLDER ) && ( eType != DOCUMENT ) ) { ucbhelper::cancelCommandExecution( - uno::makeAny( ucb::UnsupportedCommandException( + ucb::UnsupportedCommandException( "createNewContent command only " "supported by folders and " "documents!", static_cast< cppu::OWeakObject * >( - this ) ) ), + this ) ), Environment ); // Unreachable } @@ -609,10 +609,10 @@ uno::Any SAL_CALL Content::execute( { OSL_FAIL( "Wrong argument type!" ); ucbhelper::cancelCommandExecution( - uno::makeAny( lang::IllegalArgumentException( + lang::IllegalArgumentException( "Wrong argument type!", static_cast< cppu::OWeakObject * >( this ), - -1 ) ), + -1 ), Environment ); // Unreachable } @@ -626,9 +626,9 @@ uno::Any SAL_CALL Content::execute( ucbhelper::cancelCommandExecution( - uno::makeAny( ucb::UnsupportedCommandException( + ucb::UnsupportedCommandException( OUString(), - static_cast< cppu::OWeakObject * >( this ) ) ), + static_cast< cppu::OWeakObject * >( this ) ), Environment ); // Unreachable } @@ -1391,10 +1391,10 @@ uno::Any Content::open( { // Currently(?) unsupported. ucbhelper::cancelCommandExecution( - uno::makeAny( ucb::UnsupportedOpenModeException( + ucb::UnsupportedOpenModeException( OUString(), static_cast< cppu::OWeakObject * >( this ), - sal_Int16( rArg.Mode ) ) ), + sal_Int16( rArg.Mode ) ), xEnv ); // Unreachable } @@ -1530,11 +1530,10 @@ uno::Any Content::open( else { ucbhelper::cancelCommandExecution( - uno::makeAny( - ucb::UnsupportedDataSinkException( + ucb::UnsupportedDataSinkException( OUString(), static_cast< cppu::OWeakObject * >( this ), - rArg.Sink ) ), + rArg.Sink ), xEnv ); // Unreachable } @@ -1585,9 +1584,9 @@ void Content::insert( const uno::Reference< io::XInputStream >& xData, if ( !xData.is() ) { ucbhelper::cancelCommandExecution( - uno::makeAny( ucb::MissingInputStreamException( + ucb::MissingInputStreamException( OUString(), - static_cast< cppu::OWeakObject * >( this ) ) ), + static_cast< cppu::OWeakObject * >( this ) ), xEnv ); // Unreachable } @@ -1610,11 +1609,11 @@ void Content::insert( const uno::Reference< io::XInputStream >& xData, if ( hasData( aNewUri ) ) { ucbhelper::cancelCommandExecution( - uno::makeAny( ucb::NameClashException( + ucb::NameClashException( OUString(), static_cast< cppu::OWeakObject * >( this ), task::InteractionClassification_ERROR, - m_aProps.getTitle() ) ), + m_aProps.getTitle() ), xEnv ); // Unreachable } @@ -1642,11 +1641,10 @@ void Content::insert( const uno::Reference< io::XInputStream >& xData, if ( nTry == 1000 ) { ucbhelper::cancelCommandExecution( - uno::makeAny( ucb::UnsupportedNameClashException( "Unable to resolve name clash!", static_cast< cppu::OWeakObject * >( this ), - nNameClashResolve ) ), + nNameClashResolve ), xEnv ); // Unreachable } @@ -1666,11 +1664,10 @@ void Content::insert( const uno::Reference< io::XInputStream >& xData, if ( hasData( aNewUri ) ) { ucbhelper::cancelCommandExecution( - uno::makeAny( - ucb::UnsupportedNameClashException( + ucb::UnsupportedNameClashException( OUString(), static_cast< cppu::OWeakObject * >( this ), - nNameClashResolve ) ), + nNameClashResolve ), xEnv ); // Unreachable } @@ -1735,9 +1732,9 @@ void Content::destroy( bool bDeletePhysical, if ( m_eState != PERSISTENT ) { ucbhelper::cancelCommandExecution( - uno::makeAny( ucb::UnsupportedCommandException( + ucb::UnsupportedCommandException( "Not persistent!", - static_cast< cppu::OWeakObject * >( this ) ) ), + static_cast< cppu::OWeakObject * >( this ) ), xEnv ); // Unreachable } @@ -1874,9 +1871,9 @@ void Content::transfer( if ( m_eState != PERSISTENT ) { ucbhelper::cancelCommandExecution( - uno::makeAny( ucb::UnsupportedCommandException( + ucb::UnsupportedCommandException( "Not persistent!", - static_cast< cppu::OWeakObject * >( this ) ) ), + static_cast< cppu::OWeakObject * >( this ) ), xEnv ); // Unreachable } @@ -1887,9 +1884,9 @@ void Content::transfer( { // Invalid length (to short). ucbhelper::cancelCommandExecution( - uno::makeAny( ucb::InteractiveBadTransferURLException( + ucb::InteractiveBadTransferURLException( OUString(), - static_cast< cppu::OWeakObject * >( this ) ) ), + static_cast< cppu::OWeakObject * >( this ) ), xEnv ); // Unreachable } @@ -1901,9 +1898,9 @@ void Content::transfer( { // Invalid scheme. ucbhelper::cancelCommandExecution( - uno::makeAny( ucb::InteractiveBadTransferURLException( + ucb::InteractiveBadTransferURLException( OUString(), - static_cast< cppu::OWeakObject * >( this ) ) ), + static_cast< cppu::OWeakObject * >( this ) ), xEnv ); // Unreachable } @@ -1913,10 +1910,10 @@ void Content::transfer( if ( !aSourceUri.isValid() ) { ucbhelper::cancelCommandExecution( - uno::makeAny( lang::IllegalArgumentException( + lang::IllegalArgumentException( "Invalid source URI! Syntax!", static_cast< cppu::OWeakObject * >( this ), - -1 ) ), + -1 ), xEnv ); // Unreachable } @@ -1924,10 +1921,10 @@ void Content::transfer( if ( aSourceUri.isRoot() || aSourceUri.isDocument() ) { ucbhelper::cancelCommandExecution( - uno::makeAny( lang::IllegalArgumentException( + lang::IllegalArgumentException( "Invalid source URI! Must describe a folder or stream!", static_cast< cppu::OWeakObject * >( this ), - -1 ) ), + -1 ), xEnv ); // Unreachable } @@ -1975,13 +1972,13 @@ void Content::transfer( if ( xStorage->isStreamElement( aSourceUri.getDecodedName() ) ) { ucbhelper::cancelCommandExecution( - uno::makeAny( lang::IllegalArgumentException( + lang::IllegalArgumentException( "Invalid source URI! " "Streams cannot be created as " "children of document root!", static_cast< cppu::OWeakObject * >( this ), - -1 ) ), + -1 ), xEnv ); // Unreachable } @@ -2004,10 +2001,10 @@ void Content::transfer( if ( !bOK ) { ucbhelper::cancelCommandExecution( - uno::makeAny( lang::IllegalArgumentException( + lang::IllegalArgumentException( "Invalid source URI! Unable to determine source type!", static_cast< cppu::OWeakObject * >( this ), - -1 ) ), + -1 ), xEnv ); // Unreachable } diff --git a/ucb/source/ucp/webdav-neon/webdavcontent.cxx b/ucb/source/ucp/webdav-neon/webdavcontent.cxx index c825798aaa76..b82ddde4e7ce 100644 --- a/ucb/source/ucp/webdav-neon/webdavcontent.cxx +++ b/ucb/source/ucp/webdav-neon/webdavcontent.cxx @@ -39,6 +39,7 @@ #include <rtl/uri.hxx> #include <rtl/ustrbuf.hxx> #include <officecfg/Inet.hxx> +#include <o3tl/make_unique.hxx> #include <ucbhelper/contentidentifier.hxx> #include <ucbhelper/propertyvalueset.hxx> #include <ucbhelper/simpleinteractionrequest.hxx> @@ -507,10 +508,10 @@ uno::Any SAL_CALL Content::execute( if ( !( aCommand.Argument >>= Properties ) ) { ucbhelper::cancelCommandExecution( - uno::makeAny( lang::IllegalArgumentException( + lang::IllegalArgumentException( "Wrong argument type!", static_cast< cppu::OWeakObject * >( this ), - -1 ) ), + -1 ), Environment ); // Unreachable } @@ -527,10 +528,10 @@ uno::Any SAL_CALL Content::execute( if ( !( aCommand.Argument >>= aProperties ) ) { ucbhelper::cancelCommandExecution( - uno::makeAny( lang::IllegalArgumentException( + lang::IllegalArgumentException( "Wrong argument type!", static_cast< cppu::OWeakObject * >( this ), - -1 ) ), + -1 ), Environment ); // Unreachable } @@ -538,10 +539,10 @@ uno::Any SAL_CALL Content::execute( if ( !aProperties.getLength() ) { ucbhelper::cancelCommandExecution( - uno::makeAny( lang::IllegalArgumentException( + lang::IllegalArgumentException( "No properties!", static_cast< cppu::OWeakObject * >( this ), - -1 ) ), + -1 ), Environment ); // Unreachable } @@ -578,10 +579,10 @@ uno::Any SAL_CALL Content::execute( if ( !( aCommand.Argument >>= aTmp ) ) { ucbhelper::cancelCommandExecution( - uno::makeAny( lang::IllegalArgumentException( + lang::IllegalArgumentException( "Wrong argument type!", static_cast< cppu::OWeakObject * >( this ), - -1 ) ), + -1 ), Environment ); // Unreachable } @@ -608,10 +609,10 @@ uno::Any SAL_CALL Content::execute( if ( !( aCommand.Argument >>= arg ) ) { ucbhelper::cancelCommandExecution( - uno::makeAny( lang::IllegalArgumentException( + lang::IllegalArgumentException( "Wrong argument type!", static_cast< cppu::OWeakObject * >( this ), - -1 ) ), + -1 ), Environment ); // Unreachable } @@ -672,10 +673,10 @@ uno::Any SAL_CALL Content::execute( if ( !( aCommand.Argument >>= transferArgs ) ) { ucbhelper::cancelCommandExecution( - uno::makeAny( lang::IllegalArgumentException( + lang::IllegalArgumentException( "Wrong argument type!", static_cast< cppu::OWeakObject * >( this ), - -1 ) ), + -1 ), Environment ); // Unreachable } @@ -692,10 +693,10 @@ uno::Any SAL_CALL Content::execute( if ( !( aCommand.Argument >>= aArg ) ) { ucbhelper::cancelCommandExecution( - uno::makeAny( lang::IllegalArgumentException( + lang::IllegalArgumentException( "Wrong argument type!", static_cast< cppu::OWeakObject * >( this ), - -1 ) ), + -1 ), Environment ); // Unreachable } @@ -741,10 +742,10 @@ uno::Any SAL_CALL Content::execute( if ( !( aCommand.Argument >>= aArg ) ) { ucbhelper::cancelCommandExecution( - uno::makeAny( lang::IllegalArgumentException( + lang::IllegalArgumentException( "Wrong argument type!", static_cast< cppu::OWeakObject * >( this ), - -1 ) ), + -1 ), Environment ); // Unreachable } @@ -757,10 +758,10 @@ uno::Any SAL_CALL Content::execute( if ( !( aCommand.Argument >>= aPropArg )) { ucbhelper::cancelCommandExecution( - uno::makeAny( lang::IllegalArgumentException( + lang::IllegalArgumentException( "Wrong argument type!", static_cast< cppu::OWeakObject * >( this ), - -1 ) ), + -1 ), Environment ); } @@ -772,15 +773,15 @@ uno::Any SAL_CALL Content::execute( } catch ( const beans::PropertyExistException &e ) { - ucbhelper::cancelCommandExecution( uno::makeAny( e ), Environment ); + ucbhelper::cancelCommandExecution( e, Environment ); } catch ( const beans::IllegalTypeException&e ) { - ucbhelper::cancelCommandExecution( uno::makeAny( e ), Environment ); + ucbhelper::cancelCommandExecution( e, Environment ); } catch ( const lang::IllegalArgumentException&e ) { - ucbhelper::cancelCommandExecution( uno::makeAny( e ), Environment ); + ucbhelper::cancelCommandExecution( e, Environment ); } } else if ( aCommand.Name == "removeProperty" ) @@ -789,10 +790,10 @@ uno::Any SAL_CALL Content::execute( if ( !( aCommand.Argument >>= sPropName ) ) { ucbhelper::cancelCommandExecution( - uno::makeAny( lang::IllegalArgumentException( + lang::IllegalArgumentException( "Wrong argument type!", static_cast< cppu::OWeakObject * >( this ), - -1 ) ), + -1 ), Environment ); } @@ -804,11 +805,11 @@ uno::Any SAL_CALL Content::execute( } catch( const beans::UnknownPropertyException &e ) { - ucbhelper::cancelCommandExecution( uno::makeAny( e ), Environment ); + ucbhelper::cancelCommandExecution( e, Environment ); } catch( const beans::NotRemoveableException &e ) { - ucbhelper::cancelCommandExecution( uno::makeAny( e ), Environment ); + ucbhelper::cancelCommandExecution( e, Environment ); } } else @@ -818,9 +819,9 @@ uno::Any SAL_CALL Content::execute( ucbhelper::cancelCommandExecution( - uno::makeAny( ucb::UnsupportedCommandException( + ucb::UnsupportedCommandException( aCommand.Name, - static_cast< cppu::OWeakObject * >( this ) ) ), + static_cast< cppu::OWeakObject * >( this ) ), Environment ); // Unreachable } @@ -2132,7 +2133,8 @@ uno::Sequence< uno::Any > Content::setPropertyValues( aNewTitle.clear(); // Set error . - aRet[ nTitlePos ] = MapDAVException( e, true ); + auto ex = MapDAVException( e, true ); + aRet[ nTitlePos ] = makeAny(*ex); } } @@ -2201,11 +2203,10 @@ uno::Any Content::open( } ucbhelper::cancelCommandExecution( - uno::makeAny( - lang::IllegalArgumentException( + lang::IllegalArgumentException( aMsg.makeStringAndClear(), static_cast< cppu::OWeakObject * >( this ), - -1 ) ), + -1 ), xEnv ); // Unreachable } @@ -2220,11 +2221,10 @@ uno::Any Content::open( { // Currently(?) unsupported. ucbhelper::cancelCommandExecution( - uno::makeAny( - ucb::UnsupportedOpenModeException( + ucb::UnsupportedOpenModeException( OUString(), static_cast< cppu::OWeakObject * >( this ), - sal_Int16( rArg.Mode ) ) ), + sal_Int16( rArg.Mode ) ), xEnv ); // Unreachable } @@ -2346,11 +2346,10 @@ uno::Any Content::open( // implementation. Support for this type of // sink is optional... ucbhelper::cancelCommandExecution( - uno::makeAny( - ucb::UnsupportedDataSinkException( + ucb::UnsupportedDataSinkException( OUString(), static_cast< cppu::OWeakObject * >( this ), - rArg.Sink ) ), + rArg.Sink ), xEnv ); // Unreachable } @@ -2433,11 +2432,10 @@ void Content::post( else { ucbhelper::cancelCommandExecution( - uno::makeAny( - ucb::UnsupportedDataSinkException( + ucb::UnsupportedDataSinkException( OUString(), static_cast< cppu::OWeakObject * >( this ), - rArg.Sink ) ), + rArg.Sink ), xEnv ); // Unreachable } @@ -2522,10 +2520,10 @@ void Content::insert( uno::Sequence<OUString> aProps { "Title" }; ucbhelper::cancelCommandExecution( - uno::makeAny( ucb::MissingPropertiesException( + ucb::MissingPropertiesException( OUString(), static_cast< cppu::OWeakObject * >( this ), - aProps ) ), + aProps ), Environment ); // Unreachable } @@ -2694,12 +2692,11 @@ void Content::insert( } ucbhelper::cancelCommandExecution( - uno::makeAny( - ucb::NameClashException( + ucb::NameClashException( OUString(), static_cast< cppu::OWeakObject * >( this ), task::InteractionClassification_ERROR, - aTitle ) ), + aTitle ), Environment ); // Unreachable } @@ -2727,10 +2724,9 @@ void Content::insert( if ( !xInputStream.is() ) { ucbhelper::cancelCommandExecution( - uno::makeAny( - ucb::MissingInputStreamException( + ucb::MissingInputStreamException( OUString(), - static_cast< cppu::OWeakObject * >( this ) ) ), + static_cast< cppu::OWeakObject * >( this ) ), Environment ); // Unreachable } @@ -2811,10 +2807,9 @@ void Content::transfer( if ( aScheme != HTTP_URL_SCHEME && aScheme != HTTPS_URL_SCHEME ) { ucbhelper::cancelCommandExecution( - uno::makeAny( - ucb::InteractiveBadTransferURLException( + ucb::InteractiveBadTransferURLException( "Unsupported URL scheme!", - static_cast< cppu::OWeakObject * >( this ) ) ), + static_cast< cppu::OWeakObject * >( this ) ), Environment ); // Unreachable } @@ -2844,9 +2839,9 @@ void Content::transfer( ( sourceURI.GetHost() != targetURI.GetHost() ) ) { ucbhelper::cancelCommandExecution( - uno::makeAny( ucb::InteractiveBadTransferURLException( + ucb::InteractiveBadTransferURLException( "Different hosts!", - static_cast< cppu::OWeakObject * >( this ) ) ), + static_cast< cppu::OWeakObject * >( this ) ), Environment ); // Unreachable } @@ -2968,12 +2963,11 @@ void Content::transfer( case ucb::NameClash::ERROR: { ucbhelper::cancelCommandExecution( - uno::makeAny( - ucb::NameClashException( + ucb::NameClashException( OUString(), static_cast< cppu::OWeakObject * >( this ), task::InteractionClassification_ERROR, - aTargetURI ) ), + aTargetURI ), Environment ); SAL_FALLTHROUGH; // Unreachable } @@ -2987,11 +2981,10 @@ void Content::transfer( default: { ucbhelper::cancelCommandExecution( - uno::makeAny( - ucb::UnsupportedNameClashException( + ucb::UnsupportedNameClashException( OUString(), static_cast< cppu::OWeakObject * >( this ), - rArgs.NameClash ) ), + rArgs.NameClash ), Environment ); // Unreachable } @@ -3549,10 +3542,10 @@ bool Content::isFolder( } -uno::Any Content::MapDAVException( const DAVException & e, bool bWrite ) +std::unique_ptr<uno::Exception> Content::MapDAVException( const DAVException & e, bool bWrite ) { // Map DAVException... - uno::Any aException; + std::unique_ptr<uno::Exception> aException; OUString aURL; if ( m_bTransient ) @@ -3578,14 +3571,13 @@ uno::Any Content::MapDAVException( const DAVException & e, bool bWrite ) uno::makeAny(aURL), beans::PropertyState_DIRECT_VALUE); - aException <<= - ucb::InteractiveAugmentedIOException( + return + o3tl::make_unique<ucb::InteractiveAugmentedIOException>( "Not found!", static_cast< cppu::OWeakObject * >( this ), task::InteractionClassification_ERROR, ucb::IOErrorCode_NOT_EXISTING, aArgs ); - return aException; } default: break; @@ -3596,15 +3588,13 @@ uno::Any Content::MapDAVException( const DAVException & e, bool bWrite ) case DAVException::DAV_HTTP_ERROR: { if ( bWrite ) - aException <<= - ucb::InteractiveNetworkWriteException( + return o3tl::make_unique<ucb::InteractiveNetworkWriteException>( e.getData(), static_cast< cppu::OWeakObject * >( this ), task::InteractionClassification_ERROR, e.getData() ); else - aException <<= - ucb::InteractiveNetworkReadException( + o3tl::make_unique<ucb::InteractiveNetworkReadException>( e.getData(), static_cast< cppu::OWeakObject * >( this ), task::InteractionClassification_ERROR, @@ -3613,8 +3603,7 @@ uno::Any Content::MapDAVException( const DAVException & e, bool bWrite ) } case DAVException::DAV_HTTP_LOOKUP: - aException <<= - ucb::InteractiveNetworkResolveNameException( + o3tl::make_unique<ucb::InteractiveNetworkResolveNameException>( OUString(), static_cast< cppu::OWeakObject * >( this ), task::InteractionClassification_ERROR, @@ -3631,8 +3620,7 @@ uno::Any Content::MapDAVException( const DAVException & e, bool bWrite ) case DAVException::DAV_HTTP_TIMEOUT: case DAVException::DAV_HTTP_CONNECT: - aException <<= - ucb::InteractiveNetworkConnectException( + o3tl::make_unique<ucb::InteractiveNetworkConnectException>( OUString(), static_cast< cppu::OWeakObject * >( this ), task::InteractionClassification_ERROR, @@ -3648,16 +3636,14 @@ uno::Any Content::MapDAVException( const DAVException & e, bool bWrite ) // break; case DAVException::DAV_INVALID_ARG: - aException <<= - lang::IllegalArgumentException( + o3tl::make_unique<lang::IllegalArgumentException>( OUString(), static_cast< cppu::OWeakObject * >( this ), -1 ); break; case DAVException::DAV_LOCKED: - aException <<= - ucb::InteractiveLockingLockedException( + o3tl::make_unique<ucb::InteractiveLockingLockedException>( "Locked!", static_cast< cppu::OWeakObject * >( this ), task::InteractionClassification_ERROR, @@ -3666,8 +3652,7 @@ uno::Any Content::MapDAVException( const DAVException & e, bool bWrite ) break; case DAVException::DAV_LOCKED_SELF: - aException <<= - ucb::InteractiveLockingLockedException( + o3tl::make_unique<ucb::InteractiveLockingLockedException>( "Locked (self!)", static_cast< cppu::OWeakObject * >( this ), task::InteractionClassification_ERROR, @@ -3676,8 +3661,7 @@ uno::Any Content::MapDAVException( const DAVException & e, bool bWrite ) break; case DAVException::DAV_NOT_LOCKED: - aException <<= - ucb::InteractiveLockingNotLockedException( + o3tl::make_unique<ucb::InteractiveLockingNotLockedException>( "Not locked!", static_cast< cppu::OWeakObject * >( this ), task::InteractionClassification_ERROR, @@ -3685,8 +3669,7 @@ uno::Any Content::MapDAVException( const DAVException & e, bool bWrite ) break; case DAVException::DAV_LOCK_EXPIRED: - aException <<= - ucb::InteractiveLockingLockExpiredException( + o3tl::make_unique<ucb::InteractiveLockingLockExpiredException>( "Lock expired!", static_cast< cppu::OWeakObject * >( this ), task::InteractionClassification_ERROR, @@ -3694,8 +3677,7 @@ uno::Any Content::MapDAVException( const DAVException & e, bool bWrite ) break; default: - aException <<= - ucb::InteractiveNetworkGeneralException( + o3tl::make_unique<ucb::InteractiveNetworkGeneralException>( OUString(), static_cast< cppu::OWeakObject * >( this ), task::InteractionClassification_ERROR ); @@ -3727,7 +3709,8 @@ void Content::cancelCommandExecution( const uno::Reference< ucb::XCommandEnvironment > & xEnv, bool bWrite /* = sal_False */ ) { - ucbhelper::cancelCommandExecution( MapDAVException( e, bWrite ), xEnv ); + auto ex = MapDAVException( e, bWrite ); + ucbhelper::cancelCommandExecution( *ex, xEnv ); // Unreachable } diff --git a/ucb/source/ucp/webdav-neon/webdavcontent.hxx b/ucb/source/ucp/webdav-neon/webdavcontent.hxx index 571dec7b2fa6..8ee6083a2bc1 100644 --- a/ucb/source/ucp/webdav-neon/webdavcontent.hxx +++ b/ucb/source/ucp/webdav-neon/webdavcontent.hxx @@ -189,7 +189,7 @@ private: /// @throws css::uno::Exception void unlock( const css::uno::Reference< css::ucb::XCommandEnvironment >& Environment ); - css::uno::Any MapDAVException( const DAVException & e, + std::unique_ptr<css::uno::Exception> MapDAVException( const DAVException & e, bool bWrite ); /// @throws css::uno::Exception void cancelCommandExecution( diff --git a/ucb/source/ucp/webdav/webdavcontent.cxx b/ucb/source/ucp/webdav/webdavcontent.cxx index 5b193ea25bb4..a6304fef672d 100644 --- a/ucb/source/ucp/webdav/webdavcontent.cxx +++ b/ucb/source/ucp/webdav/webdavcontent.cxx @@ -3025,10 +3025,10 @@ bool Content::isFolder( } -uno::Any Content::MapDAVException( const DAVException & e, bool bWrite ) +std::unique_ptr<uno::Exception> Content::MapDAVException( const DAVException & e, bool bWrite ) { // Map DAVException... - uno::Any aException; + std::unique_ptr<uno::Exception> aException; OUString aURL; if ( m_bTransient ) diff --git a/ucb/source/ucp/webdav/webdavcontent.hxx b/ucb/source/ucp/webdav/webdavcontent.hxx index 8eefba6f2f32..1176a16e71ba 100644 --- a/ucb/source/ucp/webdav/webdavcontent.hxx +++ b/ucb/source/ucp/webdav/webdavcontent.hxx @@ -158,7 +158,7 @@ private: /// @throws css::uno::Exception void unlock( const css::uno::Reference< css::ucb::XCommandEnvironment >& Environment ); - css::uno::Any MapDAVException( const DAVException & e, + std::unique_ptr<css::uno::Exception> MapDAVException( const DAVException & e, bool bWrite ); /// @throws css::uno::Exception void cancelCommandExecution( |