make gt-swing able to load resources from OSGI bundles

Description

I'm using geotools into an osgi plugin. We use a all-within-plugin approach, so we have all the geotools jars and dependancies being part of the classpath of the unique plugin which is using the resources internally. This works well for many geotools plugins both at compilation and runtime: shapefile, xml, kml and others. So our integration of geotools inside a plugin seems to work. I'm using geotools as a maven dependancy in version 21.0.

We only have a problem with some swing features. Displaying JMapPane works well. But trying to use PanTool leads to a runtime failure:

The complete stacktrace is:

When checking the correpsonding java code, it appears that resources are loaded kind of manually with the PropertiesFileFinder class. Two cases are planned: either the classpath entry ends with ".jar", in this case the resource is opened as a jar. Else the entry is assumed to be a directory. This second option here leads to a failure, as the resource is available as a "bundle resource".

I suggest to add an additional case where an URI starting with "bundleresource://" would use "getResourceAsStream" in order to access the resources even if they are inside an eclipse bundle. I can propose a draft and submit a pull request. Would you agree?

Tks!

Environment

None

Assignee

Unassigned

Reporter

Samuel Thiriot

Triage

None

Components

Fix versions

Priority

Medium
Configure