felix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rickh...@apache.org
Subject svn commit: r371631 - /incubator/felix/trunk/org.apache.felix.framework/src/main/java/org/apache/felix/framework/Felix.java
Date Mon, 23 Jan 2006 19:23:16 GMT
Author: rickhall
Date: Mon Jan 23 11:23:13 2006
New Revision: 371631

URL: http://svn.apache.org/viewcvs?rev=371631&view=rev
Log:
Added Bundle.hasPermission() patch from Karl Pauls.

Modified:
    incubator/felix/trunk/org.apache.felix.framework/src/main/java/org/apache/felix/framework/Felix.java

Modified: incubator/felix/trunk/org.apache.felix.framework/src/main/java/org/apache/felix/framework/Felix.java
URL: http://svn.apache.org/viewcvs/incubator/felix/trunk/org.apache.felix.framework/src/main/java/org/apache/felix/framework/Felix.java?rev=371631&r1=371630&r2=371631&view=diff
==============================================================================
--- incubator/felix/trunk/org.apache.felix.framework/src/main/java/org/apache/felix/framework/Felix.java
(original)
+++ incubator/felix/trunk/org.apache.felix.framework/src/main/java/org/apache/felix/framework/Felix.java
Mon Jan 23 11:23:13 2006
@@ -1135,8 +1135,28 @@
             throw new IllegalStateException("The bundle is uninstalled.");
         }
 
-// TODO: IMPLEMENT THIS CORRECTLY.
-        return true;
+        if (null != System.getSecurityManager())
+        {
+            try
+            {
+               return (obj instanceof java.security.Permission)
+                   ? java.security.Policy.getPolicy().getPermissions(
+                        new java.security.CodeSource(
+                            new java.net.URL(bundle.getInfo().getLocation()), 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