users@glassfish.java.net

Re: How to iterate over all the entries of a bundle?

From: Sahoo <Sahoo_at_Sun.COM>
Date: Sun, 07 Jun 2009 13:29:51 +0530

Ignore this email which got sent to wrong alias.

Sahoo wrote:
> 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_at_glassfish.dev.java.net
> For additional commands, e-mail: users-help_at_glassfish.dev.java.net
>