bmcheck returns NullPointerException to a file with two rules
yusuke.sato.zz Oct 29, 2019 11:04 AMI am using byteman to trace call stack in JGit on Windows 10.
First I wrote a byteman rule to trace start of a method. bmckeck reported no error with this script.
RULE CheckoutCommand Start CLASS org.eclipse.jgit.api.CheckoutCommand METHOD call AT ENTRY IF true DO traceOpen("log","D:/tmp/byteman.log"); traceln("log", "[Start][checkout] Start checkout branch: " + $0.name); traceClose("log"); ENDRULE
Then I wrote another byteman rule to trace end of the same method. bmckeck reported no error with this script too.
RULE CheckoutCommand End CLASS org.eclipse.jgit.api.CheckoutCommand METHOD call AT EXIT IF true DO traceOpen("log","D:/tmp/byteman.log"); traceln("log", "[End][checkout] Checkouted branch successfully: " + $0.name); traceClose("log"); ENDRULE
But when I joint these two rules into one rule file (JGit.btm), bmckeck returns NullPointerException.
RULE CheckoutCommand Start CLASS org.eclipse.jgit.api.CheckoutCommand METHOD call AT ENTRY IF true DO traceOpen("log","D:/tmp/byteman.log"); traceln("log", "[Start][checkout] Start checkout branch: " + $0.name); traceClose("log"); ENDRULE RULE CheckoutCommand End CLASS org.eclipse.jgit.api.CheckoutCommand METHOD call AT EXIT IF true DO traceOpen("log","D:/tmp/byteman.log"); traceln("log", "[End][checkout] Checkouted branch successfully: " + $0.name); traceClose("log"); ENDRULE
The error looks like this:
PS C:\home\satob> C:\opt\byteman\bin\bmcheck.bat -cp C:\opt\pleiades\eclipse\plugins\org.eclipse.jgit_5.1.0.201809111528-r.jar .\JGit.btm Checking rule CheckoutCommand Start against class org.eclipse.jgit.api.CheckoutCommand Parsed rule "CheckoutCommand Start" for class org.eclipse.jgit.api.CheckoutCommand Type checked rule "CheckoutCommand Start" Checking rule CheckoutCommand End against class org.eclipse.jgit.api.CheckoutCommand Exception in thread "main" java.lang.NullPointerException at org.jboss.byteman.check.RuleCheck.checkRules(RuleCheck.java:234) at org.jboss.byteman.check.TestScript.main(TestScript.java:74)
Why bmcheck returned NullPointerException to this file?