felix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rickh...@apache.org
Subject svn commit: r372875 - /incubator/felix/sandbox/rickhall/framework-branch/src/main/java/org/apache/felix/framework/Felix.java
Date Fri, 27 Jan 2006 15:23:45 GMT
Author: rickhall
Date: Fri Jan 27 07:23:42 2006
New Revision: 372875

URL: http://svn.apache.org/viewcvs?rev=372875&view=rev
Log:
Ported a Bundle.hasPermission() patch from trunk.

Modified:
    incubator/felix/sandbox/rickhall/framework-branch/src/main/java/org/apache/felix/framework/Felix.java

Modified: incubator/felix/sandbox/rickhall/framework-branch/src/main/java/org/apache/felix/framework/Felix.java
URL: http://svn.apache.org/viewcvs/incubator/felix/sandbox/rickhall/framework-branch/src/main/java/org/apache/felix/framework/Felix.java?rev=372875&r1=372874&r2=372875&view=diff
==============================================================================
--- incubator/felix/sandbox/rickhall/framework-branch/src/main/java/org/apache/felix/framework/Felix.java
(original)
+++ incubator/felix/sandbox/rickhall/framework-branch/src/main/java/org/apache/felix/framework/Felix.java
Fri Jan 27 07:23:42 2006
@@ -1128,7 +1128,28 @@
             throw new IllegalStateException("The bundle is uninstalled.");
         }
 
-// TODO: IMPLEMENT THIS CORRECTLY.
+        if (System.getSecurityManager() != null)
+        {
+            try
+            {
+                return (obj instanceof java.security.Permission)
+                    ? java.security.Policy.getPolicy().getPermissions(
+                        new java.security.CodeSource(
+                            new java.net.URL(bundle.getInfo().getLocation()),
+                            (java.security.cert.Certificate[]) null))
+                                .implies((java.security.Permission) obj)
+                    : false;
+            }
+            catch (Exception ex)
+            {
+                m_logger.log(
+                    LogWrapper.LOG_WARNING,
+                    "Exception while evaluating the permission.",
+                    ex);
+                return false;
+            }
+        }
+
         return true;
     }
 



Mime
View raw message