Unknown local variable WARNING.
whitingjr Oct 15, 2012 11:25 AMHi,
When using bmcheck on a Byteman script I am seeing two warnings. The script attempts to use a scoped reference to an exception in an expression.
Looking at the documentation I don't see exceptions listed in the Rule Expressions section. Is a rule expression allowed to use an exception reference ?
This is the WARNING message:
$ ~/java/jboss/byteman/byteman-download-2.1.0/bin/bmcheck.sh -cp ~/java/projects/sample-byteman-verify-error/src/main/java/ ~/java/projects/sample-byteman-verify-error/src/main/resources/ExceptionCauseCounter.btm
checking rule debug cause of exception against class org.jboss.perf.TimedOutExceptionThrower
WARNING : Warning type checking rule "debug cause of exception" loaded from /home/whitingjr/java/projects/sample-byteman-verify-error/src/main/resources/ExceptionCauseCounter.btm line 10 against method main(java.lang.String[]) void
org.jboss.byteman.rule.exception.TypeWarningException: unknown local variable $e for method main(java.lang.String[]) void
WARNING : Warning type checking rule "debug cause of exception" loaded from /home/whitingjr/java/projects/sample-byteman-verify-error/src/main/resources/ExceptionCauseCounter.btm line 10
org.jboss.byteman.rule.exception.TypeWarningException: failed to find any matching trigger method in class org.jboss.perf.TimedOutExceptionThrower
TestScript: 2 total warnings
2 type warnings
This is a sample application and Byteman script. I was using.
package org.jboss.perf;
import java.lang.Exception;
public class TimedOutExceptionThrower
{
public static void main(String args[])
{
try
{
throw new Exception("Connetion timed out");
}
catch (Exception e)
{
System.out.println("An exceptional situation ocurred.");
}
}
}
########################################################################
#
# Print a debug message when the cause has "timed" in the message text
#
RULE debug cause of exception
CLASS org.jboss.perf.TimedOutExceptionThrower
METHOD main
AT LINE 15
IF -1 != $e.getMessage().indexOf("timed")
DO
debug("Byteman rule has identified a significant situation.")
ENDRULE
Regards,
Jeremy