6 Replies Latest reply on Nov 12, 2010 11:54 AM by jaikiran pai

    Private field access in rule action

    jaikiran pai Master

      I have this rule:

       

      RULE EjbContainer_popEnc
      CLASS ^org.jboss.ejb3.EJBContainer
      METHOD popEnc
      AT ENTRY
      IF TRUE
      DO System.out.println("EncFactory is " + $0.encFactory)
      ENDRULE

       

       

      The EJBContainer has a private encFactory field, which I am printing in the rule action. However, when I run this through byteman, I see this exception:

       

      19:45:02,496 INFO  [STDOUT] org.jboss.byteman.rule.exception.TypeException: FieldExpresssion.typeCheck : invalid field reference encFactory file /home/jpai/bytemanrule.txt line 6
      19:45:02,496 INFO  [STDOUT]     at org.jboss.byteman.rule.expression.FieldExpression.typeCheck(FieldExpression.java:160)
      19:45:02,496 INFO  [STDOUT]     at org.jboss.byteman.rule.expression.StringPlusExpression.typeCheck(StringPlusExpression.java:52)
      19:45:02,497 INFO  [STDOUT]     at org.jboss.byteman.rule.expression.MethodExpression.typeCheck(MethodExpression.java:211)
      19:45:02,497 INFO  [STDOUT]     at org.jboss.byteman.rule.Action.typeCheck(Action.java:106)
      19:45:02,497 INFO  [STDOUT]     at org.jboss.byteman.rule.Rule.typeCheck(Rule.java:482)
      19:45:02,497 INFO  [STDOUT]     at org.jboss.byteman.rule.Rule.ensureTypeCheckedCompiled(Rule.java:419)
      19:45:02,497 INFO  [STDOUT]     at org.jboss.byteman.rule.Rule.execute(Rule.java:620)
      19:45:02,497 INFO  [STDOUT]     at org.jboss.byteman.rule.Rule.execute(Rule.java:601)
      19:45:02,497 INFO  [STDOUT]     at org.jboss.ejb3.EJBContainer.popEnc(EJBContainer.java:461)
      
      

       

       

      Looking at the byteman code, it appears that only public fields are allowed for access. But I don't any mention of not using private fields, in the documentation. Is it expected that only public fields are accessible?