You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pinot.apache.org by ja...@apache.org on 2023/07/24 04:32:35 UTC

[pinot] branch master updated: Fix the NPE when query response error stream is null (#11154)

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 <17...@users.noreply.github.com>
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: commits-unsubscribe@pinot.apache.org
For additional commands, e-mail: commits-help@pinot.apache.org