felix-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Clement Escoffier (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (FELIX-4154) InstanceManager.setState() method should throws exception in case of failure
Date Mon, 01 Jul 2013 12:09:21 GMT

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

Clement Escoffier commented on FELIX-4154:
------------------------------------------

Hi,

>From where does come the the stack trace you gave ? It is just logged, but not re-thrown
? 

My first idea would be to rethrow the exception to the caller, and catch the exception in
the 'linker'. Maybe [~sauthieg] has a better idea. 

For the time being, you can just check that the instance is stopped. 
                
> InstanceManager.setState() method should throws exception in case of failure
> ----------------------------------------------------------------------------
>
>                 Key: FELIX-4154
>                 URL: https://issues.apache.org/jira/browse/FELIX-4154
>             Project: Felix
>          Issue Type: Bug
>          Components: iPOJO
>    Affects Versions: ipojo-runtime-1.10.1
>            Reporter: Mohammed Boukada
>
> In my use case, I create an instance of a component using factory.createComponentInstance(props).
If an error occurs in setState() method, it is managed internally and does not return anything
to the caller. 
> Code :
>  try {
>                     for (int i = 0; i < m_handlers.length; i++) {
>                         m_handlers[i].getHandler().stateChanged(state);
>                     }
>                 } catch (IllegalStateException e) {
>                     // When an illegal state exception happens, the instance manager
must be stopped immediately.
>                     stop();
>                     m_logger.log(Logger.ERROR, e.getMessage(), e);
>                     return;
>                 }
> Exception stack trace :
> java.lang.reflect.InvocationTargetException
> 	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> 	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
> 	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
> 	at java.lang.reflect.Method.invoke(Method.java:601)
> 	at org.apache.felix.ipojo.util.Callback.call(Callback.java:237)
> 	at org.apache.felix.ipojo.util.Callback.call(Callback.java:193)
> 	at org.apache.felix.ipojo.handlers.lifecycle.callback.LifecycleCallback.call(LifecycleCallback.java:86)
> 	at org.apache.felix.ipojo.handlers.lifecycle.callback.LifecycleCallbackHandler.__M_stateChanged(LifecycleCallbackHandler.java:162)
> 	at org.apache.felix.ipojo.handlers.lifecycle.callback.LifecycleCallbackHandler.stateChanged(LifecycleCallbackHandler.java)
> 	at org.apache.felix.ipojo.InstanceManager.setState(InstanceManager.java:536)
> 	at org.apache.felix.ipojo.InstanceManager.start(InstanceManager.java:418)
> 	at org.apache.felix.ipojo.ComponentFactory.createInstance(ComponentFactory.java:178)
> 	at org.apache.felix.ipojo.IPojoFactory.createComponentInstance(IPojoFactory.java:309)
> 	at org.apache.felix.ipojo.IPojoFactory.createComponentInstance(IPojoFactory.java:236)

--
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

Mime
View raw message