Details
-
Bug
-
Status: Closed
-
Minor
-
Resolution: Fixed
-
maven-scr-plugin-1.4.0
-
None
Description
under certain circumstances the maven scr plugin throws a NPE like this
java.lang.NullPointerException
at org.apache.felix.scrplugin.tags.annotation.defaulttag.Util.getAnnotationValue(Util.java:362)
at org.apache.felix.scrplugin.tags.annotation.defaulttag.Util.getAnnotationValues(Util.java:399)
at org.apache.felix.scrplugin.tags.annotation.defaulttag.Util.getStringValue(Util.java:277)
at org.cqstone.core.annotationtagprovider.ComponentComponentTag.<init>(ComponentComponentTag.java:31)
at org.cqstone.core.annotationtagprovider.CqstoneAnnotationTagProvider.getTags(CqstoneAnnotationTagProvider.java:31)
at org.apache.felix.scrplugin.tags.annotation.AnnotationTagProviderManager.getTags(AnnotationTagProviderManager.java:105)
at org.apache.felix.scrplugin.tags.annotation.AnnotationTagProviderManager.getTags(AnnotationTagProviderManager.java:90)
at org.apache.felix.scrplugin.tags.annotation.AnnotationTagProviderManager.hasScrPluginAnnotation(AnnotationTagProviderManager.java:118)
at org.apache.felix.scrplugin.tags.JavaClassDescriptorManager.getJavaClassDescription(JavaClassDescriptorManager.java:417)
at org.apache.felix.scrplugin.tags.JavaClassDescriptorManager.getSourceDescriptions(JavaClassDescriptorManager.java:394)
at org.apache.felix.scrplugin.SCRDescriptorMojo.execute(SCRDescriptorMojo.java:167)
at org.apache.maven.plugin.DefaultPluginManager.executeMojo(DefaultPluginManager.java:490)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleExecutor.java:694)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeStandaloneGoal(DefaultLifecycleExecutor.java:569)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoal(DefaultLifecycleExecutor.java:539)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalAndHandleFailures(DefaultLifecycleExecutor.java:387)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeTaskSegments(DefaultLifecycleExecutor.java:348)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute(DefaultLifecycleExecutor.java:180)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:328)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:138)
at org.apache.maven.cli.MavenCli.main(MavenCli.java:362)
at org.apache.maven.cli.compat.CompatibleMain.main(CompatibleMain.java:60)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.codehaus.classworlds.Launcher.launchEnhanced(Launcher.java:315)
at org.codehaus.classworlds.Launcher.launch(Launcher.java:255)
at org.codehaus.classworlds.Launcher.mainWithExitCode(Launcher.java:430)
at org.codehaus.classworlds.Launcher.main(Launcher.java:375)
the reason of the NPE is that the "prescan" which is done in AnnotationTagProviderManager#hasScrPluginAnnotation to check if any annotation is present in a java class at all calls the getTags methods without a "JavaClassDescription" object. but Util.getAnnotationValue depends on this, although this is not needed for the "prescan" check.
the attached patch fixes this problem.