Must specify class name twice... Bug?

2008-01-18
2013-04-25
  • Hi there,

    when trying to watch one of my classes, I found out that I have to specify it twice in the criteria - once with and once without the package name.

    Example:
    I want JRat to watch the class com.myname.mypackage.TestClass

    Configuration option 1:
    -----------------------
    <include className="com.myname.mypackage.TestClass" methodName="*" signature="*" />

    --> The output file is created but contains no data

    Configuration option 2:
    -----------------------
    <include className="TestClass" methodName="*" signature="*" />

    --> No output file is created

    Configuration option 3:
    -----------------------
    <include className="com.myname.mypackage.TestClass" methodName="*" signature="*" />
    <include className="TestClass" methodName="*" signature="*" />

    --> The output file is created and I finally see my profiling data

    But this does not seem to be the right way...

    Best,
    Sven

     
    • Hi,

      I think you're right.
      Fully qualified class name is used when transforming the class (in FilterClassFileTransformer).
      But only the class name is used when profiling (in ConfigMethodHandlerFactory).
      That's why you need both declarations to get things to work.
      To correct this behaviour, ConfigMethodHandlerFactory should use fully qualified class name :
      l. 117 :
      >>if (methodCriteria.isMatch(methodKey.getClassName(), methodKey.getMethodName(), methodKey.getSignature(), 0)) {
      <<if (methodCriteria.isMatch(methodKey.getFullyQualifiedClassName(), methodKey.getMethodName(), methodKey.getSignature(), 0)) {

      Hope this helps,
      Gabriel.