No longer need to try to resolve during class loading, since
this is now done before (except for dynamic imports). (FELIX-2950)


git-svn-id: https://svn.apache.org/repos/asf/felix/trunk@1153261 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/framework/src/main/java/org/apache/felix/framework/BundleWiringImpl.java b/framework/src/main/java/org/apache/felix/framework/BundleWiringImpl.java
index 1deb598..f586fba 100644
--- a/framework/src/main/java/org/apache/felix/framework/BundleWiringImpl.java
+++ b/framework/src/main/java/org/apache/felix/framework/BundleWiringImpl.java
@@ -1027,19 +1027,6 @@
         Enumeration urls = null;
         List completeUrlList = new ArrayList();
 
-        // First, try to resolve the originating module.
-        try
-        {
-            m_resolver.resolve(m_revision);
-        }
-        catch (Exception ex)
-        {
-            // The spec states that if the bundle cannot be resolved, then
-            // only the local bundle's resources should be searched. So we
-            // will ask the module's own class path.
-            return m_revision.getResourcesLocal(name);
-        }
-
         // Get the package of the target class/resource.
         String pkgName = Util.getResourcePackage(name);
 
@@ -1377,9 +1364,6 @@
         {
             try
             {
-                // First, try to resolve the originating revision.
-                m_resolver.resolve(m_revision);
-
                 // Get the package of the target class/resource.
                 String pkgName = (isClass)
                     ? Util.getClassPackage(name)
@@ -1433,54 +1417,6 @@
                     }
                 }
             }
-// TODO: OSGi R4.3/ELIMINATE RESOLVE - If we eliminate resolving from this method, then we can
-//       simplify this catch, since resolve throws resolve and bundle exceptions.
-            catch (Exception ex)
-            {
-                if (!isClass && (ex instanceof ResolveException))
-                {
-                    // The spec states that if the bundle cannot be resolved, then
-                    // only the local bundle's resources should be searched. So we
-                    // will ask the module's own class path.
-                    URL url = m_revision.getResourceLocal(name);
-                    if (url != null)
-                    {
-                        return url;
-                    }
-                }
-
-                if (isClass)
-                {
-                    if (!(ex instanceof ClassNotFoundException))
-                    {
-                        ClassNotFoundException cnfe = new ClassNotFoundException(
-                            name
-                            + " not found in "
-                            + getBundle()
-                            + " : "
-                            + ex.getMessage());
-ex.printStackTrace();
-                        cnfe.initCause(ex);
-                        throw cnfe;
-                    }
-                    throw (ClassNotFoundException) ex;
-                }
-                else
-                {
-                    if (!(ex instanceof ResourceNotFoundException))
-                    {
-                        ResourceNotFoundException rnfe = new ResourceNotFoundException(
-                            name
-                            + " not found in "
-                            + getBundle()
-                            + " : "
-                            + ex.getMessage());
-                        rnfe.initCause(ex);
-                        throw rnfe;
-                    }
-                    throw (ResourceNotFoundException) ex;
-                }
-            }
             finally
             {
                 requestSet.remove(name);
diff --git a/framework/src/main/java/org/apache/felix/framework/Felix.java b/framework/src/main/java/org/apache/felix/framework/Felix.java
index beb42a2..186f3e8 100644
--- a/framework/src/main/java/org/apache/felix/framework/Felix.java
+++ b/framework/src/main/java/org/apache/felix/framework/Felix.java
@@ -1523,12 +1523,6 @@
         {
             return null;
         }
-// TODO: OSGi R4.3/ELIMINATE RESOLVE - Previously, we try to resolve resource requests in
-//       findClassOrResourceByDelegation() and fall back to local resource
-//       searching if it fails. Now we must attempt the resolve here since
-//       we cannot search by delegation until we are resolved and do the local
-//       searching here if we fail. This means we could get rid of resolve
-//       attempts in findClassOrResourceByDelegation().
         try
         {
             resolveBundleRevision(bundle.adapt(BundleRevision.class));
@@ -1565,12 +1559,6 @@
         {
             return null;
         }
-// TODO: OSGi R4.3/ELIMINATE RESOLVE - Previously, we try to resolve resource requests in
-//       findClassOrResourceByDelegation() and fall back to local resource
-//       searching if it fails. Now we must attempt the resolve here since
-//       we cannot search by delegation until we are resolved and do the local
-//       searching here if we fail. This means we could get rid of resolve
-//       attempts in findClassOrResourceByDelegation().
         try
         {
             resolveBundleRevision(bundle.adapt(BundleRevision.class));
diff --git a/framework/src/main/java/org/apache/felix/framework/resolver/ResourceNotFoundException.java b/framework/src/main/java/org/apache/felix/framework/resolver/ResourceNotFoundException.java
index 3cb5107..b1903fb 100644
--- a/framework/src/main/java/org/apache/felix/framework/resolver/ResourceNotFoundException.java
+++ b/framework/src/main/java/org/apache/felix/framework/resolver/ResourceNotFoundException.java
@@ -1,4 +1,4 @@
-/* 
+/*
  * Licensed to the Apache Software Foundation (ASF) under one
  * or more contributor license agreements.  See the NOTICE file
  * distributed with this work for additional information
@@ -24,4 +24,9 @@
     {
         super(msg);
     }
+
+    public ResourceNotFoundException(String msg, Throwable th)
+    {
+        super(msg, th);
+    }
 }
\ No newline at end of file