diff --git a/core/src/main/java/org/apache/struts2/dispatcher/ApplicationMap.java b/core/src/main/java/org/apache/struts2/dispatcher/ApplicationMap.java index f0c5b4bf23..6b9053338a 100644 --- a/core/src/main/java/org/apache/struts2/dispatcher/ApplicationMap.java +++ b/core/src/main/java/org/apache/struts2/dispatcher/ApplicationMap.java @@ -151,11 +151,16 @@ public Object put(final String key, final Object value) { * @param key the attribute to remove. * @return the entry that was just removed. */ - public Object remove(final String key) { + @Override + public Object remove(Object key) { + if (key == null) { + return null; + } + entries = null; Object value = get(key); - context.removeAttribute(key); + context.removeAttribute(key.toString()); return value; } diff --git a/core/src/main/java/org/apache/struts2/dispatcher/RequestMap.java b/core/src/main/java/org/apache/struts2/dispatcher/RequestMap.java index b8e5b8e671..2af730d94a 100644 --- a/core/src/main/java/org/apache/struts2/dispatcher/RequestMap.java +++ b/core/src/main/java/org/apache/struts2/dispatcher/RequestMap.java @@ -125,11 +125,16 @@ public Object put(final String key, final Object value) { * @param key the name of the attribute to remove. * @return the value that was removed or null if the value was not found (and hence, not removed). */ - public Object remove(final String key) { + @Override + public Object remove(final Object key) { + if (key == null) { + return null; + } + entries = null; Object value = get(key); - request.removeAttribute(key); + request.removeAttribute(key.toString()); return value; } diff --git a/plugins/portlet/src/main/java/org/apache/struts2/portlet/PortletApplicationMap.java b/plugins/portlet/src/main/java/org/apache/struts2/portlet/PortletApplicationMap.java index 701deb004b..236e0aa67c 100644 --- a/plugins/portlet/src/main/java/org/apache/struts2/portlet/PortletApplicationMap.java +++ b/plugins/portlet/src/main/java/org/apache/struts2/portlet/PortletApplicationMap.java @@ -197,11 +197,16 @@ public Object put(String key, Object value) { * the attribute to remove. * @return the entry that was just removed. */ - public Object remove(String key) { + @Override + public Object remove(Object key) { + if (key == null) { + return null; + } + entries = null; Object value = get(key); - context.removeAttribute(key); + context.removeAttribute(key.toString()); return value; }