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 2006/02/05 14:23:03 UTC
svn commit: r375024 -
/incubator/felix/trunk/org.apache.felix.framework/src/main/java/org/apache/felix/framework/searchpolicy/R4SearchPolicyCore.java
Author: rickhall
Date: Sun Feb 5 05:23:03 2006
New Revision: 375024
URL: http://svn.apache.org/viewcvs?rev=375024&view=rev
Log:
Modified the R4 search policy to search the bundle's class path for
resources if the bundle cannot be resolved as described by the spec;
if the bundle is resolved then imported packages are also searched.
Modified:
incubator/felix/trunk/org.apache.felix.framework/src/main/java/org/apache/felix/framework/searchpolicy/R4SearchPolicyCore.java
Modified: incubator/felix/trunk/org.apache.felix.framework/src/main/java/org/apache/felix/framework/searchpolicy/R4SearchPolicyCore.java
URL: http://svn.apache.org/viewcvs/incubator/felix/trunk/org.apache.felix.framework/src/main/java/org/apache/felix/framework/searchpolicy/R4SearchPolicyCore.java?rev=375024&r1=375023&r2=375024&view=diff
==============================================================================
--- incubator/felix/trunk/org.apache.felix.framework/src/main/java/org/apache/felix/framework/searchpolicy/R4SearchPolicyCore.java (original)
+++ incubator/felix/trunk/org.apache.felix.framework/src/main/java/org/apache/felix/framework/searchpolicy/R4SearchPolicyCore.java Sun Feb 5 05:23:03 2006
@@ -275,13 +275,13 @@
// these packages cannot be provided by other bundles.
if (pkgName.startsWith("java."))
{
- return this.getClass().getClassLoader().loadClass(name);
+ return getClass().getClassLoader().loadClass(name);
}
// Look in the module's imports.
Class clazz = findImportedClass(module, name, pkgName);
- // If not found, try the module's own content.
+ // If not found, try the module's own class path.
if (clazz == null)
{
clazz = module.getContentLoader().getClass(name);
@@ -404,9 +404,16 @@
}
catch (ResolveException ex)
{
- // We do not use the resolve exception as the
- // cause of the exception, since this would
- // potentially leak internal module information.
+ // 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 = module.getContentLoader().getResource(name);
+ if (url != null)
+ {
+ return url;
+ }
+
+ // We need to throw a resource not found exception.
throw new ResourceNotFoundException(
name + ": cannot resolve package "
+ ex.getPackage());
@@ -419,13 +426,13 @@
// these packages cannot be provided by other bundles.
if (pkgName.startsWith("java."))
{
- return this.getClass().getClassLoader().getResource(name);
+ return getClass().getClassLoader().getResource(name);
}
// Look in the module's imports.
URL url = findImportedResource(module, name);
- // If not found, try the module's own content.
+ // If not found, try the module's own class path.
if (url == null)
{
url = module.getContentLoader().getResource(name);