felix-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Thomas Watson (JIRA)" <j...@apache.org>
Subject [jira] [Resolved] (FELIX-5627) Class loading issues while finding fields causes an NPE
Date Mon, 01 May 2017 16:17:04 GMT

     [ https://issues.apache.org/jira/browse/FELIX-5627?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel

Thomas Watson resolved FELIX-5627.
    Resolution: Fixed

I opened FELIX-5628 to track the global lock problem as a separate issue. Marking this issue
as resolved.

> 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