3 Replies Latest reply on Mar 1, 2012 10:33 AM by Andrew Dinn

    NPE in the RuleGeneratorAdapter

    Anton Ryabtsev Newbie

      Hi,

       

      I got  an exception in the next scenario:

       

       

      {code}

      public class Foo {

       

          public void bar(Map input) {

              final long start = System.currentTimeMillis();

              String s;

              try {

                  s =  new String("test");

              } catch(Exception exc) {

                  s = new String("fail");

              }

              System.out.println(s);

          }

       

      }

      {code}

       

       

      RULE rule

      CLASS Foo

      METHOD bar

      AT EXIT

      IF true

      DO traceln("yes, it works!" + $s)

      ENDRULE

       

      Exception:

      java.lang.NullPointerException

          at org.jboss.byteman.agent.adapter.RuleGeneratorAdapter.loadLocal(RuleGeneratorAdapter.java:1483)

          at org.jboss.byteman.agent.adapter.RuleTriggerMethodAdapter.doArgLoad(RuleTriggerMethodAdapter.java:477)

          at org.jboss.byteman.agent.adapter.RuleTriggerMethodAdapter.injectTriggerPoint(RuleTriggerMethodAdapter.java:1115)

          at org.jboss.byteman.agent.adapter.ExitTriggerAdapter$ExitTriggerMethodAdapter.visitInsn(ExitTriggerAdapter.java:79)

          at org.jboss.byteman.objectweb.asm.tree.InsnNode.accept(Unknown Source)

          at org.jboss.byteman.objectweb.asm.tree.InsnList.accept(Unknown Source)

          at org.jboss.byteman.objectweb.asm.tree.MethodNode.accept(Unknown Source)

          at org.jboss.byteman.objectweb.asm.commons.JSRInlinerAdapter.visitEnd(Unknown Source)

          at org.jboss.byteman.objectweb.asm.ClassReader.accept(Unknown Source)

          at org.jboss.byteman.objectweb.asm.ClassReader.accept(Unknown Source)

          at org.jboss.byteman.agent.Transformer.transform(Transformer.java:746)

       

      Can someone suggest a workaround to run the rule successfully?