Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-4735651

java.io.File.canRead() inaccurate across NFS file share

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Not an Issue
    • Icon: P3 P3
    • None
    • 1.4.0
    • core-libs
    • x86
    • windows_2000



      Name: nt126004 Date: 08/22/2002


      FULL PRODUCT VERSION :
      java version "1.4.0_01"
      Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.0_01-b03)
      Java HotSpot(TM) Client VM (build 1.4.0_01-b03, mixed mode)

      FULL OPERATING SYSTEM VERSION :
      Microsoft Windows 2000 [Versions 5.00.2195]


      EXTRA RELEVANT SYSTEM CONFIGURATION :
      The window 2000 machine is trying to access
      a file on a NFS file share on a Solaris
      machine running Solaris 8.

      A DESCRIPTION OF THE PROBLEM :
      This problem only exists when working
      on across NFS. When working on the
      local file system it works fine.

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      1. Create mapped network drive to an NFS share
      2. Create a file whose permission render it unreadable
          on the share.
      3. In java create a java.io.File object which represents
          the file on the share.
      4. Call "canRead()" on the File object.

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      Expected result should be 'false', but
      is returning 'true'.

      REPRODUCIBILITY :
      This bug can be reproduced always.

      ---------- BEGIN SOURCE ----------

      import java.io.*;
      public class test {

          public static void main( String[] args ) {
               File file = new File("\\\\machineName\\dir\\unreadabeFileName");
               if( file.canRead() ) {
                    System.out.println("I am reading the file! (Shouldn't be able to)");
               }
               else {
                    System.out.println("Couldn't read file. (expected behavior)");
               }
          }
      }
      ---------- END SOURCE ----------

      CUSTOMER WORKAROUND :

      Attempt to open the file with a
      FileInputStream, and catch the exception
      when it fails.
      (Review ID: 160829)
      ======================================================================

            mr Mark Reinhold
            nthompsosunw Nathanael Thompson (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: