Hello everyone,

I am trying to use the new "updated" attribute of the Reference element
(see FELIX-1893)

My SCR descriptor is like this:

<?xml version="1.0" encoding="UTF-8"?>
<components xmlns:scr="http://www.osgi.org/xmlns/scr/v1.1.0-felix";>
    <scr:component enabled="true"
name="org.apache.felix.scrplugin.sample.MyClient">
        <implementation class="org.apache.felix.scrplugin.sample.MyClient"/>
        <property name="service.pid"
value="org.apache.felix.scrplugin.sample.MyClient"/>
        <reference name="myService"
interface="org.apache.felix.scrplugin.sample.MyService" cardinality="1..1"
policy="static" bind="bind" unbind="unbindMyService" updated="updated"/>
    </scr:component>
</components>

and my component is defined like this, using the scrplugin annotations:

import org.apache.felix.scr.annotations.Component;
import org.apache.felix.scr.annotations.Reference;

public @Component(specVersion="1.1-felix")
class MyClient
{
    @Reference(bind="bind", updated="updated")
    MyService myService;

    void bind(MyService myService) {}
    void updated(MyService myService) {}
}

But I get this exception:

java.lang.NullPointerException
        at
org.apache.felix.scr.impl.metadata.XmlHandler.startElement(XmlHandler.java:237)
        at
org.apache.felix.scr.impl.parser.KXml2SAXParser.parseXML(KXml2SAXParser.java:73)
        at
org.apache.felix.scr.impl.BundleComponentActivator.loadDescriptor(BundleComponentActivator.java:227)
        at
org.apache.felix.scr.impl.BundleComponentActivator.initialize(BundleComponentActivator.java:147)
        at
org.apache.felix.scr.impl.BundleComponentActivator.<init>(BundleComponentActivator.java:111)
        at
org.apache.felix.scr.impl.Activator.loadComponents(Activator.java:255)
        at
org.apache.felix.scr.impl.Activator.bundleChanged(Activator.java:173)
        at
org.apache.felix.framework.util.EventDispatcher.invokeBundleListenerCallback(EventDispatcher.java:800)
        at
org.apache.felix.framework.util.EventDispatcher.fireEventImmediately(EventDispatcher.java:728)
        at
org.apache.felix.framework.util.EventDispatcher.fireBundleEvent(EventDispatcher.java:610)
        at org.apache.felix.framework.Felix.fireBundleEvent(Felix.java:3669)
        at org.apache.felix.framework.Felix.startBundle(Felix.java:1750)
        at
org.apache.felix.framework.Felix.setActiveStartLevel(Felix.java:1168)
        at
org.apache.felix.framework.StartLevelImpl.run(StartLevelImpl.java:264)
        at java.lang.Thread.run(Thread.java:619)


So, Am I correct with the spec specified in the annotation ? or may be this
is an issue ?

Thanks for your help;
/pierre

Reply via email to