Skip to content

Commit

Permalink
Merge pull request #844 from apache/fix/WW-5387-remove
Browse files Browse the repository at this point in the history
[WW-5387] Fixes remove() signature
  • Loading branch information
lukaszlenart committed Jan 17, 2024
2 parents d0ac76b + e973869 commit fdd996c
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 <tt>null</tt> 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;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down

0 comments on commit fdd996c

Please sign in to comment.