luetzkendorf    2004/09/22 07:46:48

  Modified:    src/webdav/server/org/apache/slide/webdav/method Tag:
                        SLIDE_2_1_RELEASE_BRANCH AbstractWebdavMethod.java
  Log:
  added test for existence before trying to remove locks, because with bind
  clearExpiredLocks throws an ServiceAccessException that hides an
  ObjectNotFoundException, which can't catched selectively
  
  Revision  Changes    Path
  No                   revision
  No                   revision
  1.43.2.7  +20 -14    
jakarta-slide/src/webdav/server/org/apache/slide/webdav/method/AbstractWebdavMethod.java
  
  Index: AbstractWebdavMethod.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-slide/src/webdav/server/org/apache/slide/webdav/method/AbstractWebdavMethod.java,v
  retrieving revision 1.43.2.6
  retrieving revision 1.43.2.7
  diff -u -r1.43.2.6 -r1.43.2.7
  --- AbstractWebdavMethod.java 17 Sep 2004 15:38:42 -0000      1.43.2.6
  +++ AbstractWebdavMethod.java 22 Sep 2004 14:46:48 -0000      1.43.2.7
  @@ -359,17 +359,23 @@
                   globalLockObtained = true;
               }
   
  -            // clear expired lock-tokens
  -            UnlockListenerImpl listener = new UnlockListenerImpl(slideToken, token, 
config, req, resp);
  -            lock.clearExpiredLocks(slideToken, requestUri, listener);
  -            
  -            if (listener.getUnlockCount() > 0) {
  -                // If we have have cleared any lock or any lock-null resource in   
  -                // the prevois step we commit this changes, otherwise they will  
  -                // be lost ifexecuteRequest() exits with an exception (e.g. 
  -                // because of Not Found 404)
  -                token.commit();
  -                token.begin();
  +            try {
  +                // retrive to check it exists, otherwise it can't have locks
  +                structure.retrieve(slideToken, requestUri);
  +                // clear expired lock-tokens
  +                UnlockListenerImpl listener = new UnlockListenerImpl(slideToken, 
token, config, req, resp);
  +                lock.clearExpiredLocks(slideToken, requestUri, listener);
  +                
  +                if (listener.getUnlockCount() > 0) {
  +                    // If we have have cleared any lock or any lock-null resource 
in   
  +                    // the previous step we commit this changes, otherwise they 
will  
  +                    // be lost if executeRequest() exits with an exception (e.g. 
  +                    // because of Not Found 404)
  +                    token.commit();
  +                    token.begin();
  +                }
  +            } catch (ObjectNotFoundException e) {
  +                // ignore, it can't have locks
               }
               
               executeRequest();
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to