You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@felix.apache.org by "Carsten Ziegeler (JIRA)" <ji...@apache.org> on 2013/08/11 16:44:47 UTC

[jira] [Commented] (FELIX-4192) SCR Generator fails with a NPE in case a class level Reference doesn't define a referenceInterface

    [ https://issues.apache.org/jira/browse/FELIX-4192?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13736290#comment-13736290 ] 

Carsten Ziegeler commented on FELIX-4192:
-----------------------------------------

Thanks for reporting, I just committed a potential fix to trunk, maybe you can give it a try?

We changed the order in the generator and now validate after method signatures are check, resulting in above problem. With my patch method signatures and methods generation is skipped if no interface name is set. And this should then fail during validation
                
> SCR Generator fails with a NPE in case a class level Reference doesn't define a referenceInterface
> --------------------------------------------------------------------------------------------------
>
>                 Key: FELIX-4192
>                 URL: https://issues.apache.org/jira/browse/FELIX-4192
>             Project: Felix
>          Issue Type: Bug
>          Components: Maven SCR Plugin
>    Affects Versions: scr generator 1.8.0
>         Environment: JDK7
>            Reporter: Daniel Kuffner
>            Assignee: Carsten Ziegeler
>            Priority: Minor
>             Fix For: scr generator 1.8.2
>
>
> Consider following simple component:
> {code}
> @Component
> @Reference(name="a", bind="setA", unbind="unsetA")
> public class MyJavaClass {
> }
> {code}
> the generator will fail with a NPE (see stacktrace). It would be preferable if the generator will fail with a usfull error message.
> Stacktrace:
> {code}
> java.lang.NullPointerException
> 	at java.util.concurrent.ConcurrentHashMap.hash(ConcurrentHashMap.java:332)
> 	at java.util.concurrent.ConcurrentHashMap.putIfAbsent(ConcurrentHashMap.java:1144)
> 	at java.lang.ClassLoader.getClassLoadingLock(ClassLoader.java:462)
> 	at java.lang.ClassLoader.loadClass(ClassLoader.java:403)
> 	at java.lang.ClassLoader.loadClass(ClassLoader.java:356)
> 	at org.apache.felix.scrplugin.helper.Validator.findMethod(Validator.java:568)
> 	at org.apache.felix.scrplugin.SCRDescriptorGenerator.processReferences(SCRDescriptorGenerator.java:647)
> 	at org.apache.felix.scrplugin.SCRDescriptorGenerator.createComponent(SCRDescriptorGenerator.java:384)
> 	at org.apache.felix.scrplugin.SCRDescriptorGenerator.execute(SCRDescriptorGenerator.java:161)
> 	at net.chilicat.felixscr.intellij.build.scr.AbstractScrProcessor.executeImpl(AbstractScrProcessor.java:86)
> 	at net.chilicat.felixscr.intellij.build.scr.AbstractScrProcessor.execute(AbstractScrProcessor.java:42)
> 	at net.chilicat.felixscr.intellij.build.ScrProcessingItem.execute(ScrProcessingItem.java:39)
> 	at net.chilicat.felixscr.intellij.build.ScrCompiler.process(ScrCompiler.java:108)
> 	
> {code}

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira