Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [aspectj-users] Method not visible using this in pointcut

You may mark the aspect as 'privileged'. 

public privileged aspect ... {
   ...
}

Alternatively, you may use reflection along with the AccessibleObject.setAccessible() method.

-Ramnivas

On Wed, Oct 22, 2008 at 4:45 PM, Luiz Antonio Soares Filho <luiz@xxxxxxxxxxxxxx> wrote:
Hello,

I have a join point that need to expose the type of the instance.
I used this(type) pointcut. When I call the method getRequest() from the type this error occurs:
"The method getRequest() from the type FlowController is not visible"

I think this error is happening possibly because getRequest is a private method from FlowController. How can I solve this?

Here is my code:

private pointcut tratarExcecao(Exception ex, String actionName, PageFlowController page) :
        execution(* *Controller.exception(..)) &&
            args(ex, actionName, *, *) && this(page);

    before(Exception ex, String actionName, PageFlowController page) : tratarExcecao(ex, actionName, page) {
        String displayMessage;
        if (AppException.isMensagemNegocio(ex)) {
            String keyError = AppException.obtemKeyErro(ex);
            displayMessage = "Erro: " + actionName;
            page.getRequest().setAttribute("errorMessage",displayMessage); //ERROR HERE
        }
    }


Luiz Antonio

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



Back to the top