Details
-
Bug
-
Status: Closed
-
Minor
-
Resolution: Fixed
-
framework-1.4.0
-
None
Description
Since Felix 1.4.0, each method invocation is now check in the class SecureAction. When we DON'T set the security manager as argument of the command line and a started bundle tries to set this one, we always get an infinite loop:
at java.net.URL.<init>(URL.java:413)
at sun.security.provider.PolicyFile$3.run(PolicyFile.java:676)
at java.security.AccessController.doPrivileged(Native Method)
at sun.security.provider.PolicyFile.initStaticPolicy(PolicyFile.java:617)
at sun.security.provider.PolicyFile.<init>(PolicyFile.java:314)
at java.security.Policy.getPolicyNoCheck(Policy.java:145)
at java.security.ProtectionDomain.implies(ProtectionDomain.java:195)
at java.security.AccessControlContext.checkPermission(AccessControlContext.java:249)
at java.security.AccessController.checkPermission(AccessController.java:427)
at java.lang.SecurityManager.checkPermission(SecurityManager.java:532)
at java.lang.reflect.AccessibleObject.setAccessible(AccessibleObject.java:107)
at org.apache.felix.framework.util.SecureAction$Actions.run(SecureAction.java:1123)
at java.security.AccessController.doPrivileged(Native Method)
at org.apache.felix.framework.util.SecureAction.invoke(SecureAction.java:754)
at org.apache.felix.framework.URLHandlersStreamHandlerProxy.getStreamHandlerService(URLHandlersStreamHandlerProxy.java:400)
at org.apache.felix.framework.URLHandlersStreamHandlerProxy.parseURL(URLHandlersStreamHandlerProxy.java:267)
at java.net.URL.<init>(URL.java:596)
at java.net.URL.<init>(URL.java:464)
at java.net.URL.<init>(URL.java:413)
at sun.security.provider.PolicyFile$3.run(PolicyFile.java:676)
... until a stack overflow.
To reproduce it, just start the attached bundle that does:
System.setSecurityManager(new RMISecurityManager());
URL wantBug = new URL("http://felix.apache.org");
System.out.println("I want a bug: " + wantBug.toExternalForm());
If the security manager is set in the command line, there is no bug.