[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [aspectj-users] Parameters in call - Error

Ok nice, that's what I meant.
Glad you resolved it.

On 6/12/07, hermod.opstvedt@xxxxxxxxx <hermod.opstvedt@xxxxxxxxx> wrote:
Hi

New rewrite with args pcd:

        Connection around(String url, String un, String pwd) throws SQLException : call(* DriverManager.getConnection(String, String, String) throws SQLException ) && args(url,un,pwd)
        {
                System.err.println("Getting connection for: " + url + " using: " + un + "/" + pwd);

Works great.

Hermod

-----Original Message-----
From: aspectj-users-bounces@xxxxxxxxxxx
[mailto:aspectj-users-bounces@xxxxxxxxxxx]On Behalf Of Bora Erbas
Sent: Tuesday, June 12, 2007 10:01 AM
To: aspectj-users@xxxxxxxxxxx
Subject: Re: [aspectj-users] Parameters in call - Error


And args pcd didn't work? I am guessing that args pcd does what you are doing manually with "...getArgs()"...

On 6/12/07, hermod.opstvedt@xxxxxxxxx <hermod.opstvedt@xxxxxxxxx> wrote:
> Hi
>
> I rewrote it as:
>
>         Connection around() throws SQLException : call(* DriverManager.getConnection(String, String, String) throws SQLException )
>         {
>                 Object[] args = thisJoinPoint.getArgs();
>                 System.err.println("Getting connection for: " + args[0] + " using: " + args[1] + "/" + args[2]);
>
> And now it's capturing it.
>
> Hermod
>
> -----Original Message-----
> From: aspectj-users-bounces@xxxxxxxxxxx
> [mailto:aspectj-users-bounces@xxxxxxxxxxx]On Behalf Of Bora Erbas
> Sent: Tuesday, June 12, 2007 9:38 AM
> To: aspectj-users@xxxxxxxxxxx
> Subject: Re: [aspectj-users] Parameters in call - Error
>
>
> Well I think just removing the target(driverManager) should work.
> I can't see at the moment why it wouldn't...
>
> On 6/12/07, hermod.opstvedt@xxxxxxxxx <hermod.opstvedt@xxxxxxxxx> wrote:
> > Hi
> >
> > Of course :) Nice catch.
> >
> > So how should i write this, since it is a static call and I want to get at the parameters. Should I use Object[] args = thisJoinPoint.getArgs(); to get them instead?
> >
> > Hermod
> >
> > -----Original Message-----
> > From: aspectj-users-bounces@xxxxxxxxxxx
> > [mailto:aspectj-users-bounces@xxxxxxxxxxx]On Behalf Of Bora Erbas
> > Sent: Tuesday, June 12, 2007 9:16 AM
> > To: aspectj-users@xxxxxxxxxxx
> > Subject: Re: [aspectj-users] Parameters in call - Error
> >
> >
> > Probably because it is a static call for which target doesn't match...
> >
> > On 6/12/07, hermod.opstvedt@xxxxxxxxx <hermod.opstvedt@xxxxxxxxx> wrote:
> > > Hi
> > >
> > > I suddenly saw the light :) The arguments to the call must be Java types, not instances.
> > >
> > > However it is not capturing the invocation of getConnection.
> > >
> > > Hermod
> > >
> > > -----Original Message-----
> > > From: aspectj-users-bounces@xxxxxxxxxxx
> > > [mailto:aspectj-users-bounces@xxxxxxxxxxx]On Behalf Of
> > > hermod.opstvedt@xxxxxxxxx
> > > Sent: Tuesday, June 12, 2007 9:07 AM
> > > To: aspectj-users@xxxxxxxxxxx
> > > Subject: [aspectj-users] Parameters in call - Error
> > >
> > >
> > > Hi
> > >
> > > I am trying to write an around advice, but it is complaining: "name binding only allowed in target, this, and args pcds" referring to the parameters in the call statement. I am using Eclipse 3.2.2 with AJDT 1.4.2. I was looking at a sample from AspectJ in Action that uses the exact same syntax.
> > >
> > >         Connection around(DriverManager driverManager, String url, String un, String pwd) : call(* DriverManager.getConnection(url, un, pwd)) && target(driverManager) && args(url, un, pwd)
> > >         {
> > >                 System.err.println("Getting connection for: " + url + " using: " + un + "/" + pwd);
> > >                 return proceed(driverManager, url, un, pwd);
> > >         }
> > >
> > > Hermod
> > > * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
> > >
> > > This email with attachments is solely for the use of the individual or
> > > entity to whom it is addressed. Please also be aware that the DnB NOR Group
> > > cannot accept any payment orders or other legally binding correspondence with
> > > customers as a part of an email.
> > >
> > > This email message has been virus checked by the anti virus programs used
> > > in the DnB NOR Group.
> > >
> > > * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
> > > _______________________________________________
> > > aspectj-users mailing list
> > > aspectj-users@xxxxxxxxxxx
> > > https://dev.eclipse.org/mailman/listinfo/aspectj-users
> > > * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
> > >
> > > This email with attachments is solely for the use of the individual or
> > > entity to whom it is addressed. Please also be aware that the DnB NOR Group
> > > cannot accept any payment orders or other legally binding correspondence with
> > > customers as a part of an email.
> > >
> > > This email message has been virus checked by the anti virus programs used
> > > in the DnB NOR Group.
> > >
> > > * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
> > > _______________________________________________
> > > 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
> > * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
> >
> > This email with attachments is solely for the use of the individual or
> > entity to whom it is addressed. Please also be aware that the DnB NOR Group
> > cannot accept any payment orders or other legally binding correspondence with
> > customers as a part of an email.
> >
> > This email message has been virus checked by the anti virus programs used
> > in the DnB NOR Group.
> >
> > * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
> > _______________________________________________
> > 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
> * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
>
> This email with attachments is solely for the use of the individual or
> entity to whom it is addressed. Please also be aware that the DnB NOR Group
> cannot accept any payment orders or other legally binding correspondence with
> customers as a part of an email.
>
> This email message has been virus checked by the anti virus programs used
> in the DnB NOR Group.
>
> * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
> _______________________________________________
> 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
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *

This email with attachments is solely for the use of the individual or
entity to whom it is addressed. Please also be aware that the DnB NOR Group
cannot accept any payment orders or other legally binding correspondence with
customers as a part of an email.

This email message has been virus checked by the anti virus programs used
in the DnB NOR Group.

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