Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 327676 - Support for return local URLs from bundle class loaders
Summary: Support for return local URLs from bundle class loaders
Status: RESOLVED WONTFIX
Alias: None
Product: Equinox
Classification: Eclipse Project
Component: Framework (show other bugs)
Version: 3.7   Edit
Hardware: PC Mac OS X - Carbon (unsup.)
: P3 normal (vote)
Target Milestone: 3.7 M4   Edit
Assignee: Thomas Watson CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-10-13 11:10 EDT by Thomas Watson CLA
Modified: 2010-11-04 12:11 EDT (History)
2 users (show)

See Also:


Attachments
work in progress (6.69 KB, patch)
2010-10-22 17:03 EDT, Thomas Watson CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Thomas Watson CLA 2010-10-13 11:10:28 EDT
There is a new configuration property (org.osgi.framework.jarurls) being specified in R4.3 to force the framework to return URLs which use a protocol built into the VM (i.e. jar or file).

I have a few open questions about this property that I need to clarify with OSGi before implementing.  For example, does this property affect the URLs returned from Bundle.getResource methods.  The property seems poorly named also since it can return jar or file URLs.
Comment 1 BJ Hargrave CLA 2010-10-13 11:47:32 EDT
(In reply to comment #0)
> I have a few open questions about this property that I need to clarify with
> OSGi before implementing.  For example, does this property affect the URLs
> returned from Bundle.getResource methods.  

No. I believe it is specified to only affect the ClassLoader.getResource methods. This option is to support insane code, like Tomcat, which assumes the URLs from class loaders are in a specific scheme.

> The property seems poorly named also
> since it can return jar or file URLs.

Suggest a better name :-)
Comment 2 Richard S. Hall CLA 2010-10-13 12:13:45 EDT
Yes, it is definitely a wacky. However, making the behavior different for Bundle.getResource() vs BundleClassLoader.getResource() makes implementing this hack have a reasonably big impact on the framework implementation due to ripple effects. Having it just be a flag that just controls the behavior (on/off) is much easier to implement.

I agree about the name...org.osgi.framework.concreteurls ?
Comment 3 BJ Hargrave CLA 2010-10-13 12:26:33 EDT
(In reply to comment #2)
> Yes, it is definitely a wacky. However, making the behavior different for
> Bundle.getResource() vs BundleClassLoader.getResource() makes implementing this
> hack have a reasonably big impact on the framework implementation due to ripple
> effects. Having it just be a flag that just controls the behavior (on/off) is
> much easier to implement.
> 
> I agree about the name...org.osgi.framework.concreteurls ?

We should move the design discussion back to the OSGi bug https://www.osgi.org/members/bugzilla/show_bug.cgi?id=1396 where the prior discussion and the design is held.
Comment 4 Thomas Watson CLA 2010-10-22 17:03:55 EDT
Created attachment 181554 [details]
work in progress

This is an initial attempt to implement the option.  Note that the solution still returns normal "bundleresource" protocol URLs from Bundle.getResource and Bundle.getResources.  This only changes the behavior of ClassLoader.getResource and getResources.
Comment 5 Thomas Watson CLA 2010-10-22 17:09:46 EDT
Also note that there seems to be some requirement for jar URLs to have paths that use a .jar extension.  Very strange.  To help this patch also ensures the internal file name used by the framework cache for the bundle content has a .jar extension for jar'ed bundles.  This does nothing for reference installs.  We have to assume reference installs use a .jar extension for jar'ed bundles.
Comment 6 Thomas Watson CLA 2010-11-04 12:11:48 EDT
Upon further discussion OSGi has decided to withdraw this new feature.