(struts) branch feature/http-params-case updated: WW-5370 Simplifies code

2023-12-12 Thread lukaszlenart
This is an automated email from the ASF dual-hosted git repository.

lukaszlenart pushed a commit to branch feature/http-params-case
in repository https://gitbox.apache.org/repos/asf/struts.git


The following commit(s) were added to refs/heads/feature/http-params-case by 
this push:
 new 7bea06045 WW-5370 Simplifies code
7bea06045 is described below

commit 7bea06045c4cb1b9fa324c3d5b452a634e5a44aa
Author: Lukasz Lenart 
AuthorDate: Tue Dec 12 09:46:38 2023 +0100

WW-5370 Simplifies code
---
 .../java/org/apache/struts2/dispatcher/HttpParameters.java |  8 
 .../org/apache/struts2/dispatcher/HttpParametersTest.java  | 14 ++
 2 files changed, 18 insertions(+), 4 deletions(-)

diff --git 
a/core/src/main/java/org/apache/struts2/dispatcher/HttpParameters.java 
b/core/src/main/java/org/apache/struts2/dispatcher/HttpParameters.java
index e44f06273..f585c6555 100644
--- a/core/src/main/java/org/apache/struts2/dispatcher/HttpParameters.java
+++ b/core/src/main/java/org/apache/struts2/dispatcher/HttpParameters.java
@@ -49,7 +49,7 @@ public class HttpParameters implements Map 
{
 
 public HttpParameters remove(Set paramsToRemove) {
 for (String paramName : paramsToRemove) {
-parameters.entrySet().removeIf(p -> 
p.getKey().equalsIgnoreCase(paramName));
+parameters.remove(paramName);
 }
 return this;
 }
@@ -112,10 +112,10 @@ public class HttpParameters implements Map {
 
 @Override
 public Parameter get(Object key) {
-if (key != null && contains(String.valueOf(key))) {
-return parameters.get(key);
+if (key != null) {
+return parameters.get(String.valueOf(key));
 } else {
-return new Parameter.Empty(String.valueOf(key));
+return null;
 }
 }
 
diff --git 
a/core/src/test/java/org/apache/struts2/dispatcher/HttpParametersTest.java 
b/core/src/test/java/org/apache/struts2/dispatcher/HttpParametersTest.java
index 7c2efbc12..b8b0a3038 100644
--- a/core/src/test/java/org/apache/struts2/dispatcher/HttpParametersTest.java
+++ b/core/src/test/java/org/apache/struts2/dispatcher/HttpParametersTest.java
@@ -23,6 +23,8 @@ import org.junit.Test;
 import java.util.HashMap;
 
 import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNull;
 import static org.junit.Assert.assertTrue;
 
 public class HttpParametersTest {
@@ -40,6 +42,18 @@ public class HttpParametersTest {
 assertEquals("value1", params.get("pAraM1").getValue());
 }
 
+@Test
+public void shouldRemoveBeCaseInsensitive() {
+// given
+HttpParameters params = HttpParameters.create(new HashMap() {{
+put("param1", "value1");
+}}).build();
+
+// then
+assertFalse(params.remove("Param1").contains("param1"));
+assertNull(params.get("param1"));
+}
+
 @Test
 public void shouldAppendSameParamsIgnoringCase() {
 // given



(struts) branch feature/http-params-case updated (7bea06045 -> 4eaab8a79)

2023-12-12 Thread lukaszlenart
This is an automated email from the ASF dual-hosted git repository.

lukaszlenart pushed a change to branch feature/http-params-case
in repository https://gitbox.apache.org/repos/asf/struts.git


 discard 7bea06045 WW-5370 Simplifies code
 new 4eaab8a79 WW-5370 Simplifies code

This update added new revisions after undoing existing revisions.
That is to say, some revisions that were in the old version of the
branch are not in the new version.  This situation occurs
when a user --force pushes a change and generates a repository
containing something like this:

 * -- * -- B -- O -- O -- O   (7bea06045)
\
 N -- N -- N   refs/heads/feature/http-params-case (4eaab8a79)

You should already have received notification emails for all of the O
revisions, and so the following emails describe only the N revisions
from the common base, B.

Any revisions marked "omit" are not gone; other references still
refer to them.  Any revisions marked "discard" are gone forever.

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 core/src/main/java/org/apache/struts2/dispatcher/HttpParameters.java | 1 -
 1 file changed, 1 deletion(-)



(struts) 01/01: WW-5370 Simplifies code

2023-12-12 Thread lukaszlenart
This is an automated email from the ASF dual-hosted git repository.

lukaszlenart pushed a commit to branch feature/http-params-case
in repository https://gitbox.apache.org/repos/asf/struts.git

commit 4eaab8a79d3674f4e519ca726f96fd7576180799
Author: Lukasz Lenart 
AuthorDate: Tue Dec 12 09:46:38 2023 +0100

WW-5370 Simplifies code
---
 .../java/org/apache/struts2/dispatcher/HttpParameters.java |  9 -
 .../org/apache/struts2/dispatcher/HttpParametersTest.java  | 14 ++
 2 files changed, 18 insertions(+), 5 deletions(-)

diff --git 
a/core/src/main/java/org/apache/struts2/dispatcher/HttpParameters.java 
b/core/src/main/java/org/apache/struts2/dispatcher/HttpParameters.java
index e44f06273..a2d4675e0 100644
--- a/core/src/main/java/org/apache/struts2/dispatcher/HttpParameters.java
+++ b/core/src/main/java/org/apache/struts2/dispatcher/HttpParameters.java
@@ -49,7 +49,7 @@ public class HttpParameters implements Map 
{
 
 public HttpParameters remove(Set paramsToRemove) {
 for (String paramName : paramsToRemove) {
-parameters.entrySet().removeIf(p -> 
p.getKey().equalsIgnoreCase(paramName));
+parameters.remove(paramName);
 }
 return this;
 }
@@ -85,7 +85,6 @@ public class HttpParameters implements Map 
{
  * @return a current instance of {@link HttpParameters}
  */
 public HttpParameters appendAll(Map newParams) {
-remove(newParams.keySet());
 parameters.putAll(newParams);
 return this;
 }
@@ -112,10 +111,10 @@ public class HttpParameters implements Map {
 
 @Override
 public Parameter get(Object key) {
-if (key != null && contains(String.valueOf(key))) {
-return parameters.get(key);
+if (key != null) {
+return parameters.get(String.valueOf(key));
 } else {
-return new Parameter.Empty(String.valueOf(key));
+return null;
 }
 }
 
diff --git 
a/core/src/test/java/org/apache/struts2/dispatcher/HttpParametersTest.java 
b/core/src/test/java/org/apache/struts2/dispatcher/HttpParametersTest.java
index 7c2efbc12..b8b0a3038 100644
--- a/core/src/test/java/org/apache/struts2/dispatcher/HttpParametersTest.java
+++ b/core/src/test/java/org/apache/struts2/dispatcher/HttpParametersTest.java
@@ -23,6 +23,8 @@ import org.junit.Test;
 import java.util.HashMap;
 
 import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNull;
 import static org.junit.Assert.assertTrue;
 
 public class HttpParametersTest {
@@ -40,6 +42,18 @@ public class HttpParametersTest {
 assertEquals("value1", params.get("pAraM1").getValue());
 }
 
+@Test
+public void shouldRemoveBeCaseInsensitive() {
+// given
+HttpParameters params = HttpParameters.create(new HashMap() {{
+put("param1", "value1");
+}}).build();
+
+// then
+assertFalse(params.remove("Param1").contains("param1"));
+assertNull(params.get("param1"));
+}
+
 @Test
 public void shouldAppendSameParamsIgnoringCase() {
 // given



(struts) branch feature/http-params-case updated: WW-5370 Adds proper logic to handle null

2023-12-12 Thread lukaszlenart
This is an automated email from the ASF dual-hosted git repository.

lukaszlenart pushed a commit to branch feature/http-params-case
in repository https://gitbox.apache.org/repos/asf/struts.git


The following commit(s) were added to refs/heads/feature/http-params-case by 
this push:
 new 102e040e0 WW-5370 Adds proper logic to handle null
102e040e0 is described below

commit 102e040e092916163640deddf1114a3e28fcb429
Author: Lukasz Lenart 
AuthorDate: Tue Dec 12 10:00:31 2023 +0100

WW-5370 Adds proper logic to handle null
---
 .../java/org/apache/struts2/dispatcher/HttpParameters.java  |  8 
 .../main/java/org/apache/struts2/dispatcher/Parameter.java  | 13 +
 .../org/apache/struts2/dispatcher/HttpParametersTest.java   |  3 +--
 3 files changed, 18 insertions(+), 6 deletions(-)

diff --git 
a/core/src/main/java/org/apache/struts2/dispatcher/HttpParameters.java 
b/core/src/main/java/org/apache/struts2/dispatcher/HttpParameters.java
index a2d4675e0..54f465eea 100644
--- a/core/src/main/java/org/apache/struts2/dispatcher/HttpParameters.java
+++ b/core/src/main/java/org/apache/struts2/dispatcher/HttpParameters.java
@@ -111,11 +111,11 @@ public class HttpParameters implements Map {
 
 @Override
 public Parameter get(Object key) {
-if (key != null) {
-return parameters.get(String.valueOf(key));
-} else {
-return null;
+if (key == null) {
+return new Parameter.Empty("null");
 }
+Parameter val = parameters.get(key.toString());
+return val != null ? val : new Parameter.Empty(key.toString());
 }
 
 @Override
diff --git a/core/src/main/java/org/apache/struts2/dispatcher/Parameter.java 
b/core/src/main/java/org/apache/struts2/dispatcher/Parameter.java
index b8a227083..edae6c3a1 100644
--- a/core/src/main/java/org/apache/struts2/dispatcher/Parameter.java
+++ b/core/src/main/java/org/apache/struts2/dispatcher/Parameter.java
@@ -166,6 +166,19 @@ public interface Parameter {
 "name='" + name + '\'' +
 '}';
 }
+
+@Override
+public boolean equals(Object o) {
+if (this == o) return true;
+if (!(o instanceof Empty)) return false;
+Empty empty = (Empty) o;
+return Objects.equals(name, empty.name);
+}
+
+@Override
+public int hashCode() {
+return Objects.hash(name);
+}
 }
 
 }
diff --git 
a/core/src/test/java/org/apache/struts2/dispatcher/HttpParametersTest.java 
b/core/src/test/java/org/apache/struts2/dispatcher/HttpParametersTest.java
index b8b0a3038..aea4a7b00 100644
--- a/core/src/test/java/org/apache/struts2/dispatcher/HttpParametersTest.java
+++ b/core/src/test/java/org/apache/struts2/dispatcher/HttpParametersTest.java
@@ -24,7 +24,6 @@ import java.util.HashMap;
 
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertNull;
 import static org.junit.Assert.assertTrue;
 
 public class HttpParametersTest {
@@ -51,7 +50,7 @@ public class HttpParametersTest {
 
 // then
 assertFalse(params.remove("Param1").contains("param1"));
-assertNull(params.get("param1"));
+assertEquals(new Parameter.Empty("param1"), params.get("param1"));
 }
 
 @Test



(struts) branch master updated (6fcb50122 -> f684effd9)

2023-12-12 Thread lukaszlenart
This is an automated email from the ASF dual-hosted git repository.

lukaszlenart pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/struts.git


from 6fcb50122 Merge pull request #806 from apache/WW-5339-astmap-block
 add 13d972d6e WW-5370 Makes HttpParameters case-insensitive
 add c40978f8c WW-5370 Uses TreeMap with case-insensitive comparator
 add 4eaab8a79 WW-5370 Simplifies code
 add 102e040e0 WW-5370 Adds proper logic to handle null
 new f684effd9 Merge pull request #807 from apache/feature/http-params-case

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 .../apache/struts2/dispatcher/HttpParameters.java  | 32 ++---
 .../org/apache/struts2/dispatcher/Parameter.java   | 13 
 .../struts2/dispatcher/HttpParametersTest.java | 78 ++
 3 files changed, 113 insertions(+), 10 deletions(-)
 create mode 100644 
core/src/test/java/org/apache/struts2/dispatcher/HttpParametersTest.java



(struts) 01/01: Merge pull request #807 from apache/feature/http-params-case

2023-12-12 Thread lukaszlenart
This is an automated email from the ASF dual-hosted git repository.

lukaszlenart pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/struts.git

commit f684effd9a5caf465dae131ae2fcb4daa301f80e
Merge: 6fcb50122 102e040e0
Author: Lukasz Lenart 
AuthorDate: Tue Dec 12 10:26:17 2023 +0100

Merge pull request #807 from apache/feature/http-params-case

[WW-5370] Makes HttpParameters case-insensitive

 .../apache/struts2/dispatcher/HttpParameters.java  | 32 ++---
 .../org/apache/struts2/dispatcher/Parameter.java   | 13 
 .../struts2/dispatcher/HttpParametersTest.java | 78 ++
 3 files changed, 113 insertions(+), 10 deletions(-)



(struts) branch feature/http-params-case deleted (was 102e040e0)

2023-12-12 Thread lukaszlenart
This is an automated email from the ASF dual-hosted git repository.

lukaszlenart pushed a change to branch feature/http-params-case
in repository https://gitbox.apache.org/repos/asf/struts.git


 was 102e040e0 WW-5370 Adds proper logic to handle null

The revisions that were on this branch are still contained in
other references; therefore, this change does not discard any commits
from the repository.



(struts) branch WW-5339-node-constr deleted (was 38c0d7b6f)

2023-12-12 Thread kusal
This is an automated email from the ASF dual-hosted git repository.

kusal pushed a change to branch WW-5339-node-constr
in repository https://gitbox.apache.org/repos/asf/struts.git


 was 38c0d7b6f WW-5339 Add HashMap instance test

The revisions that were on this branch are still contained in
other references; therefore, this change does not discard any commits
from the repository.