HBASE-25646: Possible Resource Leak in CatalogJanitor #3036
Close the stream using a try-with-resources block.
Reviewed-by: Aman Poonia <aman.poonia.29@gmail.com>
Signed-off-by: Wei-Chiu Chuang <weichiu@apache.org>
Signed-off-by: Viraj Jasani <vjasani@apache.org>
Signed-off-by: Bharath Vissapragada <bharathv@apache.org>
(cherry picked from commit 573daed419
)
This commit is contained in:
parent
321b5c7979
commit
884cb0bd2c
|
@ -406,9 +406,8 @@ public class CatalogJanitor extends ScheduledChore {
|
|||
|
||||
private static void checkLog4jProperties() {
|
||||
String filename = "log4j.properties";
|
||||
try {
|
||||
final InputStream inStream =
|
||||
CatalogJanitor.class.getClassLoader().getResourceAsStream(filename);
|
||||
try (final InputStream inStream =
|
||||
CatalogJanitor.class.getClassLoader().getResourceAsStream(filename)) {
|
||||
if (inStream != null) {
|
||||
new Properties().load(inStream);
|
||||
} else {
|
||||
|
|
Loading…
Reference in New Issue