Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThomas Watson2013-04-09 17:23:47 +0000
committerThomas Watson2013-04-09 17:23:47 +0000
commit7591e36abd6786ae4b6a3e57e9d3d07f4be3cad2 (patch)
tree0a1e01fa9d37302339bee63005f30375cf7043ae /bundles/org.eclipse.osgi/supplement/src
parent24a3eee8607eb92682fb8d0bc4aac463e9a29a91 (diff)
downloadrt.equinox.framework-7591e36abd6786ae4b6a3e57e9d3d07f4be3cad2.tar.gz
rt.equinox.framework-7591e36abd6786ae4b6a3e57e9d3d07f4be3cad2.tar.xz
rt.equinox.framework-7591e36abd6786ae4b6a3e57e9d3d07f4be3cad2.zip
Bug 395274 - Equinox returns valid bundle entries for invalid paths
Diffstat (limited to 'bundles/org.eclipse.osgi/supplement/src')
-rw-r--r--bundles/org.eclipse.osgi/supplement/src/org/eclipse/osgi/framework/util/SecureAction.java40
1 files changed, 39 insertions, 1 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 2e654b16c..5fb4cef0d 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
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2003, 2010 IBM Corporation and others.
+ * Copyright (c) 2003, 2013 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -198,6 +198,44 @@ public class SecureAction {
}
/**
+ * Returns the absolute file. Same as calling
+ * file.getAbsoluteFile().
+ * @param file a file object
+ * @return the absolute file.
+ */
+ public File getAbsoluteFile(final File file) {
+ if (System.getSecurityManager() == null)
+ return file.getAbsoluteFile();
+ return AccessController.doPrivileged(new PrivilegedAction<File>() {
+ public File run() {
+ return file.getAbsoluteFile();
+ }
+ }, controlContext);
+ }
+
+ /**
+ * Returns the canonical file. Same as calling
+ * file.getCanonicalFile().
+ * @param file a file object
+ * @return the canonical file.
+ */
+ public File getCanonicalFile(final File file) throws IOException {
+ if (System.getSecurityManager() == null)
+ return file.getCanonicalFile();
+ try {
+ return AccessController.doPrivileged(new PrivilegedExceptionAction<File>() {
+ public File run() throws IOException {
+ return file.getCanonicalFile();
+ }
+ }, controlContext);
+ } catch (PrivilegedActionException e) {
+ if (e.getException() instanceof IOException)
+ throw (IOException) e.getException();
+ throw (RuntimeException) e.getException();
+ }
+ }
+
+ /**
* Returns true if a file exists, otherwise false is returned. Same as calling
* file.exists().
* @param file a file object

Back to the top