You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@felix.apache.org by "Carsten Ziegeler (JIRA)" <ji...@apache.org> on 2018/04/04 12:34:02 UTC

[jira] [Commented] (FELIX-5786) DS does not propagate activation exceptions from ComponentFactory.newInstance()

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

Carsten Ziegeler commented on FELIX-5786:
-----------------------------------------

While I agree that this would be nice, I currently see no easy way to implement it as the exception somehow needs to be propagated up the call stack (without throwing it)

> DS does not propagate activation exceptions from ComponentFactory.newInstance()
> -------------------------------------------------------------------------------
>
>                 Key: FELIX-5786
>                 URL: https://issues.apache.org/jira/browse/FELIX-5786
>             Project: Felix
>          Issue Type: Bug
>          Components: Declarative Services (SCR)
>    Affects Versions: scr-2.0.16
>            Reporter: Todor Boev
>            Priority: Minor
>             Fix For: scr-2.0.16
>
>
> For Factory Components when {{ComponentFactory.newInstance()}} is called and this leads to a failure of the component {{activate()}} method the exception that method throws is not propagated to the caller of {{ComponentFactory.newInstance()}}.
> Although the DS spec does not seem to require that this error propagation is done nevertheless this seems like a natural thing to expect  on one hand and on another it can be extremely useful for certain use cases.
> The use case that exposed this is:
> - A server offers the uses means to create service components
> - The components are created from data received in the rest request - not from configuration.
> - The users expect synchronous reply of success or failure. In case of failure the users must get a meaningful error message.
> - The activate() method validates the configuration and fails with an exception if invalid.
> - The exception is retrieved from {{ComponentException.getCause()}} and the error is sent back in the rest reply.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)