xza-m commented on code in PR #6772:
URL: https://github.com/apache/hive/pull/6772#discussion_r4036073847


##########
ql/src/java/org/apache/hadoop/hive/ql/exec/tez/YarnQueueHelper.java:
##########
@@ -202,12 +202,12 @@ public String handleUnexpectedStatusCode(
     // TODO: handle 401 and return a new connection? nothing for now
     InputStream errorStream = connection.getErrorStream();
     String error = "Received " + statusCode + (errorStr == null ? "" : (" (" + 
errorStr + ")"));
-    if (errorStream != null) {
-      error += ": " + IOUtils.toString(errorStream);
-    } else {
+    if (errorStream == null) {
       errorStream = connection.getInputStream();
-      if (errorStream != null) {
-        error += ": " + IOUtils.toString(errorStream);
+    }
+    try (InputStream stream = errorStream) {
+      if (stream != null) {
+        error += ": " + IOUtils.toString(stream);

Review Comment:
   Thanks for the suggestion! Updated in 8a22aa86 to use 
`IOUtils.toString(stream, Charset.defaultCharset())`, preserving the existing 
decoding behavior.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


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

Reply via email to