This is an automated email from the ASF dual-hosted git repository.
lukaszlenart pushed a commit to branch fix/WW-5387-remove
in repository https://gitbox.apache.org/repos/asf/struts.git
commit e9738698a465aebb69d83f89e80792bf4bb349e0
Author: Lukasz Lenart
AuthorDate: Tue Jan 16 20:36:00 2024 +0100
WW-5387 Fixes remove() signature
---
.../main/java/org/apache/struts2/dispatcher/ApplicationMap.java | 9 +++--
core/src/main/java/org/apache/struts2/dispatcher/RequestMap.java | 9 +++--
.../java/org/apache/struts2/portlet/PortletApplicationMap.java | 9 +++--
3 files changed, 21 insertions(+), 6 deletions(-)
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 f0c5b4bf2..6b9053338 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 class ApplicationMap extends AbstractMap implements Seria
* @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 b8e5b8e67..2af730d94 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 class RequestMap extends AbstractMap implements Serializa
* @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 701deb004..236e0aa67 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 class PortletApplicationMap extends
AbstractMap implement
*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;
}