[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
RE: [equinox-dev] getResources in Servlet.init() - returns a resourcetwice

Hi Ravi,
That's definitely a bug; duplicates hsould be filtered. Please open a report.

From: equinox-dev-bounces@xxxxxxxxxxx [mailto:equinox-dev-bounces@xxxxxxxxxxx] On Behalf Of Ravindar Reddy
Sent: Tuesday, July 11, 2006 1:42 AM
To: Equinox development mailing list
Subject: [equinox-dev] getResources in Servlet.init() - returns a resourcetwice

The following code snippet is used to get a single resource URL that is packaged in the bundle jar. This code returns a single URL when invoked from BundleAcivator.activate() but returns two URLs when invoked from Servlet.init(). I printed out the classloader classes from these two invocations. I attached the test bundle to duplicate the issue. The BundleProxyClassLoader in servlet case is returning one through parent loader and one for 'this' loader. This seems like bug but I could be wrong. I am using the 3.2 release bundles for this test

        ClassLoader cl = Thread.currentThread().getContextClassLoader();
        Enumeration urls = cl.getResources("META-INF/helloworld.txt");
        System.out.println("Resources in bundle with classloader :" + cl);
        while(urls.hasMoreElements()) {
            URL url = "">            System.out.println(url);

==> Output from BundleAcivator.activate()
Resources in bundle with classloader :org.eclipse.core.runtime.internal.adaptor.ContextFinder@17494c8

==> Output from Servlet.init()
Resources in servlet with classloader :org.eclipse.equinox.servlet.bridge.http.internal.ServletRegistration$BundleProxyClassLoader@c0f1ec

-Ravi R
     This message may contain privileged and/or confidential information.  If you have received this e-mail in error or are not the intended recipient, you may not use, copy, disseminate or distribute it; do not open any attachments, delete it immediately from your system and notify the sender promptly by e-mail that you have done so.  Thank you.