Uploaded image for project: 'Byteman'
  1. Byteman
  2. BYTEMAN-173

Can't inject RuntimeException: ensureTypeCheckedCompiled fails

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Major Major
    • 1.6.0
    • 1.5.2
    • None
    • None

      I'm attempting to inject a simple NullPointerException in a method using BMUnit

      @BMRule(targetClass = "org.hibernate.search.batchindexing.impl.IdentifierConsumerEntityProducer",
      			targetMethod = "loadList",
      			action = "throw new NullPointerException()",
      			name = "testMassIndexerErrorsReported")
      

      Rule.ensureTypeCheckedCompiled : error type checking rule testMassIndexerErrorsReported
      org.jboss.byteman.rule.exception.TypeException: ThrowExpression.typeCheck : exception type not declared by trigger method NullPointerException file org.hibernate.search.test.batchindexing.MassIndexerErrorReportingTest+testMassIndexerErrorsReported line 6
      at org.jboss.byteman.rule.expression.ThrowExpression.checkThrownTypeIsValid(ThrowExpression.java:414)
      at org.jboss.byteman.rule.expression.ThrowExpression.typeCheck(ThrowExpression.java:176)
      at org.jboss.byteman.rule.Action.typeCheck(Action.java:106)
      at org.jboss.byteman.rule.Rule.typeCheck(Rule.java:523)
      at org.jboss.byteman.rule.Rule.ensureTypeCheckedCompiled(Rule.java:449)
      at org.jboss.byteman.rule.Rule.execute(Rule.java:670)
      at org.jboss.byteman.rule.Rule.execute(Rule.java:651)
      at org.hibernate.search.batchindexing.impl.IdentifierConsumerEntityProducer.loadList(IdentifierConsumerEntityProducer.java)
      at org.hibernate.search.batchindexing.impl.IdentifierConsumerEntityProducer.loadAllFromQueue(IdentifierConsumerEntityProducer.java:117)
      at org.hibernate.search.batchindexing.impl.IdentifierConsumerEntityProducer.run(IdentifierConsumerEntityProducer.java:94)
      at org.hibernate.search.batchindexing.impl.OptionallyWrapInJTATransaction.run(OptionallyWrapInJTATransaction.java:112)
      at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
      at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
      at java.lang.Thread.run(Thread.java:662)

      Looking into org.jboss.byteman.rule.expression.ThrowExpression.checkThrownTypeIsValid() I guess it should return without throwing an exception

            rhn-engineering-adinn Andrew Dinn
            sgrinove Sanne Grinovero
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: