harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From a...@apache.org
Subject svn commit: r541367 - in /harmony/enhanced/classlib/trunk/modules/luni/src/main: java/java/io/File.java native/luni/windows/helpers.c
Date Thu, 24 May 2007 17:51:53 GMT
Author: ayza
Date: Thu May 24 10:51:52 2007
New Revision: 541367

URL: http://svn.apache.org/viewvc?view=rev&rev=541367
Log:
Applying fix for File.list() and File.canRead(). See HARMONY-517.

Modified:
    harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/io/File.java
    harmony/enhanced/classlib/trunk/modules/luni/src/main/native/luni/windows/helpers.c

Modified: harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/io/File.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/io/File.java?view=diff&rev=541367&r1=541366&r2=541367
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/io/File.java (original)
+++ harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/io/File.java Thu May 24
10:51:52 2007
@@ -861,11 +861,12 @@
         if (security != null) {
             security.checkRead(path);
         }
-        if (!isDirectory()) {
+        if (!isDirectory() || !canRead()) {
             return null;
-        }
+		}
         byte[][] implList = listImpl(properPath(true));
         if (implList == null) {
+            // empty list
             return new String[0];
         }
         String result[] = new String[implList.length];
@@ -953,7 +954,7 @@
         if (security != null) {
             security.checkRead(path);
         }
-        if (!isDirectory()) {
+        if (!isDirectory() || !canRead()) {
             return null;
         }
         byte[][] implList = listImpl(properPath(true));
@@ -993,11 +994,12 @@
         if (security != null) {
             security.checkRead(path);
         }
-        if (!isDirectory()) {
+        if (!isDirectory() || !canRead()) {
             return null;
         }
         byte[][] implList = listImpl(properPath(true));
         if (implList == null) {
+            // empty list
             return new String[0];
         }
         java.util.Vector<String> tempResult = new java.util.Vector<String>();

Modified: harmony/enhanced/classlib/trunk/modules/luni/src/main/native/luni/windows/helpers.c
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/luni/src/main/native/luni/windows/helpers.c?view=diff&rev=541367&r1=541366&r2=541367
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/luni/src/main/native/luni/windows/helpers.c (original)
+++ harmony/enhanced/classlib/trunk/modules/luni/src/main/native/luni/windows/helpers.c Thu
May 24 10:51:52 2007
@@ -380,8 +380,17 @@
 I_32
 getPlatformIsWriteOnly (JNIEnv * env, char *path)
 {
+  HANDLE fHandle = CreateFile(path, GENERIC_READ, FILE_SHARE_READ,
+      NULL, OPEN_EXISTING, FILE_FLAG_BACKUP_SEMANTICS, NULL);
+
+  if (fHandle == INVALID_HANDLE_VALUE) {
+    return 1;
+  }
+
+  CloseHandle(fHandle);
   return 0;
 }
+
 
 /* Resolve link if it is a symbolic link and put the result in link. */
 int



Mime
View raw message