xza-m opened a new pull request, #6772: URL: https://github.com/apache/hive/pull/6772
### What changes were proposed in this pull request? Use try-with-resources in `YarnQueueHelper.handleUnexpectedStatusCode()` to close the selected response stream after reading it, including when reading fails. Keep the error stream preferred over the fallback input stream. ### Why are the changes needed? [HIVE-29876](https://issues.apache.org/jira/browse/HIVE-29876): the method reads the response body without closing its stream. ### Does this PR introduce _any_ user-facing change? The response selection and error message format are unchanged. A failure closing the stream now propagates as an `IOException`; if reading also fails, the close exception is suppressed on the read exception. ### How was this patch tested? Added nine regression tests covering both stream paths, empty and missing responses, read failures, and close failures. Seven fail against the original implementation; all nine pass with the fix. Ran the new tests and the existing `TestTezSessionPool` on JDK 21 with Maven 3.9.11: ```sh mvn -B -ntp -Dscan=false -pl ql -am test \ -Dtest=TestYarnQueueHelper,TestTezSessionPool \ -DfailIfNoTests=false -Dsurefire.failIfNoSpecifiedTests=false ``` All 17 tests passed, and all 21 modules in the selected reactor succeeded. Apache RAT passed. Repository Checkstyle rules reported no findings in the new test and no new findings in the modified source. `git diff --check` passed. `TestTezSessionPool` logged background-thread `SessionState` null-pointer exceptions; a separate run against the original source reproduced the same eight exceptions with all eight tests passing. The full Hive test suite was not run. -- 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]
