Frode Austvik created CXF-7323:
----------------------------------

             Summary: ResourceInjector swallows @PostConstruct exceptions
                 Key: CXF-7323
                 URL: https://issues.apache.org/jira/browse/CXF-7323
             Project: CXF
          Issue Type: Bug
          Components: Core
    Affects Versions: 3.1.10, 3.1.9
            Reporter: Frode Austvik


JSR-250 section 2.5 about {{@PostConstruct}} says (about the annotated method) 
"If the method throws an unchecked exception the class MUST NOT be put into 
service."

However, ResourceInjector just [logs the 
exception|https://github.com/apache/cxf/blob/cxf-3.1.10/core/src/main/java/org/apache/cxf/common/injection/ResourceInjector.java#L350]
 and otherwise ignores it, which makes it impossible to know that the object 
should not be put into service.

I expected that the unchecked exceptions thrown by my resource classes when 
initialization fails would simply be let through to the calling code, so I 
could handle the failure properly (or if I didn't, the application startup 
would fail). Instead, the class is put into service as if the exception didn't 
happen, which causes further failures later when the class is used.



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)

Reply via email to