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

peacewong pushed a commit to branch dev-1.3.2
in repository https://gitbox.apache.org/repos/asf/linkis.git


The following commit(s) were added to refs/heads/dev-1.3.2 by this push:
     new c3de7c9f4 fix(httpclient): fix the getRequestBody's npe pr (#4126)
c3de7c9f4 is described below

commit c3de7c9f49747ffc39ff9746574317479a15ec61
Author: Jack Xu <[email protected]>
AuthorDate: Tue Jan 31 10:55:27 2023 +0800

    fix(httpclient): fix the getRequestBody's npe pr (#4126)
---
 .../main/scala/org/apache/linkis/httpclient/AbstractHttpClient.scala  | 4 ++--
 .../main/scala/org/apache/linkis/httpclient/request/GetAction.scala   | 2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git 
a/linkis-commons/linkis-httpclient/src/main/scala/org/apache/linkis/httpclient/AbstractHttpClient.scala
 
b/linkis-commons/linkis-httpclient/src/main/scala/org/apache/linkis/httpclient/AbstractHttpClient.scala
index ffadb9da2..7b443eb92 100644
--- 
a/linkis-commons/linkis-httpclient/src/main/scala/org/apache/linkis/httpclient/AbstractHttpClient.scala
+++ 
b/linkis-commons/linkis-httpclient/src/main/scala/org/apache/linkis/httpclient/AbstractHttpClient.scala
@@ -321,14 +321,14 @@ abstract class AbstractHttpClient(clientConfig: 
ClientConfig, clientName: String
           case get: GetAction =>
             get.getParameters.asScala.retain((k, v) => v != null && k != 
null).foreach {
               case (k, v) =>
-                if (k != null && v != null) builder.addTextBody(k.toString, 
v.toString)
+                if (k != null && v != null) builder.addTextBody(k, v.toString)
             }
           case _ =>
         }
         upload match {
           case get: GetAction =>
             get.getHeaders.asScala.retain((k, v) => v != null && k != 
null).foreach { case (k, v) =>
-              if (k != null && v != null) httpPost.addHeader(k.toString, 
v.toString)
+              if (k != null && v != null) httpPost.addHeader(k, v)
             }
           case _ =>
         }
diff --git 
a/linkis-commons/linkis-httpclient/src/main/scala/org/apache/linkis/httpclient/request/GetAction.scala
 
b/linkis-commons/linkis-httpclient/src/main/scala/org/apache/linkis/httpclient/request/GetAction.scala
index 95722677f..d5642302e 100644
--- 
a/linkis-commons/linkis-httpclient/src/main/scala/org/apache/linkis/httpclient/request/GetAction.scala
+++ 
b/linkis-commons/linkis-httpclient/src/main/scala/org/apache/linkis/httpclient/request/GetAction.scala
@@ -33,7 +33,7 @@ abstract class GetAction extends HttpAction {
 
   override def getRequestBody: String = {
     val queryString = new StringBuilder
-    queryParams.asScala.foreach { case (k, v) =>
+    queryParams.asScala.retain((k, v) => v != null && k != null).foreach { 
case (k, v) =>
       queryString
         .append(URLEncoder.encode(k, Configuration.BDP_ENCODING.getValue))
         .append("=")


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to