FELIX-2895 Don't use getResource any longer to find descriptors. The findEntry/findEntries methods are provided explicitly to access such configuration information. Also we do not want to use the class loaders to find the resource since these might also span imported packages - or worse - required bundles.

git-svn-id: https://svn.apache.org/repos/asf/felix/trunk@1180676 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/scr/src/main/java/org/apache/felix/scr/impl/BundleComponentActivator.java b/scr/src/main/java/org/apache/felix/scr/impl/BundleComponentActivator.java
index e68a04d..7dd4b53 100644
--- a/scr/src/main/java/org/apache/felix/scr/impl/BundleComponentActivator.java
+++ b/scr/src/main/java/org/apache/felix/scr/impl/BundleComponentActivator.java
@@ -164,18 +164,6 @@
             return new URL[0];
         }
 
-        // for compatibility with previoues versions (<= 1.0.8) use getResource() for non wildcarded entries
-        if ( descriptorLocation.indexOf( "*" ) == -1 )
-        {
-            final URL descriptor = bundle.getResource( descriptorLocation );
-            if ( descriptor == null )
-            {
-                return new URL[0];
-            }
-            return new URL[]
-                { descriptor };
-        }
-
         // split pattern and path
         final int lios = descriptorLocation.lastIndexOf( "/" );
         final String path;
diff --git a/scr/src/test/java/org/apache/felix/scr/impl/BundleComponentActivatorTest.java b/scr/src/test/java/org/apache/felix/scr/impl/BundleComponentActivatorTest.java
index edeb176..be110ce 100644
--- a/scr/src/test/java/org/apache/felix/scr/impl/BundleComponentActivatorTest.java
+++ b/scr/src/test/java/org/apache/felix/scr/impl/BundleComponentActivatorTest.java
@@ -78,22 +78,26 @@
      *
      * @throws MalformedURLException unexpected
      */
-    public void test_findDescriptors_withNonWildcardLocation()
-        throws MalformedURLException
+    public void test_findDescriptors_withNonWildcardLocation() throws MalformedURLException
     {
-        URL descriptor = new URL( "file:foo.xml" );
-        final Bundle bundle = (Bundle) EasyMock.createNiceMock( Bundle.class );
-        EasyMock.expect( bundle.getResource( "/some/location/foo.xml" ) ).andReturn( descriptor );
+        final URL[] descriptors = new URL[]
+            { new URL( "file:foo.xml" ) };
+        final Enumeration de = new Vector( Arrays.asList( descriptors ) ).elements();
+        final Bundle bundle = ( Bundle ) EasyMock.createNiceMock( Bundle.class );
+        EasyMock.expect( bundle.findEntries( "/some/location", "foo.xml", false ) ).andReturn( de );
 
-        EasyMock.replay( new Object[]{ bundle } );
+        EasyMock.replay( new Object[]
+            { bundle } );
         final URL[] urls = BundleComponentActivator.findDescriptors( bundle, "/some/location/foo.xml" );
-        EasyMock.verify( new Object[]{ bundle } );
+        EasyMock.verify( new Object[]
+            { bundle } );
 
         assertNotNull( "Descriptor array is not null", urls );
         assertEquals( "Descriptor length", 1, urls.length );
-        assertEquals( "Descriptor", descriptor, urls[ 0 ] );
+        assertEquals( "Descriptor", descriptors[0], urls[0] );
     }
 
+
     public void findDescriptors_withWildcardLocation( final String location,
                                                       final String path,
                                                       final String filePattern )