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>
This commit is contained in:
parent
109bd24065
commit
573daed419
|
@ -407,9 +407,8 @@ public class CatalogJanitor extends ScheduledChore {
|
||||||
|
|
||||||
private static void checkLog4jProperties() {
|
private static void checkLog4jProperties() {
|
||||||
String filename = "log4j.properties";
|
String filename = "log4j.properties";
|
||||||
try {
|
try (final InputStream inStream =
|
||||||
final InputStream inStream =
|
CatalogJanitor.class.getClassLoader().getResourceAsStream(filename)) {
|
||||||
CatalogJanitor.class.getClassLoader().getResourceAsStream(filename);
|
|
||||||
if (inStream != null) {
|
if (inStream != null) {
|
||||||
new Properties().load(inStream);
|
new Properties().load(inStream);
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Reference in New Issue