[Libreoffice-commits] core.git: ucb/source

Giuseppe Castagno giuseppe.castagno at acca-esse.eu
Thu Aug 11 15:03:26 UTC 2016


 ucb/source/ucp/webdav-neon/webdavcontent.cxx |   21 ++++-----------------
 1 file changed, 4 insertions(+), 17 deletions(-)

New commits:
commit 508f78298833f45fd9e2e789aa26cca125719baf
Author: Giuseppe Castagno <giuseppe.castagno at acca-esse.eu>
Date:   Wed Aug 10 14:05:08 2016 +0200

    tdf#101094 (21): Simplify cache removal: LOCK, UNLOCK
    
    Change-Id: Ib963fc6e0834606dcb6f42b3c0df5a408ebc5351
    Reviewed-on: https://gerrit.libreoffice.org/28030
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Giuseppe Castagno <giuseppe.castagno at acca-esse.eu>

diff --git a/ucb/source/ucp/webdav-neon/webdavcontent.cxx b/ucb/source/ucp/webdav-neon/webdavcontent.cxx
index d86286b..e5cd7e4 100644
--- a/ucb/source/ucp/webdav-neon/webdavcontent.cxx
+++ b/ucb/source/ucp/webdav-neon/webdavcontent.cxx
@@ -3109,8 +3109,6 @@ void Content::lock(
         aURL = m_xIdentifier->getContentIdentifier();
     }
 
-    OUString    aTargetUrl = aURL;
-
     try
     {
         std::unique_ptr< DAVResourceAccess > xResAccess;
@@ -3132,12 +3130,9 @@ void Content::lock(
             //-1, // infinite lock
             uno::Sequence< OUString >() );
 
-        //  update the URL
-        aTargetUrl = xResAccess->getURL();
-
+        // OPTIONS may change as a consequence of the lock operation
+        aStaticDAVOptionsCache.removeDAVOptions( xResAccess->getURL() );
         xResAccess->LOCK( aLock, Environment );
-        // OPTIONS may have changed as a consequence of the lock operation
-        aStaticDAVOptionsCache.removeDAVOptions( aTargetUrl );
 
         {
             osl::Guard< osl::Mutex > aGuard( m_aMutex );
@@ -3146,7 +3141,6 @@ void Content::lock(
     }
     catch ( DAVException const & e )
     {
-        aStaticDAVOptionsCache.removeDAVOptions( aTargetUrl );
         // check if the exception thrown is 'already locked'
         // this exception is mapped directly to the ucb correct one, without
         // going into the cancelCommandExecution() user interaction
@@ -3247,8 +3241,6 @@ void Content::unlock(
         const uno::Reference< ucb::XCommandEnvironment >& Environment )
     throw( uno::Exception, std::exception )
 {
-    // save the URL to clean cache
-    OUString    aTargetUrl = m_xIdentifier->getContentIdentifier();
 
     try
     {
@@ -3258,8 +3250,6 @@ void Content::unlock(
             xResAccess.reset( new DAVResourceAccess( *m_xResAccess.get() ) );
         }
 
-        // update the URL
-        aTargetUrl = xResAccess->getURL();
         // check if the target URL is a Class1 DAV
         DAVOptions aDAVOptions;
         getResourceOptions( Environment, aDAVOptions, xResAccess );
@@ -3267,10 +3257,10 @@ void Content::unlock(
         // at least class one is needed
         if( aDAVOptions.isClass1() )
         {
-            xResAccess->UNLOCK( Environment );
             // remove options from cache, unlock may change it
             // it will be refreshed when needed
-            aStaticDAVOptionsCache.removeDAVOptions( aTargetUrl );
+            aStaticDAVOptionsCache.removeDAVOptions( xResAccess->getURL() );
+            xResAccess->UNLOCK( Environment );
         }
 
         {
@@ -3310,9 +3300,6 @@ void Content::unlock(
                 }
                 break;
             default:
-                // remove options from cache,
-                // it will be refreshed when needed
-                aStaticDAVOptionsCache.removeDAVOptions( aTargetUrl );
                 //fallthrough
                 ;
         }


More information about the Libreoffice-commits mailing list