sfx2/source/doc/docfile.cxx | 14 ++++++++++++++ ucb/source/ucp/webdav-neon/webdavcontent.cxx | 22 ++++++++++++++++++++++ 2 files changed, 36 insertions(+)
New commits: commit 0326352470aee1a774bb5aa314c4f3625c1372b3 Author: Giuseppe Castagno <[email protected]> Date: Wed Aug 19 12:13:35 2015 +0200 tdf#83531 Opening WebDAV URL WebDav fails if write is restricted Happened because LOCK method was not allowed without credentials. Change-Id: I7b204e67079791a08211410ced4b0b4f015d524a Reviewed-on: https://gerrit.libreoffice.org/17856 Reviewed-by: Jan Holesovsky <[email protected]> Tested-by: Jan Holesovsky <[email protected]> diff --git a/sfx2/source/doc/docfile.cxx b/sfx2/source/doc/docfile.cxx index ccdad93..553a3d0 100644 --- a/sfx2/source/doc/docfile.cxx +++ b/sfx2/source/doc/docfile.cxx @@ -42,6 +42,7 @@ #include <com/sun/star/ucb/CommandFailedException.hpp> #include <com/sun/star/ucb/CommandAbortedException.hpp> #include <com/sun/star/ucb/InteractiveLockingLockedException.hpp> +#include <com/sun/star/ucb/InteractiveNetworkWriteException.hpp> #include <com/sun/star/ucb/Lock.hpp> #include <com/sun/star/ucb/XCommandEnvironment.hpp> #include <com/sun/star/ucb/XContentIdentifierFactory.hpp> @@ -1010,6 +1011,19 @@ void SfxMedium::LockOrigFileOnDemand( bool bLoading, bool bNoUI ) bUIStatus = ShowLockedDocumentDialog( aLockData, bLoading, false ); } } + catch( ucb::InteractiveNetworkWriteException& ) + { + // This catch it's not really needed, here just for the sake of documentation on the behaviour. + // This is the most likely reason: + // - the remote site is a WebDAV with special configuration: read/only for read operations + // and read/write for write operations, the user is not allowed to lock/write and + // she cancelled the credentials request. + // this is not actually an error, but the exception is sent directly from ucb, avoiding the automatic + // management that takes part in cancelCommandExecution() + // Unfortunately there is no InteractiveNetwork*Exception available to signal this more correctly + // since it mostly happens on read/only part of webdav, this can be the most correct + // exception available + } catch( uno::Exception& ) {} } diff --git a/ucb/source/ucp/webdav-neon/webdavcontent.cxx b/ucb/source/ucp/webdav-neon/webdavcontent.cxx index 0cf9db6..ae1663e 100644 --- a/ucb/source/ucp/webdav-neon/webdavcontent.cxx +++ b/ucb/source/ucp/webdav-neon/webdavcontent.cxx @@ -2990,6 +2990,28 @@ void Content::lock( false ); } break; + case DAVException::DAV_HTTP_AUTH: + { + SAL_WARN( "ucb.ucp.webdav", "lock: DAVException Authentication error - URL: <" + << m_xIdentifier->getContentIdentifier() << ">" ); + // this could mean: + // - interaction handler for credential management not present (happens, depending + // on the LO framework processing) + // - the remote site is a WebDAV with special configuration: read/only for read operations + // and read/write for write operations, the user is not allowed to lock/write and + // she cancelled the credentials request. + // this is not actually an error, but the exception is sent directly from here, avoiding the automatic + // management that takes part in cancelCommandExecution() below + // Unfortunately there is no InteractiveNetwork*Exception available to signal this + // since it mostly happens on read/only part of webdav, this appears to be the most correct exception available + throw + ucb::InteractiveNetworkWriteException( + OUString( "Authentication error while tring to lock! Write only WebDAV perhaps?" ), + static_cast< cppu::OWeakObject * >( this ), + task::InteractionClassification_ERROR, + e.getData() ); + } + break; case DAVException::DAV_HTTP_ERROR: //grab the error code switch( e.getStatus() ) _______________________________________________ Libreoffice-commits mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
