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

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


The following commit(s) were added to refs/heads/master by this push:
     new cb0c86c178 Fix the NPE when query response error stream is null 
(#11154)
cb0c86c178 is described below

commit cb0c86c17885df4c5fc42df521ecab2aabffbf65
Author: Xiaotian (Jackie) Jiang <[email protected]>
AuthorDate: Sun Jul 23 21:32:29 2023 -0700

    Fix the NPE when query response error stream is null (#11154)
---
 .../apache/pinot/controller/api/resources/PinotQueryResource.java   | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git 
a/pinot-controller/src/main/java/org/apache/pinot/controller/api/resources/PinotQueryResource.java
 
b/pinot-controller/src/main/java/org/apache/pinot/controller/api/resources/PinotQueryResource.java
index 8cddd62e3d..3b3abb7981 100644
--- 
a/pinot-controller/src/main/java/org/apache/pinot/controller/api/resources/PinotQueryResource.java
+++ 
b/pinot-controller/src/main/java/org/apache/pinot/controller/api/resources/PinotQueryResource.java
@@ -401,8 +401,10 @@ public class PinotQueryResource {
       if (responseCode == HttpURLConnection.HTTP_FORBIDDEN) {
         throw new WebApplicationException("Permission denied", 
Response.Status.FORBIDDEN);
       } else if (responseCode != HttpURLConnection.HTTP_OK) {
-        throw new IOException("Failed : HTTP error code : " + responseCode + 
". Root Cause: "
-            + IOUtils.toString(conn.getErrorStream(), StandardCharsets.UTF_8));
+        InputStream errorStream = conn.getErrorStream();
+        throw new IOException(
+            "Failed : HTTP error code : " + responseCode + ". Root Cause: " + 
(errorStream != null ? IOUtils.toString(
+                errorStream, StandardCharsets.UTF_8) : "Unknown"));
       }
       final byte[] bytes = drain(new 
BufferedInputStream(conn.getInputStream()));
 


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

Reply via email to