felix-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Carsten Ziegeler (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (FELIX-5627) Class loading issues while finding fields causes an NPE
Date Fri, 28 Apr 2017 05:42:04 GMT

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

Carsten Ziegeler commented on FELIX-5627:

I've added a null check in http://svn.apache.org/viewvc?rev=1792985&view=rev 
I think the R7 branch is not affected as the code has been refactored there
But we still should fix the global lock problem for fields

> Class loading issues while finding fields causes an NPE
> -------------------------------------------------------
>                 Key: FELIX-5627
>                 URL: https://issues.apache.org/jira/browse/FELIX-5627
>             Project: Felix
>          Issue Type: Bug
>          Components: Declarative Services (SCR)
>            Reporter: Thomas Watson
>             Fix For: scr-2.0.12
> See eclipse bug https://bugs.eclipse.org/bugs/show_bug.cgi?id=515873
> The following snippet of an NPE can happen
> Caused by: java.lang.NullPointerException
> 	at org.apache.felix.scr.impl.inject.FieldHandler.validateField(FieldHandler.java:279)
> 	at org.apache.felix.scr.impl.inject.FieldHandler.access$500(FieldHandler.java:51)
> 	at org.apache.felix.scr.impl.inject.FieldHandler$NotResolved.resolve(FieldHandler.java:839)
> 	at org.apache.felix.scr.impl.inject.FieldHandler$NotResolved.fieldExists(FieldHandler.java:864)
> 	at org.apache.felix.scr.impl.inject.FieldHandler.fieldExists(FieldHandler.java:918)
> This is because org.apache.felix.scr.impl.inject.FieldHandler.findField(SimpleLogger)
can return null.  In this case it is returning null because of a NoClassDefFoundError which
is caught in org.apache.felix.scr.impl.inject.FieldHandler.getField(Class<?>, boolean,
boolean, SimpleLogger) and null ultimately is returned.  It seems a null check is the correct
fix here since later on it appears that null may be used when things are not as expected.
> While investigating this issue I found the field handler implementation suffers from
the same global lock strategy as the BaseMethod implementation did in FELIX-5615

This message was sent by Atlassian JIRA

View raw message