You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@felix.apache.org by ri...@apache.org on 2011/08/02 22:08:51 UTC

svn commit: r1153261 - in /felix/trunk/framework/src/main/java/org/apache/felix/framework: BundleWiringImpl.java Felix.java resolver/ResourceNotFoundException.java

Author: rickhall
Date: Tue Aug  2 20:08:50 2011
New Revision: 1153261

URL: http://svn.apache.org/viewvc?rev=1153261&view=rev
Log:
No longer need to try to resolve during class loading, since
this is now done before (except for dynamic imports). (FELIX-2950)

Modified:
    felix/trunk/framework/src/main/java/org/apache/felix/framework/BundleWiringImpl.java
    felix/trunk/framework/src/main/java/org/apache/felix/framework/Felix.java
    felix/trunk/framework/src/main/java/org/apache/felix/framework/resolver/ResourceNotFoundException.java

Modified: felix/trunk/framework/src/main/java/org/apache/felix/framework/BundleWiringImpl.java
URL: http://svn.apache.org/viewvc/felix/trunk/framework/src/main/java/org/apache/felix/framework/BundleWiringImpl.java?rev=1153261&r1=1153260&r2=1153261&view=diff
==============================================================================
--- felix/trunk/framework/src/main/java/org/apache/felix/framework/BundleWiringImpl.java (original)
+++ felix/trunk/framework/src/main/java/org/apache/felix/framework/BundleWiringImpl.java Tue Aug  2 20:08:50 2011
@@ -1027,19 +1027,6 @@ public class BundleWiringImpl implements
         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 @@ public class BundleWiringImpl implements
         {
             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 @@ public class BundleWiringImpl implements
                     }
                 }
             }
-// 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);

Modified: felix/trunk/framework/src/main/java/org/apache/felix/framework/Felix.java
URL: http://svn.apache.org/viewvc/felix/trunk/framework/src/main/java/org/apache/felix/framework/Felix.java?rev=1153261&r1=1153260&r2=1153261&view=diff
==============================================================================
--- felix/trunk/framework/src/main/java/org/apache/felix/framework/Felix.java (original)
+++ felix/trunk/framework/src/main/java/org/apache/felix/framework/Felix.java Tue Aug  2 20:08:50 2011
@@ -1523,12 +1523,6 @@ public class Felix extends BundleImpl im
         {
             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 @@ public class Felix extends BundleImpl im
         {
             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));

Modified: felix/trunk/framework/src/main/java/org/apache/felix/framework/resolver/ResourceNotFoundException.java
URL: http://svn.apache.org/viewvc/felix/trunk/framework/src/main/java/org/apache/felix/framework/resolver/ResourceNotFoundException.java?rev=1153261&r1=1153260&r2=1153261&view=diff
==============================================================================
--- felix/trunk/framework/src/main/java/org/apache/felix/framework/resolver/ResourceNotFoundException.java (original)
+++ felix/trunk/framework/src/main/java/org/apache/felix/framework/resolver/ResourceNotFoundException.java Tue Aug  2 20:08:50 2011
@@ -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 @@ public class ResourceNotFoundException e
     {
         super(msg);
     }
+
+    public ResourceNotFoundException(String msg, Throwable th)
+    {
+        super(msg, th);
+    }
 }
\ No newline at end of file