You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@harmony.apache.org by ay...@apache.org on 2007/05/24 19:51:53 UTC
svn commit: r541367 - in
/harmony/enhanced/classlib/trunk/modules/luni/src/main:
java/java/io/File.java native/luni/windows/helpers.c
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