diff --git a/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/fs/ozone/AbstractOzoneFileSystemTest.java b/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/fs/ozone/AbstractOzoneFileSystemTest.java index 853df93521d..ee004af1fc4 100644 --- a/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/fs/ozone/AbstractOzoneFileSystemTest.java +++ b/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/fs/ozone/AbstractOzoneFileSystemTest.java @@ -1582,8 +1582,8 @@ public void testCreateKeyShouldUseRefreshedBucketReplicationConfig() Configuration conf = new OzoneConfiguration(cluster.getConf()); conf.set(FS_DEFAULT_NAME_KEY, rootPath); // Set the number of keys to be processed during batch operate. - try { - OzoneFileSystem o3FS = (OzoneFileSystem) FileSystem.get(conf); + try (FileSystem fileSystem = FileSystem.get(conf)) { + OzoneFileSystem o3FS = (OzoneFileSystem) fileSystem; //Let's reset the clock to control the time. ((BasicOzoneClientAdapterImpl) (o3FS.getAdapter())).setClock(testClock); @@ -1617,8 +1617,6 @@ public void testCreateKeyShouldUseRefreshedBucketReplicationConfig() createKeyAndAssertKeyType(bucket, o3FS, new Path(rootPath, "key4"), ReplicationType.RATIS); - } finally { - o3fs.close(); } }