5 Replies Latest reply on Feb 5, 2004 8:11 AM by Bill Burke

    Some fixes and a caller side point cut question

    rythos Newbie

       

      "rythos" wrote:
      "rythos" wrote:
      The version of JBoss AOP I downloaded had a few bugs in it that appeared to need fixing. I don't know anything about how to report these, so I'll put them here.

      AspectXmlLoader.java line 370
      "group.trim().equals("")" changed to "attr.trim().equals("")"

      The following method was added to MethodHashing.java
       public static long constructorHash(CtConstructor cons)
       throws Exception
       {
       CtClass[] parameterTypes = cons.getParameterTypes();
       String consDesc = cons.getName()+"(";
       for(int j = 0; j < parameterTypes.length; j++)
       {
       consDesc += getTypeString(parameterTypes[j]);
       }
       consDesc += ")V";
      
       long hash = 0;
       ByteArrayOutputStream bytearrayoutputstream = new ByteArrayOutputStream(512);
       MessageDigest messagedigest = MessageDigest.getInstance("SHA");
       DataOutputStream dataoutputstream = new DataOutputStream(new DigestOutputStream(bytearrayoutputstream, messagedigest));
       dataoutputstream.writeUTF(consDesc);
       dataoutputstream.flush();
       byte abyte0[] = messagedigest.digest();
       for(int j = 0; j < Math.min(8, abyte0.length); j++)
       {
       hash += (long)(abyte0[j] & 0xff) << j * 8;
       }
       return hash;
       }


      Around line 57 in CallerExprEditor.java add the following:
      long callingHash = 0;
       CtBehavior ctb = call.where();
       if( ctb instanceof CtMethod ) callingHash = MethodHashing.methodHash( ( CtMethod ) ctb );
       else callingHash = MethodHashing.constructorHash( ( CtConstructor ) ctb );


      And comment out this line:
      // long callingHash = MethodHashing.methodHash((CtMethod) call.where());


      I hope these are useful. Caused me some issues, let me tell you!

      My question is regarding the caller pointcut. I'm trying to get static information on which class and method did the calling, as well as which class and method is being called. I can't seem to find anything that works for me. In the caller-pointcut I have attributes of class="aspect.Run" and calledClass=".*", so I want it to catch every method call that aspect.Run makes.

      Thanks,
      Craig