Prevent possible NPE when processing WebDAV locks.
authormarkt <markt@13f79535-47bb-0310-9956-ffa450edef68>
Thu, 9 Jun 2011 19:15:40 +0000 (19:15 +0000)
committermarkt <markt@13f79535-47bb-0310-9956-ffa450edef68>
Thu, 9 Jun 2011 19:15:40 +0000 (19:15 +0000)
git-svn-id: https://svn.apache.org/repos/asf/tomcat/trunk@1134048 13f79535-47bb-0310-9956-ffa450edef68

java/org/apache/catalina/servlets/WebdavServlet.java
webapps/docs/changelog.xml

index a35d4c0..d08dbd0 100644 (file)
@@ -1337,13 +1337,15 @@ public class WebdavServlet
             LockInfo toRenew = resourceLocks.get(path);
             Enumeration<String> tokenList = null;
 
-            // At least one of the tokens of the locks must have been given
-            tokenList = toRenew.tokens.elements();
-            while (tokenList.hasMoreElements()) {
-                String token = tokenList.nextElement();
-                if (ifHeader.indexOf(token) != -1) {
-                    toRenew.expiresAt = lock.expiresAt;
-                    lock = toRenew;
+            if (toRenew != null) {
+                // At least one of the tokens of the locks must have been given
+                tokenList = toRenew.tokens.elements();
+                while (tokenList.hasMoreElements()) {
+                    String token = tokenList.nextElement();
+                    if (ifHeader.indexOf(token) != -1) {
+                        toRenew.expiresAt = lock.expiresAt;
+                        lock = toRenew;
+                    }
                 }
             }
 
index ecc8b17..9545dce 100644 (file)
@@ -85,6 +85,9 @@
         <bug>51344</bug>: Fix problem with Lifecycle re-factoring for deprecated
         embedded class that prevented events being triggered. (markt) 
       </fix>
+      <fix>
+        Prevent possible NPE when processing WebDAV locks. (markt)
+      </fix>
     </changelog>
   </subsection>
   <subsection name="Coyote">