dev@glassfish.java.net

Re: How does OSGi Resolve Duplicates

From: Bill Shannon <bill.shannon_at_sun.com>
Date: Thu, 12 Nov 2009 11:09:31 -0800

Why do two jar files have a resource file of the same name?

A Java package (classes and resources) should really be in only one
jar file.

Don't tell me, run-script didn't get moved into its own package
when it was moved out of the admin CLI package?...


Byron Nevins wrote on 11/12/09 10:34 AM:
> LocalStrings is a class that handles strings coming from a file named
> LocalStrings.properties
>
> admin-cli.jar has such a properties file in it:
> c.s.e.admin.cli.LocalStrings.properties
>
> Now a completely separate OSGi module is developed that happens to also
> have its own c.s.e.admin.cli.LocalStrings.properties. This module has
> admin-cli.jar as a dependency.
>
> At runtime a call is made to fetch a string -- but it does NOT look
> inside its own module -- instead it looks in the properties file in
> admin-cli.jar!
> The call to getResource("c.s.e.admin.cli.LocalStrings.properties") picks
> up resources from /outside /the module that is making the call in
> preference to resources /inside /the module.
>
> That seems unpredictable and weird to me.
>
> Why does OSGi do that -- is it predictable?
> Is there some OSGi way to force getResource() to look only in the
> current module?
>
> (This is an actual bug that just appeared in a CLI extension module)
>
> --
> Byron Nevins - Sun Microsystems, Inc.
> Home: 650-359-1290
> Cell: 650-784-4123
> Sierra: 209-295-2188
>
> --------------------------------------------------------------------- To
> unsubscribe, e-mail: dev-unsubscribe_at_glassfish.dev.java.net For
> additional commands, e-mail: dev-help_at_glassfish.dev.java.net