Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThomas Watson2012-08-08 18:42:28 +0000
committerThomas Watson2012-08-08 18:42:28 +0000
commit8b8061c1cbb5dade18d5a6c2581d33017bb1c8e1 (patch)
tree94f71e5c4e3992965120ba2e8553359552cb8004 /bundles/org.eclipse.osgi/supplement/src
parent82d265e08755ce36c656076a119f0c076f722f28 (diff)
downloadrt.equinox.framework-8b8061c1cbb5dade18d5a6c2581d33017bb1c8e1.tar.gz
rt.equinox.framework-8b8061c1cbb5dade18d5a6c2581d33017bb1c8e1.tar.xz
rt.equinox.framework-8b8061c1cbb5dade18d5a6c2581d33017bb1c8e1.zip
Use doPriv to protect caller from file operations
Diffstat (limited to 'bundles/org.eclipse.osgi/supplement/src')
-rw-r--r--bundles/org.eclipse.osgi/supplement/src/org/eclipse/osgi/framework/util/SecureAction.java10
1 files changed, 10 insertions, 0 deletions
diff --git a/bundles/org.eclipse.osgi/supplement/src/org/eclipse/osgi/framework/util/SecureAction.java b/bundles/org.eclipse.osgi/supplement/src/org/eclipse/osgi/framework/util/SecureAction.java
index 47287f549..de679602c 100644
--- a/bundles/org.eclipse.osgi/supplement/src/org/eclipse/osgi/framework/util/SecureAction.java
+++ b/bundles/org.eclipse.osgi/supplement/src/org/eclipse/osgi/framework/util/SecureAction.java
@@ -213,6 +213,16 @@ public class SecureAction {
}, controlContext).booleanValue();
}
+ public boolean mkdirs(final File file) {
+ if (System.getSecurityManager() == null)
+ return file.mkdirs();
+ return AccessController.doPrivileged(new PrivilegedAction<Boolean>() {
+ public Boolean run() {
+ return file.mkdirs() ? Boolean.TRUE : Boolean.FALSE;
+ }
+ }, controlContext).booleanValue();
+ }
+
/**
* Returns true if a file is a directory, otherwise false is returned. Same as calling
* file.isDirectory().

Back to the top