Skip to content

Commit

Permalink
HADOOP-18403. Fix FileSystem leak in ITestS3AAWSCredentialsProvider
Browse files Browse the repository at this point in the history
  • Loading branch information
virajjasani committed Aug 12, 2022
1 parent 2005582 commit 984d82b
Showing 1 changed file with 7 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -162,12 +162,13 @@ public void testAnonymousProvider() throws Exception {
conf.set(AWS_CREDENTIALS_PROVIDER,
AnonymousAWSCredentialsProvider.class.getName());
Path testFile = getCSVTestPath(conf);
FileSystem fs = FileSystem.newInstance(testFile.toUri(), conf);
assertNotNull(fs);
assertTrue(fs instanceof S3AFileSystem);
FileStatus stat = fs.getFileStatus(testFile);
assertNotNull(stat);
assertEquals(testFile, stat.getPath());
try (FileSystem fs = FileSystem.newInstance(testFile.toUri(), conf)) {
assertNotNull(fs);
assertTrue(fs instanceof S3AFileSystem);
FileStatus stat = fs.getFileStatus(testFile);
assertNotNull(stat);
assertEquals(testFile, stat.getPath());
}
}

}

0 comments on commit 984d82b

Please sign in to comment.