RE: anything wrong?- beginner problem

"Zhang Weishan" <[email protected]> Sat, 3 May 2003 19:01:39 +0800
Newsgroups gmane.comp.java.aspectwerkz
Message-ID <[email protected]>
Hi,
  There is method named NewFile(), and if you use ".*", an error is =
throwed:
  C:\aspectwerkz>aspectwerkz -cp =
test/notepad.jar;lib/commons-collections-2.1.jar
-Daspectwerkz.definition.file=3Dtest/samples.xml =
-Daspectwerkz.metadata.dir=3D_metaD
ata Notepad
java.lang.Error: should be unreachable
        at =
aspectwerkz.MethodComparator.comparePrefixed(MethodComparator.java:14
4)
        at =
aspectwerkz.MethodComparator.compare(MethodComparator.java:68)
        at java.util.Arrays.mergeSort(Arrays.java:1237)
        at java.util.Arrays.mergeSort(Arrays.java:1244)
        at java.util.Arrays.mergeSort(Arrays.java:1245)
        at java.util.Arrays.sort(Arrays.java:1185)
        at java.util.Collections.sort(Collections.java:151)
        at =
aspectwerkz.AspectWerkz.createMethodRepository(AspectWerkz.java:437)
        at aspectwerkz.AspectWerkz.loadMethods(AspectWerkz.java:416)
        at aspectwerkz.AspectWerkz.initialize(AspectWerkz.java:386)
        at =
aspectwerkz.joinpoint.MethodJoinPoint.<init>(MethodJoinPoint.java:62)

        at =
aspectwerkz.joinpoint.StaticMethodJoinPoint.<init>(StaticMethodJoinPo
int.java:48)
        at Notepad.main(Notepad.java)
Exception in thread "main"

Thanks,
Weishan




-----Original Message-----
From: Jonas Bon=E9r [mailto:[email protected]]=20
Sent: Saturday, May 03, 2003 6:43 PM
To: Zhang Weishan
Cc: [email protected]
Subject: Re: [aspectwerkz-developer] anything wrong?- beginner problem

Hi.

Which method/methods are you trying to advise?

When I look at your Notepad.java I can't see any methods named something =

starting with the letter n. If you want to log all methods in the class=20
use: .*

- Jonas

Zhang Weishan wrote:
> Hello everyone,
>=20
>   I tried to run the simple logging advice with a Notepad example, but =
I=20
> was in trouble. All the used files, including the xml definition file, =

> compiled and source logging advice, compiled and source Notepad reside =

> in one directory named test. I jar the complied logging advice and=20
> Notepad into a notepad.jar.
>=20
>   The logging advice which is almost the same as the original one, the =

> only difference is that I removed the package declaration to make life =

> easier.
>=20
>   Here is the xml definition file which resides:
>=20
> <aspectwerkz>
>=20
>     <advice name=3D"xmt"
>=20
>         advice=3D"LoggingAdvice"
>=20
>         deploymentModel=3D"perClass"/>
>=20
> =20
>=20
>     <aspect class=3D"Notepad">
>=20
>         <pointcut type=3D"method" pattern=3D"n.*">
>=20
>             <advice-ref name=3D"xmt"/>
>=20
>         </pointcut>
>=20
>     </aspect>
>=20
> =20
>=20
>   Here is the command I used to invoke the framework.
>=20
> C:\aspectwerkz>aspectwerkz -cp=20
> test/notepad.jar;lib/commons-collections-2.1.jar
>=20
> -Daspectwerkz.definition.file=3Dtest/samples.xml=20
> -Daspectwerkz.metadata.dir=3D_metaD
>=20
> ata Notepad
>=20
> =20
>=20
> The notepad runs but there is no logging info displayed in the =
console.=20
> No matter what the method pattern, for example, set.*, n.*, it simply=20
> did not work.
>=20
> =20
>=20
> Thanks,
>=20
> Weishan
>=20
> =20
>=20


--=20
Jonas
http://freeroller.net/page/jboner





-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf