slankka commented on a change in pull request #15999:
URL: https://github.com/apache/flink/pull/15999#discussion_r757843035



##########
File path: flink-core/src/test/java/org/apache/flink/util/FileUtilsTest.java
##########
@@ -331,6 +331,22 @@ public void testListAFileFailsBecauseDirectoryIsExpected() 
throws IOException {
         FileUtils.listFilesInDirectory(file.toPath(), FileUtils::isJarFile);
     }
 
+    @Test
+    public void testFollowSymbolicLink() throws IOException {
+        final String fileName = "a/a.jar";
+        File folder = tmp.newFolder("a");
+        final File file = tmp.newFile(fileName);
+
+        java.nio.file.Path linkPath = Paths.get(folder.getParent(), "a.lnk");
+        Files.createSymbolicLink(linkPath, file.getParentFile().toPath());
+        Collection<java.nio.file.Path> paths =
+                FileUtils.listFilesInDirectory(linkPath.toRealPath(), 
FileUtils::isJarFile);

Review comment:
       `listFilesInDirectory` resolves symbolic links for files under given 
path which name is still symbolic.
   `toRealPath` resolve the top symbolic path only.
   I have already changed test code to prove it.




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to