You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hc.apache.org by ol...@apache.org on 2023/12/19 19:16:54 UTC

(httpcomponents-core) branch master updated (443346e95 -> 3b8b2e748)

This is an automated email from the ASF dual-hosted git repository.

olegk pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/httpcomponents-core.git


 discard 443346e95 Fix: URIBuilder.getFirstQueryParam throws NPE when query is emty (#449)
     new 3b8b2e748 Fix: URIBuilder.getFirstQueryParam throws NPE when query is emty (#449)

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   (443346e95)
            \
             N -- N -- N   refs/heads/master (3b8b2e748)

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:
 httpcore5/src/main/java/org/apache/hc/core5/net/URIBuilder.java | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)


(httpcomponents-core) 01/01: Fix: URIBuilder.getFirstQueryParam throws NPE when query is emty (#449)

Posted by ol...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

olegk pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/httpcomponents-core.git

commit 3b8b2e748145183467d1257abc182b9d94fe46cc
Author: Konstantin Sorokin <sk...@gmail.com>
AuthorDate: Tue Dec 19 22:07:20 2023 +0300

    Fix: URIBuilder.getFirstQueryParam throws NPE when query is emty (#449)
---
 httpcore5/src/main/java/org/apache/hc/core5/net/URIBuilder.java     | 3 +++
 httpcore5/src/test/java/org/apache/hc/core5/net/TestURIBuilder.java | 2 ++
 2 files changed, 5 insertions(+)

diff --git a/httpcore5/src/main/java/org/apache/hc/core5/net/URIBuilder.java b/httpcore5/src/main/java/org/apache/hc/core5/net/URIBuilder.java
index 5f3c0fac9..b6f7a6df6 100644
--- a/httpcore5/src/main/java/org/apache/hc/core5/net/URIBuilder.java
+++ b/httpcore5/src/main/java/org/apache/hc/core5/net/URIBuilder.java
@@ -967,6 +967,9 @@ public class URIBuilder {
      * @since 5.2
      */
     public NameValuePair getFirstQueryParam(final String name) {
+        if (queryParams == null) {
+            return null;
+        }
         return queryParams.stream().filter(e -> name.equals(e.getName())).findFirst().orElse(null);
     }
 
diff --git a/httpcore5/src/test/java/org/apache/hc/core5/net/TestURIBuilder.java b/httpcore5/src/test/java/org/apache/hc/core5/net/TestURIBuilder.java
index 31a567198..3642855bb 100644
--- a/httpcore5/src/test/java/org/apache/hc/core5/net/TestURIBuilder.java
+++ b/httpcore5/src/test/java/org/apache/hc/core5/net/TestURIBuilder.java
@@ -399,6 +399,8 @@ public class TestURIBuilder {
         //
         uribuilder = new URIBuilder("http://localhost:80/?param=some%20other%20stuff&blah=blah&blah=blah2");
         Assertions.assertEquals("blah", uribuilder.getFirstQueryParam("blah").getValue());
+        uribuilder.removeQuery();
+        Assertions.assertNull(uribuilder.getFirstQueryParam("param"));
     }
 
     @Test