jdk/src/share/classes/java/io/FileInputStream.java
changeset 22945 89dd803515d8
parent 18786 52a2658627c2
child 22946 0a1379d15976
--- a/jdk/src/share/classes/java/io/FileInputStream.java	Thu Feb 06 10:30:18 2014 -0800
+++ b/jdk/src/share/classes/java/io/FileInputStream.java	Mon Feb 10 12:59:31 2014 +0100
@@ -51,6 +51,12 @@
     /* File Descriptor - handle to the open file */
     private final FileDescriptor fd;
 
+    /**
+     * The path of the referenced file
+     * (null if the stream is created with a file descriptor)
+     */
+    private final String path;
+
     private FileChannel channel = null;
 
     private final Object closeLock = new Object();
@@ -128,6 +134,7 @@
         }
         fd = new FileDescriptor();
         fd.attach(this);
+        path = name;
         open(name);
     }
 
@@ -164,6 +171,7 @@
             security.checkRead(fdObj);
         }
         fd = fdObj;
+        path = null;
 
         /*
          * FileDescriptor is being shared by streams.
@@ -345,7 +353,7 @@
     public FileChannel getChannel() {
         synchronized (this) {
             if (channel == null) {
-                channel = FileChannelImpl.open(fd, true, false, this);
+                channel = FileChannelImpl.open(fd, path, true, false, this);
             }
             return channel;
         }