4 Replies Latest reply: Feb 14, 2012 11:45 AM by Andrew Dinn RSS

    @BMRule.targetLocation

    Flavia Rainone Master

      Is there a way of using AFTER INVOKE with targetLocation?

       

      Here is my full example:

       

       @BMRule(name="after finishConnection", targetClass="org.xnio.nio.NioXnioWorker$1",
                  targetMethod="handleEvent",targetLocation="AFTER INVOKE java.nio.channels.SocketChannel.finishConnect",
                  condition="TRUE", action="debug(\"attempted to connect, waiting for cancel\"),\n" +
          "signalWake(\"cancel\", true),\n" +
          "waitFor(\"canceled\"),\n" + 
          "debug(\"proceeding with attempt to finish connect after future has been canceled\")")
      

       

      This example does not work because of the targetLocation. If I just remove targetLocation, the example works.

      I took a look at BMRunnerUtil.constructScriptText, and I saw that it adds an AT to the location:

       

      if (location != null && location.length() > 0) {
                      builder.append("\nAT ");
                      builder.append(location);
                  }
      

       

      I think this is probably the cause of the ParseException I am seeing. Now, I wonder if BMRule is supposed to be used only with "AT" locations, or if the piece of code above shouldn't prepend  "AT" to the location at all.