7029979: (fs) Path.toRealPath(boolean) should be toRealPath(LinkOption...)
authoralanb
Mon, 04 Apr 2011 18:10:38 +0100
changeset 9084 0e6af03b5c9e
parent 9082 53409a3a93f8
child 9085 7c9ef56ec288
7029979: (fs) Path.toRealPath(boolean) should be toRealPath(LinkOption...) Reviewed-by: mcimadamore, jjg
langtools/src/share/classes/com/sun/tools/javac/nio/PathFileObject.java
--- a/langtools/src/share/classes/com/sun/tools/javac/nio/PathFileObject.java	Sun Apr 03 17:00:50 2011 -0700
+++ b/langtools/src/share/classes/com/sun/tools/javac/nio/PathFileObject.java	Mon Apr 04 18:10:38 2011 +0100
@@ -37,6 +37,7 @@
 import java.nio.CharBuffer;
 import java.nio.charset.CharsetDecoder;
 import java.nio.file.Files;
+import java.nio.file.LinkOption;
 import java.nio.file.Path;
 import java.nio.file.attribute.BasicFileAttributes;
 import javax.lang.model.element.Modifier;
@@ -170,7 +171,7 @@
         if (pn.equalsIgnoreCase(sn)) {
             try {
                 // allow for Windows
-                return path.toRealPath(false).getFileName().toString().equals(sn);
+                return path.toRealPath(LinkOption.NOFOLLOW_LINKS).getFileName().toString().equals(sn);
             } catch (IOException e) {
             }
         }