Closed file system which is not eventually closed.
diff --git a/modules/command/src/main/java/org/apache/fluo/command/FluoGetJars.java b/modules/command/src/main/java/org/apache/fluo/command/FluoGetJars.java
index d4f8c7b..2ac32fe 100644
--- a/modules/command/src/main/java/org/apache/fluo/command/FluoGetJars.java
+++ b/modules/command/src/main/java/org/apache/fluo/command/FluoGetJars.java
@@ -65,12 +65,14 @@
try {
if (config.getObserverJarsUrl().startsWith("hdfs://")) {
- FileSystem fs = FileSystem.get(new URI(config.getDfsRoot()), new Configuration());
- File downloadPathFile = new File(opts.getDownloadPath());
- if (downloadPathFile.exists()) {
- FileUtils.deleteDirectory(downloadPathFile);
+ try (FileSystem fs = FileSystem.get(new URI(config.getDfsRoot()), new Configuration())) {
+ File downloadPathFile = new File(opts.getDownloadPath());
+ if (downloadPathFile.exists()) {
+ FileUtils.deleteDirectory(downloadPathFile);
+ }
+ fs.copyToLocalFile(new Path(config.getObserverJarsUrl()),
+ new Path(opts.getDownloadPath()));
}
- fs.copyToLocalFile(new Path(config.getObserverJarsUrl()), new Path(opts.getDownloadPath()));
} else {
log.error("Unsupported url prefix for {}={}", FluoConfiguration.OBSERVER_JARS_URL_PROP,
config.getObserverJarsUrl());