### Eclipse Workspace Patch 1.0 #P jetspeed-portal-2.2.3-SNAPSHOT Index: src/main/java/org/apache/jetspeed/decoration/caches/HashMapPathResolverCache.java =================================================================== --- src/main/java/org/apache/jetspeed/decoration/caches/HashMapPathResolverCache.java (revision 1564710) +++ src/main/java/org/apache/jetspeed/decoration/caches/HashMapPathResolverCache.java (working copy) @@ -1,62 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.jetspeed.decoration.caches; - -import java.util.Collections; -import java.util.HashMap; -import java.util.Map; - -import org.apache.jetspeed.decoration.PathResolverCache; - - -/** - * Uses a java.util.HashMap to cache previously located - * resources pathes. - * - * @author Scott T. Weaver - * - */ -public class HashMapPathResolverCache implements PathResolverCache -{ - protected Map cache; - - public HashMapPathResolverCache() - { - this.cache = Collections.synchronizedMap(new HashMap()); - } - - public void addPath(String key, String path) - { - cache.put(key, path); - } - - public String getPath(String key) - { - return cache.get(key); - } - - public String removePath(String key) - { - return cache.remove(key); - } - - public void clear() - { - cache.clear(); - } - -} Index: src/main/java/org/apache/jetspeed/decoration/caches/SessionPathResolverCache.java =================================================================== --- src/main/java/org/apache/jetspeed/decoration/caches/SessionPathResolverCache.java (revision 1564710) +++ src/main/java/org/apache/jetspeed/decoration/caches/SessionPathResolverCache.java (working copy) @@ -16,6 +16,7 @@ */ package org.apache.jetspeed.decoration.caches; +import java.util.Collections; import java.util.HashMap; import java.util.Map; @@ -30,21 +31,42 @@ * @author Scott T. Weaver * */ -public class SessionPathResolverCache extends HashMapPathResolverCache implements PathResolverCache +public class SessionPathResolverCache implements PathResolverCache { - public SessionPathResolverCache(HttpSession session) + + private Map cache; + + public SessionPathResolverCache(HttpSession session) { - cache = (Map) session.getAttribute(PortalReservedParameters.RESOVLER_CACHE_ATTR); + cache = (Map) session.getAttribute(PortalReservedParameters.RESOLVER_CACHE_ATTR); if(cache == null) { - cache = new HashMap(); - session.setAttribute(PortalReservedParameters.RESOVLER_CACHE_ATTR, cache); + cache = Collections.synchronizedMap(new HashMap()); + session.setAttribute(PortalReservedParameters.RESOLVER_CACHE_ATTR, cache); } } - public void clear() - { + @Override + public void clear() { cache.clear(); } + + @Override + public void addPath(String key, String path) { + cache.put(key, path); + + } + + @Override + public String getPath(String key) { + return cache.get(key); + } + + @Override + public String removePath(String key) { + return cache.remove(key); + } + + } Index: src/test/java/org/apache/jetspeed/decoration/TestDecorations.java =================================================================== --- src/test/java/org/apache/jetspeed/decoration/TestDecorations.java (revision 1564710) +++ src/test/java/org/apache/jetspeed/decoration/TestDecorations.java (working copy) @@ -256,7 +256,7 @@ expectAndReturn(atLeastOnce(), servletRequestMock, "getSession", sessionMock.proxy()); expectAndReturn(atLeastOnce(), requestContextMock, "getRequest", servletRequestMock.proxy()); - expectAndReturn(atLeastOnce(), sessionMock, "getAttribute", new Constraint[]{eq(PortalReservedParameters.RESOVLER_CACHE_ATTR)}, new HashMap()); + expectAndReturn(atLeastOnce(), sessionMock, "getAttribute", new Constraint[]{eq(PortalReservedParameters.RESOLVER_CACHE_ATTR)}, new HashMap()); //expectAndReturn(sessionMock, "getAttribute", PortalReservedParameters.RESOVLER_CACHE_ATTR); expectAndReturn(childFragmentMock, "getDecorator", "myPortletDecoration"); #P jetspeed-api-2.2.3-SNAPSHOT Index: src/main/java/org/apache/jetspeed/PortalReservedParameters.java =================================================================== --- src/main/java/org/apache/jetspeed/PortalReservedParameters.java (revision 1564710) +++ src/main/java/org/apache/jetspeed/PortalReservedParameters.java (working copy) @@ -65,7 +65,7 @@ public static final String PATH_ATTRIBUTE = "org.apache.jetspeed.Path"; public static final String CONTENT_PATH_ATTRIBUTE = "org.apache.jetspeed.ContentPath"; public static final String PARAMETER_ALREADY_DECODED_ATTRIBUTE = "org.apache.jetspeed.parameterAlreadyDecoded"; - public static final String RESOVLER_CACHE_ATTR = "org.apache.jetspeed.resovler.cache"; + public static final String RESOLVER_CACHE_ATTR = "org.apache.jetspeed.resolver.cache"; public static final String PORTLET_DEFINITION_ATTRIBUTE = "org.apache.jetspeed.portlet.definition"; public static final String PORTLET_WINDOW_ATTRIBUTE = "org.apache.jetspeed.portlet.window"; public static final String PORTLET_FILTER_MANAGER_ATTRIBUTE = "org.apache.jetspeed.portlet.container.filterManager";