BJ and Tom, Thank you for your comments.
I got it. Best regards, Ikuo On Tue, 16 Mar 2010 08:19:46 -0500 Thomas Watson <[email protected]> wrote: Thomas> Thomas> Are you expecting the resource OSGI-INF/text.txt to exist in nested jars Thomas> contain on the Bundle-ClassPath? If not then you should simply use Thomas> Bundle.getEntry("OSGI-INF/text.txt") instead so you only search the raw Thomas> content of the bundle. This also avoids having to create a class loader Thomas> for all bundles you are searching since Bundle.getResource requires a class Thomas> loader to be created if the bundle is resolved. Thomas> Thomas> I agree with BJ a URL should be returned if the resource actually exists in Thomas> the bundle. Thomas> Thomas> Tom Thomas> Thomas> Thomas> Thomas> Thomas> |------------> Thomas> | From: | Thomas> |------------> Thomas> >--------------------------------------------------------------------------------------------------------------------------------------------------| Thomas> |BJ Hargrave/Austin/i...@ibmus | Thomas> >--------------------------------------------------------------------------------------------------------------------------------------------------| Thomas> |------------> Thomas> | To: | Thomas> |------------> Thomas> >--------------------------------------------------------------------------------------------------------------------------------------------------| Thomas> |OSGi Developer Mail List <[email protected]> | Thomas> >--------------------------------------------------------------------------------------------------------------------------------------------------| Thomas> |------------> Thomas> | Date: | Thomas> |------------> Thomas> >--------------------------------------------------------------------------------------------------------------------------------------------------| Thomas> |03/16/2010 07:48 AM | Thomas> >--------------------------------------------------------------------------------------------------------------------------------------------------| Thomas> |------------> Thomas> | Subject: | Thomas> |------------> Thomas> >--------------------------------------------------------------------------------------------------------------------------------------------------| Thomas> |Re: [osgi-dev] Q on Bundle#getResource() | Thomas> >--------------------------------------------------------------------------------------------------------------------------------------------------| Thomas> Thomas> Thomas> Thomas> Thomas> Thomas> I assume it will return the URL in both cases. Thomas> -- Thomas> Thomas> Thomas> Thomas> BJ Hargrave Thomas> Senior Technical Staff office: +1 386 848 Thomas> Member, IBM 1781 Thomas> OSGi Fellow and CTO of the mobile: +1 386 848 Thomas> OSGi Alliance 3788 Thomas> [email protected] Thomas> Thomas> Thomas> Thomas> Thomas> Thomas> Thomas> Thomas> Thomas> From: Ikuo Yamasaki <[email protected]> Thomas> Thomas> To: [email protected] Thomas> Thomas> Date: 2010/03/16 03:52 Thomas> Thomas> Subject: [osgi-dev] Q on Bundle#getResource() Thomas> Thomas> Sent by: [email protected] Thomas> Thomas> Thomas> Thomas> Thomas> Thomas> Thomas> Thomas> Hi OSGi Exports, Thomas> Thomas> I have questions on Bundle#getResource(String name). Thomas> Thomas> Let me assume that bundle1 would like to get resource of Thomas> "OSGI-INF/text.txt" in the bundle JAR file. Thomas> Thomas> Q1. Which should Bundle#getResource("OSGI-INF/test.txt") return, Thomas> the URL of the resource or null ? Thomas> Thomas> I expect the URL. Thomas> Thomas> Q2. Which should Bundle#getResource("/OSGI-INF/test.txt") return, Thomas> the URL of the resource or null ? Thomas> Thomas> I expect the URL as well, but not sure. Thomas> Thomas> The spec says "The name of the resource. See Thomas> java.lang.ClassLoader.getResource for a description Thomas> of the format of a resource name." I cannot find the any format of a Thomas> resource name in Thomas> http://java.sun.com/j2se/1.4.2/docs/api/java/lang/ClassLoader.html#getResource Thomas> (java.lang.String) Thomas> Thomas> Thomas> Best regards, Thomas> Thomas> --------------------- Thomas> NTT Cyber Solutions Laboratories Thomas> Thomas> Ikuo YAMASAKI Thomas> E-mail: [email protected] Thomas> TEL +81-46-859-8537 FAX +81-46-855-1282 Thomas> Thomas> Thomas> _______________________________________________ Thomas> OSGi Developer Mail List Thomas> [email protected] Thomas> https://mail.osgi.org/mailman/listinfo/osgi-dev Thomas> _______________________________________________ Thomas> OSGi Developer Mail List Thomas> [email protected] Thomas> https://mail.osgi.org/mailman/listinfo/osgi-dev _______________________________________________ OSGi Developer Mail List [email protected] https://mail.osgi.org/mailman/listinfo/osgi-dev
