summaryrefslogtreecommitdiff
path: root/ucb/source/ucp/webdav-neon
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2017-02-01 15:20:53 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2017-02-01 15:20:53 +0200
commit88dde756eb18d4b65283008b940aa432f6146e50 (patch)
tree20dee3f3861a22e802410675d35855734a7f9db2 /ucb/source/ucp/webdav-neon
parent52885c7b82e6cfdd9072af2dc597edcb31192e89 (diff)
Revert "cancelCommandExecution - no need to pass exception by Any"
This reverts commit 4739b31dafc5154a2c7d6b3f0ee90686863656f0. Apparently, passing a param of type css::uno::Exception to Any will record precisely a css::uno::Exception in that Any, losing any subtype information, which this commit changed.
Diffstat (limited to 'ucb/source/ucp/webdav-neon')
-rw-r--r--ucb/source/ucp/webdav-neon/webdavcontent.cxx153
-rw-r--r--ucb/source/ucp/webdav-neon/webdavcontent.hxx2
2 files changed, 86 insertions, 69 deletions
diff --git a/ucb/source/ucp/webdav-neon/webdavcontent.cxx b/ucb/source/ucp/webdav-neon/webdavcontent.cxx
index b82ddde4e7ce..c825798aaa76 100644
--- a/ucb/source/ucp/webdav-neon/webdavcontent.cxx
+++ b/ucb/source/ucp/webdav-neon/webdavcontent.cxx
@@ -39,7 +39,6 @@
#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>
@@ -508,10 +507,10 @@ uno::Any SAL_CALL Content::execute(
if ( !( aCommand.Argument >>= Properties ) )
{
ucbhelper::cancelCommandExecution(
- lang::IllegalArgumentException(
+ uno::makeAny( lang::IllegalArgumentException(
"Wrong argument type!",
static_cast< cppu::OWeakObject * >( this ),
- -1 ),
+ -1 ) ),
Environment );
// Unreachable
}
@@ -528,10 +527,10 @@ uno::Any SAL_CALL Content::execute(
if ( !( aCommand.Argument >>= aProperties ) )
{
ucbhelper::cancelCommandExecution(
- lang::IllegalArgumentException(
+ uno::makeAny( lang::IllegalArgumentException(
"Wrong argument type!",
static_cast< cppu::OWeakObject * >( this ),
- -1 ),
+ -1 ) ),
Environment );
// Unreachable
}
@@ -539,10 +538,10 @@ uno::Any SAL_CALL Content::execute(
if ( !aProperties.getLength() )
{
ucbhelper::cancelCommandExecution(
- lang::IllegalArgumentException(
+ uno::makeAny( lang::IllegalArgumentException(
"No properties!",
static_cast< cppu::OWeakObject * >( this ),
- -1 ),
+ -1 ) ),
Environment );
// Unreachable
}
@@ -579,10 +578,10 @@ uno::Any SAL_CALL Content::execute(
if ( !( aCommand.Argument >>= aTmp ) )
{
ucbhelper::cancelCommandExecution(
- lang::IllegalArgumentException(
+ uno::makeAny( lang::IllegalArgumentException(
"Wrong argument type!",
static_cast< cppu::OWeakObject * >( this ),
- -1 ),
+ -1 ) ),
Environment );
// Unreachable
}
@@ -609,10 +608,10 @@ uno::Any SAL_CALL Content::execute(
if ( !( aCommand.Argument >>= arg ) )
{
ucbhelper::cancelCommandExecution(
- lang::IllegalArgumentException(
+ uno::makeAny( lang::IllegalArgumentException(
"Wrong argument type!",
static_cast< cppu::OWeakObject * >( this ),
- -1 ),
+ -1 ) ),
Environment );
// Unreachable
}
@@ -673,10 +672,10 @@ uno::Any SAL_CALL Content::execute(
if ( !( aCommand.Argument >>= transferArgs ) )
{
ucbhelper::cancelCommandExecution(
- lang::IllegalArgumentException(
+ uno::makeAny( lang::IllegalArgumentException(
"Wrong argument type!",
static_cast< cppu::OWeakObject * >( this ),
- -1 ),
+ -1 ) ),
Environment );
// Unreachable
}
@@ -693,10 +692,10 @@ uno::Any SAL_CALL Content::execute(
if ( !( aCommand.Argument >>= aArg ) )
{
ucbhelper::cancelCommandExecution(
- lang::IllegalArgumentException(
+ uno::makeAny( lang::IllegalArgumentException(
"Wrong argument type!",
static_cast< cppu::OWeakObject * >( this ),
- -1 ),
+ -1 ) ),
Environment );
// Unreachable
}
@@ -742,10 +741,10 @@ uno::Any SAL_CALL Content::execute(
if ( !( aCommand.Argument >>= aArg ) )
{
ucbhelper::cancelCommandExecution(
- lang::IllegalArgumentException(
+ uno::makeAny( lang::IllegalArgumentException(
"Wrong argument type!",
static_cast< cppu::OWeakObject * >( this ),
- -1 ),
+ -1 ) ),
Environment );
// Unreachable
}
@@ -758,10 +757,10 @@ uno::Any SAL_CALL Content::execute(
if ( !( aCommand.Argument >>= aPropArg ))
{
ucbhelper::cancelCommandExecution(
- lang::IllegalArgumentException(
+ uno::makeAny( lang::IllegalArgumentException(
"Wrong argument type!",
static_cast< cppu::OWeakObject * >( this ),
- -1 ),
+ -1 ) ),
Environment );
}
@@ -773,15 +772,15 @@ uno::Any SAL_CALL Content::execute(
}
catch ( const beans::PropertyExistException &e )
{
- ucbhelper::cancelCommandExecution( e, Environment );
+ ucbhelper::cancelCommandExecution( uno::makeAny( e ), Environment );
}
catch ( const beans::IllegalTypeException&e )
{
- ucbhelper::cancelCommandExecution( e, Environment );
+ ucbhelper::cancelCommandExecution( uno::makeAny( e ), Environment );
}
catch ( const lang::IllegalArgumentException&e )
{
- ucbhelper::cancelCommandExecution( e, Environment );
+ ucbhelper::cancelCommandExecution( uno::makeAny( e ), Environment );
}
}
else if ( aCommand.Name == "removeProperty" )
@@ -790,10 +789,10 @@ uno::Any SAL_CALL Content::execute(
if ( !( aCommand.Argument >>= sPropName ) )
{
ucbhelper::cancelCommandExecution(
- lang::IllegalArgumentException(
+ uno::makeAny( lang::IllegalArgumentException(
"Wrong argument type!",
static_cast< cppu::OWeakObject * >( this ),
- -1 ),
+ -1 ) ),
Environment );
}
@@ -805,11 +804,11 @@ uno::Any SAL_CALL Content::execute(
}
catch( const beans::UnknownPropertyException &e )
{
- ucbhelper::cancelCommandExecution( e, Environment );
+ ucbhelper::cancelCommandExecution( uno::makeAny( e ), Environment );
}
catch( const beans::NotRemoveableException &e )
{
- ucbhelper::cancelCommandExecution( e, Environment );
+ ucbhelper::cancelCommandExecution( uno::makeAny( e ), Environment );
}
}
else
@@ -819,9 +818,9 @@ uno::Any SAL_CALL Content::execute(
ucbhelper::cancelCommandExecution(
- ucb::UnsupportedCommandException(
+ uno::makeAny( ucb::UnsupportedCommandException(
aCommand.Name,
- static_cast< cppu::OWeakObject * >( this ) ),
+ static_cast< cppu::OWeakObject * >( this ) ) ),
Environment );
// Unreachable
}
@@ -2133,8 +2132,7 @@ uno::Sequence< uno::Any > Content::setPropertyValues(
aNewTitle.clear();
// Set error .
- auto ex = MapDAVException( e, true );
- aRet[ nTitlePos ] = makeAny(*ex);
+ aRet[ nTitlePos ] = MapDAVException( e, true );
}
}
@@ -2203,10 +2201,11 @@ uno::Any Content::open(
}
ucbhelper::cancelCommandExecution(
- lang::IllegalArgumentException(
+ uno::makeAny(
+ lang::IllegalArgumentException(
aMsg.makeStringAndClear(),
static_cast< cppu::OWeakObject * >( this ),
- -1 ),
+ -1 ) ),
xEnv );
// Unreachable
}
@@ -2221,10 +2220,11 @@ uno::Any Content::open(
{
// Currently(?) unsupported.
ucbhelper::cancelCommandExecution(
- ucb::UnsupportedOpenModeException(
+ uno::makeAny(
+ ucb::UnsupportedOpenModeException(
OUString(),
static_cast< cppu::OWeakObject * >( this ),
- sal_Int16( rArg.Mode ) ),
+ sal_Int16( rArg.Mode ) ) ),
xEnv );
// Unreachable
}
@@ -2346,10 +2346,11 @@ uno::Any Content::open(
// implementation. Support for this type of
// sink is optional...
ucbhelper::cancelCommandExecution(
- ucb::UnsupportedDataSinkException(
+ uno::makeAny(
+ ucb::UnsupportedDataSinkException(
OUString(),
static_cast< cppu::OWeakObject * >( this ),
- rArg.Sink ),
+ rArg.Sink ) ),
xEnv );
// Unreachable
}
@@ -2432,10 +2433,11 @@ void Content::post(
else
{
ucbhelper::cancelCommandExecution(
- ucb::UnsupportedDataSinkException(
+ uno::makeAny(
+ ucb::UnsupportedDataSinkException(
OUString(),
static_cast< cppu::OWeakObject * >( this ),
- rArg.Sink ),
+ rArg.Sink ) ),
xEnv );
// Unreachable
}
@@ -2520,10 +2522,10 @@ void Content::insert(
uno::Sequence<OUString> aProps { "Title" };
ucbhelper::cancelCommandExecution(
- ucb::MissingPropertiesException(
+ uno::makeAny( ucb::MissingPropertiesException(
OUString(),
static_cast< cppu::OWeakObject * >( this ),
- aProps ),
+ aProps ) ),
Environment );
// Unreachable
}
@@ -2692,11 +2694,12 @@ void Content::insert(
}
ucbhelper::cancelCommandExecution(
- ucb::NameClashException(
+ uno::makeAny(
+ ucb::NameClashException(
OUString(),
static_cast< cppu::OWeakObject * >( this ),
task::InteractionClassification_ERROR,
- aTitle ),
+ aTitle ) ),
Environment );
// Unreachable
}
@@ -2724,9 +2727,10 @@ void Content::insert(
if ( !xInputStream.is() )
{
ucbhelper::cancelCommandExecution(
- ucb::MissingInputStreamException(
+ uno::makeAny(
+ ucb::MissingInputStreamException(
OUString(),
- static_cast< cppu::OWeakObject * >( this ) ),
+ static_cast< cppu::OWeakObject * >( this ) ) ),
Environment );
// Unreachable
}
@@ -2807,9 +2811,10 @@ void Content::transfer(
if ( aScheme != HTTP_URL_SCHEME && aScheme != HTTPS_URL_SCHEME )
{
ucbhelper::cancelCommandExecution(
- ucb::InteractiveBadTransferURLException(
+ uno::makeAny(
+ ucb::InteractiveBadTransferURLException(
"Unsupported URL scheme!",
- static_cast< cppu::OWeakObject * >( this ) ),
+ static_cast< cppu::OWeakObject * >( this ) ) ),
Environment );
// Unreachable
}
@@ -2839,9 +2844,9 @@ void Content::transfer(
( sourceURI.GetHost() != targetURI.GetHost() ) )
{
ucbhelper::cancelCommandExecution(
- ucb::InteractiveBadTransferURLException(
+ uno::makeAny( ucb::InteractiveBadTransferURLException(
"Different hosts!",
- static_cast< cppu::OWeakObject * >( this ) ),
+ static_cast< cppu::OWeakObject * >( this ) ) ),
Environment );
// Unreachable
}
@@ -2963,11 +2968,12 @@ void Content::transfer(
case ucb::NameClash::ERROR:
{
ucbhelper::cancelCommandExecution(
- ucb::NameClashException(
+ uno::makeAny(
+ ucb::NameClashException(
OUString(),
static_cast< cppu::OWeakObject * >( this ),
task::InteractionClassification_ERROR,
- aTargetURI ),
+ aTargetURI ) ),
Environment );
SAL_FALLTHROUGH; // Unreachable
}
@@ -2981,10 +2987,11 @@ void Content::transfer(
default:
{
ucbhelper::cancelCommandExecution(
- ucb::UnsupportedNameClashException(
+ uno::makeAny(
+ ucb::UnsupportedNameClashException(
OUString(),
static_cast< cppu::OWeakObject * >( this ),
- rArgs.NameClash ),
+ rArgs.NameClash ) ),
Environment );
// Unreachable
}
@@ -3542,10 +3549,10 @@ bool Content::isFolder(
}
-std::unique_ptr<uno::Exception> Content::MapDAVException( const DAVException & e, bool bWrite )
+uno::Any Content::MapDAVException( const DAVException & e, bool bWrite )
{
// Map DAVException...
- std::unique_ptr<uno::Exception> aException;
+ uno::Any aException;
OUString aURL;
if ( m_bTransient )
@@ -3571,13 +3578,14 @@ std::unique_ptr<uno::Exception> Content::MapDAVException( const DAVException & e
uno::makeAny(aURL),
beans::PropertyState_DIRECT_VALUE);
- return
- o3tl::make_unique<ucb::InteractiveAugmentedIOException>(
+ aException <<=
+ ucb::InteractiveAugmentedIOException(
"Not found!",
static_cast< cppu::OWeakObject * >( this ),
task::InteractionClassification_ERROR,
ucb::IOErrorCode_NOT_EXISTING,
aArgs );
+ return aException;
}
default:
break;
@@ -3588,13 +3596,15 @@ std::unique_ptr<uno::Exception> Content::MapDAVException( const DAVException & e
case DAVException::DAV_HTTP_ERROR:
{
if ( bWrite )
- return o3tl::make_unique<ucb::InteractiveNetworkWriteException>(
+ aException <<=
+ ucb::InteractiveNetworkWriteException(
e.getData(),
static_cast< cppu::OWeakObject * >( this ),
task::InteractionClassification_ERROR,
e.getData() );
else
- o3tl::make_unique<ucb::InteractiveNetworkReadException>(
+ aException <<=
+ ucb::InteractiveNetworkReadException(
e.getData(),
static_cast< cppu::OWeakObject * >( this ),
task::InteractionClassification_ERROR,
@@ -3603,7 +3613,8 @@ std::unique_ptr<uno::Exception> Content::MapDAVException( const DAVException & e
}
case DAVException::DAV_HTTP_LOOKUP:
- o3tl::make_unique<ucb::InteractiveNetworkResolveNameException>(
+ aException <<=
+ ucb::InteractiveNetworkResolveNameException(
OUString(),
static_cast< cppu::OWeakObject * >( this ),
task::InteractionClassification_ERROR,
@@ -3620,7 +3631,8 @@ std::unique_ptr<uno::Exception> Content::MapDAVException( const DAVException & e
case DAVException::DAV_HTTP_TIMEOUT:
case DAVException::DAV_HTTP_CONNECT:
- o3tl::make_unique<ucb::InteractiveNetworkConnectException>(
+ aException <<=
+ ucb::InteractiveNetworkConnectException(
OUString(),
static_cast< cppu::OWeakObject * >( this ),
task::InteractionClassification_ERROR,
@@ -3636,14 +3648,16 @@ std::unique_ptr<uno::Exception> Content::MapDAVException( const DAVException & e
// break;
case DAVException::DAV_INVALID_ARG:
- o3tl::make_unique<lang::IllegalArgumentException>(
+ aException <<=
+ lang::IllegalArgumentException(
OUString(),
static_cast< cppu::OWeakObject * >( this ),
-1 );
break;
case DAVException::DAV_LOCKED:
- o3tl::make_unique<ucb::InteractiveLockingLockedException>(
+ aException <<=
+ ucb::InteractiveLockingLockedException(
"Locked!",
static_cast< cppu::OWeakObject * >( this ),
task::InteractionClassification_ERROR,
@@ -3652,7 +3666,8 @@ std::unique_ptr<uno::Exception> Content::MapDAVException( const DAVException & e
break;
case DAVException::DAV_LOCKED_SELF:
- o3tl::make_unique<ucb::InteractiveLockingLockedException>(
+ aException <<=
+ ucb::InteractiveLockingLockedException(
"Locked (self!)",
static_cast< cppu::OWeakObject * >( this ),
task::InteractionClassification_ERROR,
@@ -3661,7 +3676,8 @@ std::unique_ptr<uno::Exception> Content::MapDAVException( const DAVException & e
break;
case DAVException::DAV_NOT_LOCKED:
- o3tl::make_unique<ucb::InteractiveLockingNotLockedException>(
+ aException <<=
+ ucb::InteractiveLockingNotLockedException(
"Not locked!",
static_cast< cppu::OWeakObject * >( this ),
task::InteractionClassification_ERROR,
@@ -3669,7 +3685,8 @@ std::unique_ptr<uno::Exception> Content::MapDAVException( const DAVException & e
break;
case DAVException::DAV_LOCK_EXPIRED:
- o3tl::make_unique<ucb::InteractiveLockingLockExpiredException>(
+ aException <<=
+ ucb::InteractiveLockingLockExpiredException(
"Lock expired!",
static_cast< cppu::OWeakObject * >( this ),
task::InteractionClassification_ERROR,
@@ -3677,7 +3694,8 @@ std::unique_ptr<uno::Exception> Content::MapDAVException( const DAVException & e
break;
default:
- o3tl::make_unique<ucb::InteractiveNetworkGeneralException>(
+ aException <<=
+ ucb::InteractiveNetworkGeneralException(
OUString(),
static_cast< cppu::OWeakObject * >( this ),
task::InteractionClassification_ERROR );
@@ -3709,8 +3727,7 @@ void Content::cancelCommandExecution(
const uno::Reference< ucb::XCommandEnvironment > & xEnv,
bool bWrite /* = sal_False */ )
{
- auto ex = MapDAVException( e, bWrite );
- ucbhelper::cancelCommandExecution( *ex, xEnv );
+ ucbhelper::cancelCommandExecution( MapDAVException( e, bWrite ), xEnv );
// Unreachable
}
diff --git a/ucb/source/ucp/webdav-neon/webdavcontent.hxx b/ucb/source/ucp/webdav-neon/webdavcontent.hxx
index 8ee6083a2bc1..571dec7b2fa6 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 );
- std::unique_ptr<css::uno::Exception> MapDAVException( const DAVException & e,
+ css::uno::Any MapDAVException( const DAVException & e,
bool bWrite );
/// @throws css::uno::Exception
void cancelCommandExecution(