Modify DirectoryContent to verify that an entry is a directory if
the entry name ends with "/". (FELIX-2710)
git-svn-id: https://svn.apache.org/repos/asf/felix/trunk@1051974 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/framework/src/main/java/org/apache/felix/framework/cache/DirectoryContent.java b/framework/src/main/java/org/apache/felix/framework/cache/DirectoryContent.java
index b9ecc1c..1dfef13 100644
--- a/framework/src/main/java/org/apache/felix/framework/cache/DirectoryContent.java
+++ b/framework/src/main/java/org/apache/felix/framework/cache/DirectoryContent.java
@@ -63,7 +63,13 @@
name = name.substring(1);
}
- return new File(m_dir, name).exists();
+ // Return true if the file associated with the entry exists,
+ // unless the entry name ends with "/", in which case only
+ // return true if the file is really a directory.
+ File file = new File(m_dir, name);
+ return BundleCache.getSecureAction().fileExists(file)
+ && (name.endsWith("/")
+ ? BundleCache.getSecureAction().isFileDirectory(file) : true);
}
public Enumeration getEntries()