]> git.argeo.org Git - lgpl/argeo-commons.git/blobdiff - org.argeo.cms/src/org/argeo/cms/util/BundleResourceLoader.java
Merge security.ui bundle in the cms.ui.workbench bundle
[lgpl/argeo-commons.git] / org.argeo.cms / src / org / argeo / cms / util / BundleResourceLoader.java
index 387e02ed4e83f7f5a9b5d9a442501c29021e3638..cda00efcdeac88f239ca33f2b933e038fe1efef9 100644 (file)
@@ -22,11 +22,26 @@ public class BundleResourceLoader implements ResourceLoader {
                        throws IOException {
                // TODO deal with other bundles
                Bundle bundle = bundleContext.getBundle();
+               // String location =
+               // bundle.getLocation().substring("initial@reference:".length());
+               // if (location.startsWith("file:")) {
+               // Path path = null;
+               // try {
+               // path = Paths.get(new URI(location));
+               // } catch (URISyntaxException e) {
+               // e.printStackTrace();
+               // }
+               // if (path != null) {
+               // Path resourcePath = path.resolve(resourceName);
+               // if (Files.exists(resourcePath))
+               // return Files.newInputStream(resourcePath);
+               // }
+               // }
                URL res = bundle.getResource(resourceName);
                if (res == null)
                        throw new CmsException("Resource " + resourceName
                                        + " not found in bundle " + bundle.getSymbolicName());
-               return bundleContext.getBundle().getResource(resourceName).openStream();
+               return res.openStream();
        }
 
 }