Todor Boev created FELIX-5786:
---------------------------------
Summary: 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
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)