tanishq-chugh commented on code in PR #6772:
URL: https://github.com/apache/hive/pull/6772#discussion_r3996957382


##########
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:
   `IOUtils.toString(InputStream input)` has been deprecated in the newer 
versions of commons-io including v2.16.1 being used in hive, since we are 
already updating this, can we rather use `IOUtils.toString(InputStream input, 
Charset charset)` implementation?



-- 
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