Mantis - Resin
|
|||||
Viewing Issue Advanced Details | |||||
|
|||||
ID: | Category: | Severity: | Reproducibility: | Date Submitted: | Last Update: |
2483 | minor | always | 03-03-08 09:22 | 03-03-08 14:03 | |
|
|||||
Reporter: | ferg | Platform: | |||
Assigned To: | ferg | OS: | |||
Priority: | normal | OS Version: | |||
Status: | closed | Product Version: | 3.1.5 | ||
Product Build: | Resolution: | fixed | |||
Projection: | none | ||||
ETA: | none | Fixed in Version: | 3.1.6 | ||
|
|||||
Summary: | 0002483: IoC/interceptor with exceptions | ||||
Description: |
(rep by wesley) I've upgraded my 3.1..s080202 snapshot to release 3.1.5 today, and found my intercepted components broken. After some examinations, I think the problem should be the runtime weaver who was responsible to generate code for webbeans component annotated to be intercepted. The attachment is an IntelliJ IDEA project which contains a trivial servlet calling a injected service to output "hello" to html out. There're four classes below: ================the binding type, no problem============ package com.mycompany.interceptors; import javax.webbeans.InterceptorBindingType; import java.lang.annotation.*; @InterceptorBindingType @Target({ElementType.METHOD, ElementType.TYPE}) @Retention(RetentionPolicy.RUNTIME) public @interface Cachable { } =============================================== ================the interceptor, no problem============ package com.mycompany.interceptors; import javax.interceptor.AroundInvoke; import javax.interceptor.InvocationContext; import javax.webbeans.Interceptor; @Cachable @Interceptor public class CacheInterceptor { public CacheInterceptor() { } @AroundInvoke public Object invoke(final InvocationContext invocation) throws Throwable { System.out.println("intercepted"); return invocation.proceed(); } } =============================================== ================the servlet, no problem================ package com.mycompany.servlet; import com.mycompany.services.TestService; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import javax.servlet.ServletException; import javax.webbeans.In; import java.io.IOException; public class MyServlet extends HttpServlet { @In TestService service; protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { try { response.getOutputStream().print(service.service()); } catch (Exception e) { throw new ServletException(e); } } } =============================================== ================the service component, BUG!!!!!========== package com.mycompany.services; import com.mycompany.interceptors.Cachable; import javax.webbeans.Component; @Component public class TestService { public TestService() { } @Cachable public String service() throws Exception { // todo bug: if not throws Exception, everything is ok return "hello"; } } =============================================== Note the TODO in the service component code. |
||||
Steps To Reproduce: | |||||
Additional Information: | |||||
Relationships | |||||
Attached Files: |
Notes | |||||
|
|||||
|
|