ucb/source/ucp/webdav-curl/webdavcontent.cxx |   19 ++++++++++---------
 1 file changed, 10 insertions(+), 9 deletions(-)

New commits:
commit f157d2de9f241ecc56a00f58bb5ea0b8205e53f9
Author:     Giuseppe Castagno <giuseppe.casta...@acca-esse.eu>
AuthorDate: Tue Aug 16 11:02:59 2016 +0200
Commit:     Michael Stahl <michael.st...@allotropia.de>
CommitDate: Mon Nov 1 18:43:26 2021 +0100

    ucb: webdav-curl: tdf#101094 (24): Simplify cache removal: DESTROY, 
PROPPATCH, MOVE
    
    Plus another PUT forgotten on a previuos commit.
    
    [ port of commit 1ed01e1bcc929d363ad5f3c4d2cf262a20134412
      plus move Uris back into try block ]
    
    Change-Id: Ieda94cc855f8a6b648dda404dfad411795c3dc33
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/123478
    Tested-by: Michael Stahl <michael.st...@allotropia.de>
    Reviewed-by: Michael Stahl <michael.st...@allotropia.de>

diff --git a/ucb/source/ucp/webdav-curl/webdavcontent.cxx 
b/ucb/source/ucp/webdav-curl/webdavcontent.cxx
index 8917b749a537..7429eb075fcf 100644
--- a/ucb/source/ucp/webdav-curl/webdavcontent.cxx
+++ b/ucb/source/ucp/webdav-curl/webdavcontent.cxx
@@ -582,6 +582,7 @@ uno::Any SAL_CALL Content::execute(
                 osl::Guard< osl::Mutex > aGuard( m_aMutex );
                 xResAccess.reset( new DAVResourceAccess( *m_xResAccess ) );
             }
+            aStaticDAVOptionsCache.removeDAVOptions( xResAccess->getURL() );
             xResAccess->DESTROY( Environment );
             {
                 osl::Guard< osl::Mutex > aGuard( m_aMutex );
@@ -860,6 +861,7 @@ void Content::addProperty( const 
css::ucb::PropertyCommandArgument &aCmdArg,
             osl::Guard< osl::Mutex > aGuard( m_aMutex );
             xResAccess.reset( new DAVResourceAccess( *m_xResAccess ) );
         }
+        aStaticDAVOptionsCache.removeDAVOptions( xResAccess->getURL() );
         xResAccess->PROPPATCH( aProppatchValues, xEnv );
         {
             osl::Guard< osl::Mutex > aGuard( m_aMutex );
@@ -968,6 +970,7 @@ void Content::removeProperty( const OUString& Name,
             osl::Guard< osl::Mutex > aGuard( m_aMutex );
             xResAccess.reset( new DAVResourceAccess( *m_xResAccess ) );
         }
+        aStaticDAVOptionsCache.removeDAVOptions( xResAccess->getURL() );
         xResAccess->PROPPATCH( aProppatchValues, xEnv );
         {
             osl::Guard< osl::Mutex > aGuard( m_aMutex );
@@ -1886,6 +1889,7 @@ uno::Sequence< uno::Any > Content::setPropertyValues(
         try
         {
             // Set property values at server.
+            aStaticDAVOptionsCache.removeDAVOptions( xResAccess->getURL() );
             xResAccess->PROPPATCH( aProppatchValues, xEnv );
             // TODO PLACEHOLDER:
             // remove target URL options from cache, since PROPPATCH may 
change it
@@ -1940,17 +1944,17 @@ uno::Sequence< uno::Any > Content::setPropertyValues(
             = new ::ucbhelper::ContentIdentifier( aNewURL );
         uno::Reference< ucb::XContentIdentifier > xOldId = xIdentifier;
 
-        CurlUri const sourceURI( xOldId->getContentIdentifier() );
-        CurlUri targetURI( xNewId->getContentIdentifier() );
-
         try
         {
+            CurlUri const sourceURI( xOldId->getContentIdentifier() );
+            CurlUri targetURI( xNewId->getContentIdentifier() );
+
             targetURI.SetScheme( sourceURI.GetScheme() );
 
-            xResAccess->MOVE(
-                sourceURI.GetPath(), targetURI.GetURI(), false, xEnv );
             aStaticDAVOptionsCache.removeDAVOptions( sourceURI.GetURI() );
             aStaticDAVOptionsCache.removeDAVOptions( targetURI.GetURI() );
+            xResAccess->MOVE(
+                sourceURI.GetPath(), targetURI.GetURI(), false, xEnv );
 
             // @@@ Should check for resources that could not be moved
             //     (due to source access or target overwrite) and send
@@ -1985,8 +1989,6 @@ uno::Sequence< uno::Any > Content::setPropertyValues(
         }
         catch ( DAVException const & e )
         {
-            aStaticDAVOptionsCache.removeDAVOptions( sourceURI.GetURI() );
-            aStaticDAVOptionsCache.removeDAVOptions( targetURI.GetURI() );
             // Do not set new title!
             aNewTitle.clear();
 
@@ -2602,14 +2604,13 @@ void Content::insert(
         OUString    aTargetUrl = xResAccess->getURL();
         try
         {
-            xResAccess->PUT( xInputStream, Environment );
             // remove options from cache, PUT may change it
             // it will be refreshed when needed
             aStaticDAVOptionsCache.removeDAVOptions( aTargetUrl );
+            xResAccess->PUT( xInputStream, Environment );
         }
         catch ( DAVException const & e )
         {
-            aStaticDAVOptionsCache.removeDAVOptions( aTargetUrl );
             cancelCommandExecution( e, Environment, true );
             // Unreachable
         }

Reply via email to