Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [aspectj-users] Around advice problem with java.io.InputStream

Hi Andy,

thanks for the help. The problem was not with the advice but with the return value of methodExecution in my ExceptionHandler Aspect. 
(I'd forgotten that the print method needed a different return value other than usual methods on the client side in order to process the response. Unfortunately I hadn't included that in my ExceptionHandler)

Btw thanks for the time.
Cheers,

Sina

On Aug 19, 2013, at 9:26 PM, Andy Clement <andrew.clement@xxxxxxxxx> wrote:

I presume a showWeaveInfo shows the advice is applying ok, and you are just saying the advice is not returning or it is returning null? Exception occuring in the advice?

Sometimes I recommend switching to code style which has much better diagnostics - it may quickly indicate the problem to you which you can then choose to fix in the annotation style.

cheers,
Andy


On 19 August 2013 05:15, Sina <sina.golesorkhi@xxxxxxxxx> wrote:
Hi there,

I'm using AspectJ along with Struts 2.x . 
In one of my action classes I have a private field of type java.io.InputStream which is used to sent back some data (generated by net.sf.jasperreports.engine.JasperRunManager.runReportToPdf method) to the client.

When using the @Around advice (for exception handling manners) the inputstream is not sent back to the client in response, hence the PDF file is not generated.


public class SomeAction {
………
private InputStream inputStream;

public String print() {
….
setInputStream(net.sf.jasperreports.engine.JasperRunManager.runReportToPdf(….));
}
}


@Around("execution ……… ")
public String methodExecution(CustomAction action, ProceedingJoinPoint thisJoinPointthrows Throwable {
try {
thisJoinPoint.proceed();
catch (Exception e) {
…...
}


The method is working properly with @Before but @Around.
P.S. the aspect is working flawlessly and of course I've omitted the advice declaration for the sake of a clarity and abstraction here.

Any idea?

Cheers,
Sina 

_______________________________________________
aspectj-users mailing list
aspectj-users@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/aspectj-users


_______________________________________________
aspectj-users mailing list
aspectj-users@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/aspectj-users


Back to the top