You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@flink.apache.org by GitBox <gi...@apache.org> on 2020/01/15 10:57:33 UTC

[GitHub] [flink] zentol commented on a change in pull request #10801: [FLINK-15521][e2e] Follow symbolic link when copying distribution

zentol commented on a change in pull request #10801: [FLINK-15521][e2e] Follow symbolic link when copying distribution
URL: https://github.com/apache/flink/pull/10801#discussion_r366814124
 
 

 ##########
 File path: flink-end-to-end-tests/flink-end-to-end-tests-common/src/main/java/org/apache/flink/tests/util/TestUtils.java
 ##########
 @@ -87,15 +89,15 @@ public static Path getResourceJar(final String jarNameRegex) {
 	 * @throws IOException if any IO error happen.
 	 */
 	public static Path copyDirectory(final Path source, final Path destination) throws IOException {
-		Files.walkFileTree(source, new SimpleFileVisitor<Path>() {
+		Files.walkFileTree(source, EnumSet.of(FileVisitOption.FOLLOW_LINKS), Integer.MAX_VALUE, new SimpleFileVisitor<Path>() {
 			@Override
 			public FileVisitResult preVisitDirectory(Path dir, BasicFileAttributes ignored)
 				throws IOException {
-				final Path targetRir = destination.resolve(source.relativize(dir));
+				final Path targetDir = destination.resolve(source.relativize(dir));
 				try {
-					Files.copy(dir, targetRir, StandardCopyOption.COPY_ATTRIBUTES);
+					Files.copy(dir, targetDir, StandardCopyOption.COPY_ATTRIBUTES);
 				} catch (FileAlreadyExistsException e) {
-					if (!Files.isDirectory(targetRir)) {
+					if (!Files.isDirectory(targetDir)) {
 
 Review comment:
   I have to guess since it's been a while, but I suppose the idea is that if a file already exists it is likely that the contents are different (hence affecting the correctness of the operation), while this is not the case for directories generally.

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services