- if (!resourceFileName.startsWith("/"))
- resource = getClass().getResource(RESOURCE_BASE + resourceFileName);
- else
- resource = getClass().getResource(resourceFileName);
+ try {
+ // FIXME workaround when in nested OSGi frameworks
+ // we should use class path, as before
+ if (!resourceFileName.startsWith("platform:")) {
+ resource = URI.create("platform:/plugin/org.argeo.app.core" + RESOURCE_BASE + resourceFileName)
+ .toURL();
+ } else {
+ resource = URI.create(resourceFileName).toURL();
+ }
+ } catch (MalformedURLException e) {
+ throw new IllegalArgumentException("Cannot convert " + resourceFileName + " to URL");
+ }
+