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

Pierre Bourret commented on FELIX-1938:
---------------------------------------

Right ! The subscriber configuration parser do not check that if the data-type 
attribute is provided, the data-key attribute is set. The handler consider that 
a subscriber configured in this manner is not a data-subscriber beacause the 
data-key is not set, and so try to find the classical event callback (the one 
that receive org.osgi.service.event.Event).

The attached patch should fix this. Because of a lack of time, it has not been 
tested, so please send feedback :)

> Bad error message when an Event Subscriber does not set the data type and 
> data key
> ----------------------------------------------------------------------------------
>
>                 Key: FELIX-1938
>                 URL: https://issues.apache.org/jira/browse/FELIX-1938
>             Project: Felix
>          Issue Type: Bug
>          Components: iPOJO
>    Affects Versions: iPOJO-1.4.0
>            Reporter: Clement Escoffier
>
> The event admin handler should do a better job in reporting error. Especially 
> the following subscriber (missing the data_key attribute):
> @Subscriber(name = "tdmEventSubscriber-1", topics = "tdmEventTopic", 
> data_type = "java.lang.String")
>  public void receive(String msg) {
>         System.out.println("[DATA RECEIVER] Receive event on tdmEventTopic : 
> " + msg);
>  }
> will throw this exception:
> -> [ERROR] de.akquinet.gomobile.ea.test.SubscriberTest : Cannot find callback 
> method receive(org.osgi.service.event.Event)
> [ERROR] IPOJO-Extender : An error occurs when analyzing the content or 
> starting the management of 17
> java.lang.IllegalStateException: Cannot find callback method 
> receive(org.osgi.service.event.Event)
>       at 
> org.apache.felix.ipojo.IPojoFactory.computeDescription(IPojoFactory.java:673)
>       at 
> org.apache.felix.ipojo.IPojoFactory.computeFactoryState(IPojoFactory.java:700)
>       at 
> org.apache.felix.ipojo.ComponentFactory.addedService(ComponentFactory.java:358)
>       at 
> org.apache.felix.ipojo.util.Tracker$Tracked.trackAdding(Tracker.java:709)
>       at 
> org.apache.felix.ipojo.util.Tracker$Tracked.trackInitialServices(Tracker.java:595)
>       at org.apache.felix.ipojo.util.Tracker.open(Tracker.java:203)
>       at 
> org.apache.felix.ipojo.ComponentFactory.starting(ComponentFactory.java:235)
>       at org.apache.felix.ipojo.IPojoFactory.start(IPojoFactory.java:574)
>       at 
> org.apache.felix.ipojo.Extender.createAbstractFactory(Extender.java:426)
>       at org.apache.felix.ipojo.Extender.parse(Extender.java:264)
>       at org.apache.felix.ipojo.Extender.startManagementFor(Extender.java:208)
>       at org.apache.felix.ipojo.Extender.access$600(Extender.java:52)
>       at org.apache.felix.ipojo.Extender$CreatorThread.run(Extender.java:669)
>       at java.lang.Thread.run(Thread.java:637)
> The handler has detected a problem but try to use a wrong method 
> (receiver(Event) instead of reporting the bad configuration and rejecting it.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to