getResource() doesn't work on META-INF while getResources() does
----------------------------------------------------------------

                 Key: FELIX-596
                 URL: https://issues.apache.org/jira/browse/FELIX-596
             Project: Felix
          Issue Type: Improvement
          Components: Framework
            Reporter: Costin Leau


I think I've discovered a regression bug.
I'm doing a getResource() on META-INF inside each bundle as part of a 
integration test but this fails on a bundle from SpringSource Bundle Repsitory 
(even though it appears to be valid). 

The Jar in question is ObjectWeb ASM:
http://tinyurl.com/4tbljg

Its content is:

# jar -tvf com.springsource.org.objectweb.asm-2.2.0.jar
   467 Tue May 20 13:41:56 EEST 2008 META-INF/MANIFEST.MF
   435 Tue May 20 13:41:56 EEST 2008 org/objectweb/asm/AnnotationVisitor.class
  3659 Tue May 20 13:41:56 EEST 2008 org/objectweb/asm/AnnotationWriter.class
....

Basically it seems that for some reason, Felix doesn't consider META-INF/ as a 
valid path probably because it doesn't exist as a real entry in the JAR in the 
first place. There were some discussions some time ago (with Richard) about 
what the proper behaviour should be - Equinox for example will return an entry 
to the folder. In Felix getResources() works but getResource() fails. 

See below the tests:
        public void testCallGetResourceOnADifferentBundle() throws Exception {
                // find bundles
                Bundle[] bundles = bundleContext.getBundles();
                for (int i = 1; i < bundles.length; i++) {
                        Bundle bundle = bundles[i];
                        logger.debug("calling #getResource on bundle " + 
OsgiStringUtils.nullSafeNameAndSymName(bundle));
                        URL url = bundle.getResource(LOCATION);
                        if (!OsgiBundleUtils.isFragment(bundle))
                                assertNotNull("bundle " + 
OsgiStringUtils.nullSafeNameAndSymName(bundle) + " contains no META-INF/",
                                        url);
                }
        }

        public void testCallGetResourcesOnADifferentBundle() throws Exception {
                // find bundles
                Bundle[] bundles = bundleContext.getBundles();
                for (int i = 1; i < bundles.length; i++) {
                        Bundle bundle = bundles[i];
                        logger.debug("calling #getResources on bundle " + 
OsgiStringUtils.nullSafeNameAndSymName(bundle));
                        Enumeration enm = bundle.getResources(LOCATION);
                        if (!OsgiBundleUtils.isFragment(bundle))
                                assertNotNull("bundle " + 
OsgiStringUtils.nullSafeNameAndSymName(bundle) + " contains no META-INF/",
                                        enm);
                }
        }

You can find the original test at:
https://springframework.svn.sourceforge.net/svnroot/springframework/spring-osgi/trunk/integration-tests/tests/src/test/java/org/springframework/osgi/iandt/compliance/io/CallingResourceOnDifferentBundlesTest.java

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to