You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@felix.apache.org by Sahoo <Sa...@Sun.COM> on 2009/06/07 09:56:52 UTC

How to iterate over all the entries of a bundle?

Hi,

Can anyone tell me how I can iterate over all the entries of a bundle
jar? I don't want any entries from the fragment. So, I thought
Bundle.getEntryPaths() would do the job, but I don't see the desired
behavior. For testing purpose, I am using the following code:

    void printEntryPaths(Bundle b, String s) {
        Enumeration e = b.getEntryPaths(s);
        if (e!=null) {
            while (e.hasMoreElements()) {
                String next = (String)e.nextElement();
                System.out.println(next);
                printEntryPaths(b, next);
            }
        }
    }

    If I call printEntryPaths(someBundle, "/"), it should print all the
entries, right? But, it does not. I test it for a bundle for which "jar"
command prints the following:
jar tf /tmp/someBundle.jar

META-INF/MANIFEST.MF
WEB-INF/web.xml
index.html

For this bundle, the above code only prints:
index.html

I think it is related to the fact that there are no directory entries
for META-INF and WEB-INF in the jar.

Thanks,
Sahoo

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@glassfish.dev.java.net
For additional commands, e-mail: users-help@glassfish.dev.java.net


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
For additional commands, e-mail: users-help@felix.apache.org