From ad30958bc5ec62dd0e7bfae4c5d19d6c764cc600 Mon Sep 17 00:00:00 2001 From: kkolinko Date: Sat, 8 Jan 2011 22:46:02 +0000 Subject: [PATCH] Followup to r1055975 Move string calculation out of synchronized block git-svn-id: https://svn.apache.org/repos/asf/tomcat/trunk@1056828 13f79535-47bb-0310-9956-ffa450edef68 --- java/org/apache/naming/resources/ProxyDirContext.java | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/java/org/apache/naming/resources/ProxyDirContext.java b/java/org/apache/naming/resources/ProxyDirContext.java index 329f4e59c..fa3ca3a11 100644 --- a/java/org/apache/naming/resources/ProxyDirContext.java +++ b/java/org/apache/naming/resources/ProxyDirContext.java @@ -1693,15 +1693,17 @@ public class ProxyDirContext implements DirContext { protected boolean cacheUnload(String name) { if (cache == null) return false; + // To ensure correct operation, particularly of WebDAV, unload + // the resource with and without a trailing / + String name2; + if (name.endsWith("/")) { + name2 = name.substring(0, name.length() -1); + } else { + name2 = name + "/"; + } synchronized (cache) { boolean result = cache.unload(name); - // To ensure correct operation, particularly of WebDAV, unload - // the resource with and without a trailing / - if (name.endsWith("/")) { - cache.unload(name.substring(0, name.length() -1)); - } else { - cache.unload(name + "/"); - } + cache.unload(name2); return result; } } -- 2.11.0