Recently I observed some some interesting behaviors while trying to use JRE defined property called "java.protocol.handler.pkgs" to locate URLStreamHandler. Yes, I know I should be using OSGi URL handler service, but that's a separate discussion. Here are my observations:

1. I don't see any Handler for *bundle* scheme. So, if I disable urlhandler service (felix.service.urlhandlers=false in config.properties), then any URL with *bundle* scheme can't be used. Should there not be handlers for all Felix defined schemes?

2. framework/URLHandlers.java, which is responsible for processing "java.protocol.handler.pkgs", prefixes default pkg names by user supplied value. So, if I specify p.q as the value of that system property, then the pkg list becomes: p.q|sun.net.www.protocol|..." This was causing a LinkageError for me while trying to locate a handler for jar scheme. When I set the property as sun.net.www.protocol|p.q, things started working. I have to investigate a bit more on the LinkageError with a smaller test case.

3. URLhandlers.java calls m_secureAction.forName(className) to see if a handler is found in a package or not. This eventually calls Class.forName() which uses caller's classloader to load className. Since caller is always a Felix class, SecureAction to be precise, it is only able to locate handlers that are visible to classloader that loaded Felix. Should Felix be using Thread's context class loader to find the class?

Thanks,
Sahoo

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to