FELIX-3117 : NullPointerException when not implementing interface that is defined with @Service
git-svn-id: https://svn.apache.org/repos/asf/felix/trunk@1176353 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/scrplugin/generator/changelog.txt b/scrplugin/generator/changelog.txt
index e72adcc..e108a81 100644
--- a/scrplugin/generator/changelog.txt
+++ b/scrplugin/generator/changelog.txt
@@ -3,6 +3,7 @@
** Bug
* [FELIX-2963] - scr annotations @Activate @Deactivate @Modified are not detected with class inheritance
+ * [FELIX-3117] - NullPointerException when not implementing interface that is defined with @Service
Changes from 1.1.0 to 1.1.2
diff --git a/scrplugin/generator/src/main/java/org/apache/felix/scrplugin/tags/cl/ClassLoaderJavaClassDescription.java b/scrplugin/generator/src/main/java/org/apache/felix/scrplugin/tags/cl/ClassLoaderJavaClassDescription.java
index 0c3e719..53b5110 100644
--- a/scrplugin/generator/src/main/java/org/apache/felix/scrplugin/tags/cl/ClassLoaderJavaClassDescription.java
+++ b/scrplugin/generator/src/main/java/org/apache/felix/scrplugin/tags/cl/ClassLoaderJavaClassDescription.java
@@ -234,14 +234,16 @@
return true;
}
- try {
- Class<?> typeClass = this.clazz.getClassLoader().loadClass( type );
- return typeClass.isAssignableFrom( this.clazz );
- } catch (ClassNotFoundException cnfe) {
- // cannot load the check type through the class' class loader
- // thus we assume clazz is not a type
- return false;
+ if ( this.clazz.getClassLoader() != null ) {
+ try {
+ Class<?> typeClass = this.clazz.getClassLoader().loadClass( type );
+ return typeClass.isAssignableFrom( this.clazz );
+ } catch (ClassNotFoundException cnfe) {
+ // cannot load the check type through the class' class loader
+ // thus we assume clazz is not a type
+ }
}
+ return false;
}
/**
diff --git a/scrplugin/maven-scr-plugin/changelog.txt b/scrplugin/maven-scr-plugin/changelog.txt
index 7774e7c..51a4248 100644
--- a/scrplugin/maven-scr-plugin/changelog.txt
+++ b/scrplugin/maven-scr-plugin/changelog.txt
@@ -3,6 +3,7 @@
** Bug
* [FELIX-2963] - scr annotations @Activate @Deactivate @Modified are not detected with class inheritance
+ * [FELIX-3117] - NullPointerException when not implementing interface that is defined with @Service
** Improvement
* [FELIX-3066] - Add support for source directory include filter via plugin configuration
diff --git a/scrplugin/maven-scr-plugin/src/main/java/org/apache/felix/scrplugin/mojo/MavenJavaClassDescriptorManager.java b/scrplugin/maven-scr-plugin/src/main/java/org/apache/felix/scrplugin/mojo/MavenJavaClassDescriptorManager.java
index 65ad96f..85fa2b9 100644
--- a/scrplugin/maven-scr-plugin/src/main/java/org/apache/felix/scrplugin/mojo/MavenJavaClassDescriptorManager.java
+++ b/scrplugin/maven-scr-plugin/src/main/java/org/apache/felix/scrplugin/mojo/MavenJavaClassDescriptorManager.java
@@ -24,7 +24,6 @@
import org.apache.felix.scrplugin.*;
import org.apache.felix.scrplugin.helper.StringUtils;
-import org.apache.felix.scrplugin.om.Component;
import org.apache.maven.artifact.Artifact;
import org.apache.maven.artifact.ArtifactUtils;
import org.apache.maven.project.MavenProject;
@@ -37,13 +36,9 @@
private final MavenProject project;
private final String includeString;
-
+
private final String excludeString;
- /** The component definitions from other bundles hashed by classname. */
- private Map<String, Component> componentDescriptions;
-
-
public MavenJavaClassDescriptorManager( MavenProject project, Log log, ClassLoader classLoader,
String[] annotationTagProviders, String includeString, String excludeString, boolean parseJavadocs, boolean processAnnotations )
throws SCRDescriptorFailureException
@@ -75,7 +70,7 @@
if ( includeString != null ) {
includes = StringUtils.split( includeString, "," );
}
-
+
final String[] excludes;
if ( excludeString != null )
{
diff --git a/scrplugin/scrtask/changelog.txt b/scrplugin/scrtask/changelog.txt
index a6fa5e3..1ac2f31 100644
--- a/scrplugin/scrtask/changelog.txt
+++ b/scrplugin/scrtask/changelog.txt
@@ -3,6 +3,7 @@
** Bug
* [FELIX-2963] - scr annotations @Activate @Deactivate @Modified are not detected with class inheritance
+ * [FELIX-3117] - NullPointerException when not implementing interface that is defined with @Service
Changes from 1.1.0 to 1.1.2