Mantis Bugtracker
  

Viewing Issue Simple Details Jump to Notes ] View Advanced ] Issue History ] Print ]
ID Category Severity Reproducibility Date Submitted Last Update
0002483 [Resin] minor always 03-03-08 09:22 03-03-08 14:03
Reporter ferg View Status public  
Assigned To ferg
Priority normal Resolution fixed  
Status closed   Product Version 3.1.5
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.

Additional Information
Attached Files

- Relationships

- Notes
(0002806)
ferg
03-03-08 14:03

ioc/0c3{0,1,2,3}

Documentation is at http://caucho.com/resin/doc/resin-ioc.xtp [^]
 

- Issue History
Date Modified Username Field Change
03-03-08 09:22 ferg New Issue
03-03-08 14:03 ferg Note Added: 0002806
03-03-08 14:03 ferg Assigned To  => ferg
03-03-08 14:03 ferg Status new => closed
03-03-08 14:03 ferg Resolution open => fixed
03-03-08 14:03 ferg Fixed in Version  => 3.1.6


Mantis 1.0.0rc3[^]
Copyright © 2000 - 2005 Mantis Group
28 total queries executed.
25 unique queries executed.
Powered by Mantis Bugtracker