felix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rickh...@apache.org
Subject svn commit: r386077 - in /incubator/felix/trunk/org.apache.felix.framework/src/main/java/org/apache/felix/framework: cache/DirectoryRevision.java cache/JarRevision.java util/SecureAction.java
Date Wed, 15 Mar 2006 14:18:27 GMT
Author: rickhall
Date: Wed Mar 15 06:18:25 2006
New Revision: 386077

URL: http://svn.apache.org/viewcvs?rev=386077&view=rev
Log:
Fixed a bug that was returning relative paths for native libraries if a
relative path was used for the profile directory property.

Modified:
    incubator/felix/trunk/org.apache.felix.framework/src/main/java/org/apache/felix/framework/cache/DirectoryRevision.java
    incubator/felix/trunk/org.apache.felix.framework/src/main/java/org/apache/felix/framework/cache/JarRevision.java
    incubator/felix/trunk/org.apache.felix.framework/src/main/java/org/apache/felix/framework/util/SecureAction.java

Modified: incubator/felix/trunk/org.apache.felix.framework/src/main/java/org/apache/felix/framework/cache/DirectoryRevision.java
URL: http://svn.apache.org/viewcvs/incubator/felix/trunk/org.apache.felix.framework/src/main/java/org/apache/felix/framework/cache/DirectoryRevision.java?rev=386077&r1=386076&r2=386077&view=diff
==============================================================================
--- incubator/felix/trunk/org.apache.felix.framework/src/main/java/org/apache/felix/framework/cache/DirectoryRevision.java
(original)
+++ incubator/felix/trunk/org.apache.felix.framework/src/main/java/org/apache/felix/framework/cache/DirectoryRevision.java
Wed Mar 15 06:18:25 2006
@@ -145,7 +145,7 @@
 // TODO: This will need to consider security.
     public String findLibrary(String libName) throws Exception
     {
-        return new File(m_refDir, libName).toString();
+        return DefaultBundleCache.getSecureAction().getAbsolutePath(new File(m_refDir, libName));
     }
 
     public void dispose() throws Exception

Modified: incubator/felix/trunk/org.apache.felix.framework/src/main/java/org/apache/felix/framework/cache/JarRevision.java
URL: http://svn.apache.org/viewcvs/incubator/felix/trunk/org.apache.felix.framework/src/main/java/org/apache/felix/framework/cache/JarRevision.java?rev=386077&r1=386076&r2=386077&view=diff
==============================================================================
--- incubator/felix/trunk/org.apache.felix.framework/src/main/java/org/apache/felix/framework/cache/JarRevision.java
(original)
+++ incubator/felix/trunk/org.apache.felix.framework/src/main/java/org/apache/felix/framework/cache/JarRevision.java
Wed Mar 15 06:18:25 2006
@@ -233,7 +233,7 @@
             }
         }
 
-        return libFile.toString();
+        return DefaultBundleCache.getSecureAction().getAbsolutePath(libFile);
     }
 
     public void dispose() throws Exception

Modified: incubator/felix/trunk/org.apache.felix.framework/src/main/java/org/apache/felix/framework/util/SecureAction.java
URL: http://svn.apache.org/viewcvs/incubator/felix/trunk/org.apache.felix.framework/src/main/java/org/apache/felix/framework/util/SecureAction.java?rev=386077&r1=386076&r2=386077&view=diff
==============================================================================
--- incubator/felix/trunk/org.apache.felix.framework/src/main/java/org/apache/felix/framework/util/SecureAction.java
(original)
+++ incubator/felix/trunk/org.apache.felix.framework/src/main/java/org/apache/felix/framework/util/SecureAction.java
Wed Mar 15 06:18:25 2006
@@ -118,6 +118,26 @@
         }
     }
 
+    public synchronized String getAbsolutePath(File file)
+    {
+        if (System.getSecurityManager() != null)
+        {
+            try
+            {
+                m_actions.set(Actions.GET_ABSOLUTE_PATH_ACTION, file);
+                return (String) AccessController.doPrivileged(m_actions, m_acc);
+            }
+            catch (PrivilegedActionException ex)
+            {
+                throw (RuntimeException) ex.getException();
+            }
+        }
+        else
+        {
+            return file.getAbsolutePath();
+        }
+    }
+
     public synchronized boolean fileExists(File file)
     {
         if (System.getSecurityManager() != null)
@@ -341,16 +361,17 @@
         public static final int GET_PROPERTY_ACTION = 0;
         public static final int FOR_NAME_ACTION = 1;
         public static final int CREATE_URL_ACTION = 2;
-        public static final int FILE_EXISTS_ACTION = 3;
-        public static final int FILE_IS_DIRECTORY_ACTION = 4;
-        public static final int MAKE_DIRECTORY_ACTION = 5;
-        public static final int MAKE_DIRECTORIES_ACTION = 6;
-        public static final int LIST_DIRECTORY_ACTION = 7;
-        public static final int RENAME_FILE_ACTION = 8;
-        public static final int GET_FILE_INPUT_ACTION = 9;
-        public static final int GET_FILE_OUTPUT_ACTION = 10;
-        public static final int DELETE_FILE_ACTION = 11;
-        public static final int OPEN_JAR_ACTION = 12;
+        public static final int GET_ABSOLUTE_PATH_ACTION = 3;
+        public static final int FILE_EXISTS_ACTION = 4;
+        public static final int FILE_IS_DIRECTORY_ACTION = 5;
+        public static final int MAKE_DIRECTORY_ACTION = 6;
+        public static final int MAKE_DIRECTORIES_ACTION = 7;
+        public static final int LIST_DIRECTORY_ACTION = 8;
+        public static final int RENAME_FILE_ACTION = 9;
+        public static final int GET_FILE_INPUT_ACTION = 10;
+        public static final int GET_FILE_OUTPUT_ACTION = 11;
+        public static final int DELETE_FILE_ACTION = 12;
+        public static final int OPEN_JAR_ACTION = 13;
 
         private int m_action = -1;
         private Object m_arg1 = null;
@@ -415,6 +436,10 @@
             else if (m_action == CREATE_URL_ACTION)
             {
                 return new URL(m_protocol, m_host, m_port, m_path, m_handler);
+            }
+            else if (m_action == GET_ABSOLUTE_PATH_ACTION)
+            {
+                return ((File) m_arg1).getAbsolutePath();
             }
             else if (m_action == FILE_EXISTS_ACTION)
             {



Mime
View raw message