FELIX-1274: Spring deployer fails when bean class is from java.* packages
git-svn-id: https://svn.apache.org/repos/asf/felix/trunk@798076 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/karaf/deployer/blueprint/src/main/java/org/apache/felix/karaf/deployer/blueprint/BlueprintTransformer.java b/karaf/deployer/blueprint/src/main/java/org/apache/felix/karaf/deployer/blueprint/BlueprintTransformer.java
index 8e9de70..1c5c0ed 100644
--- a/karaf/deployer/blueprint/src/main/java/org/apache/felix/karaf/deployer/blueprint/BlueprintTransformer.java
+++ b/karaf/deployer/blueprint/src/main/java/org/apache/felix/karaf/deployer/blueprint/BlueprintTransformer.java
@@ -207,7 +207,10 @@
for (int i = 0; i < parts.length; i++) {
int n = parts[i].lastIndexOf('.');
if (n > 0) {
- refers.add(parts[i].substring(0, n));
+ String pkg = parts[i].substring(0, n);
+ if (!pkg.startsWith("java.")) {
+ refers.add(pkg);
+ }
}
}
}
diff --git a/karaf/deployer/blueprint/src/test/java/org/apache/felix/karaf/deployer/blueprint/BlueprintDeploymentListenerTest.java b/karaf/deployer/blueprint/src/test/java/org/apache/felix/karaf/deployer/blueprint/BlueprintDeploymentListenerTest.java
index 88865b9..4a4e517 100644
--- a/karaf/deployer/blueprint/src/test/java/org/apache/felix/karaf/deployer/blueprint/BlueprintDeploymentListenerTest.java
+++ b/karaf/deployer/blueprint/src/test/java/org/apache/felix/karaf/deployer/blueprint/BlueprintDeploymentListenerTest.java
@@ -37,9 +37,8 @@
File f = new File(getClass().getClassLoader().getResource("test.xml").toURI());
Set<String> pkgs = BlueprintTransformer.analyze(new DOMSource(BlueprintTransformer.parse(f.toURL())));
assertNotNull(pkgs);
- assertEquals(2, pkgs.size());
+ assertEquals(1, pkgs.size());
Iterator<String> it = pkgs.iterator();
- assertEquals("java.lang", it.next());
assertEquals("org.apache.geronimo.blueprint.sample", it.next());
}
diff --git a/karaf/deployer/spring/src/main/java/org/apache/felix/karaf/deployer/spring/SpringTransformer.java b/karaf/deployer/spring/src/main/java/org/apache/felix/karaf/deployer/spring/SpringTransformer.java
index fe5ec5e..7564ab0 100644
--- a/karaf/deployer/spring/src/main/java/org/apache/felix/karaf/deployer/spring/SpringTransformer.java
+++ b/karaf/deployer/spring/src/main/java/org/apache/felix/karaf/deployer/spring/SpringTransformer.java
@@ -208,7 +208,10 @@
for (int i = 0; i < parts.length; i++) {
int n = parts[i].lastIndexOf('.');
if (n > 0) {
- refers.add(parts[i].substring(0, n));
+ String pkg = parts[i].substring(0, n);
+ if (!pkg.startsWith("java.")) {
+ refers.add(parts[i].substring(0, n));
+ }
}
}
}
diff --git a/karaf/deployer/spring/src/test/resources/test.xml b/karaf/deployer/spring/src/test/resources/test.xml
index b47596e..0b6ea23 100644
--- a/karaf/deployer/spring/src/test/resources/test.xml
+++ b/karaf/deployer/spring/src/test/resources/test.xml
@@ -52,4 +52,8 @@
</osgi:service-properties>
</osgi:service>
+ <bean id="uri" class="java.net.URI">
+ <constructor-arg value="urn:resource"/>
+ </bean>
+
</beans>