jdk/src/solaris/classes/sun/nio/fs/GnomeFileTypeDetector.java
changeset 18185 607d2fb48f47
parent 9035 1255eb81cc2f
child 21290 db5e0cad1102
equal deleted inserted replaced
18184:75811cab0180 18185:607d2fb48f47
    65 
    65 
    66         UnixPath path = (UnixPath)obj;
    66         UnixPath path = (UnixPath)obj;
    67         NativeBuffer buffer = NativeBuffers.asNativeBuffer(path.getByteArrayForSysCalls());
    67         NativeBuffer buffer = NativeBuffers.asNativeBuffer(path.getByteArrayForSysCalls());
    68         try {
    68         try {
    69             if (gioAvailable) {
    69             if (gioAvailable) {
       
    70                 // GIO may access file so need permission check
       
    71                 path.checkRead();
    70                 byte[] type = probeUsingGio(buffer.address());
    72                 byte[] type = probeUsingGio(buffer.address());
    71                 return (type == null) ? null : new String(type);
    73                 return (type == null) ? null : new String(type);
    72             } else {
    74             } else {
    73                 byte[] type = probeUsingGnomeVfs(buffer.address());
    75                 byte[] type = probeUsingGnomeVfs(buffer.address());
    74                 if (type == null)
    76                 if (type == null)
    75                     return null;
    77                     return null;
    76                 String s = new String(type);
    78                 String s = new String(type);
    77                 return s.equals(GNOME_VFS_MIME_TYPE_UNKNOWN) ? null : s;
    79                 return s.equals(GNOME_VFS_MIME_TYPE_UNKNOWN) ? null : s;
    78             }
    80             }
    79 
       
    80         } finally {
    81         } finally {
    81             buffer.release();
    82             buffer.release();
    82         }
    83         }
    83 
    84 
    84     }
    85     }