<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<body link="#355491" alink="#4262a1" vlink="#355491" style="background: #e2e2e2; margin: 0; padding: 20px;">

<div>
        <table cellpadding="0" bgcolor="#FFFFFF" border="0" cellspacing="0" style="border: 1px solid #dadada; margin-bottom: 30px; width: 100%; -moz-border-radius: 6px; -webkit-border-radius: 6px;">
                <tbody>
                        <tr>

                                <td>

                                        <table border="0" cellpadding="0" cellspacing="0" bgcolor="#FFFFFF" style="border: solid 2px #ccc; background: #dadada; width: 100%; -moz-border-radius: 6px; -webkit-border-radius: 6px;">
                                                <tbody>
                                                        <tr>
                                                                <td bgcolor="#000000" valign="middle" height="58px" style="border-bottom: 1px solid #ccc; padding: 20px; -moz-border-radius-topleft: 3px; -moz-border-radius-topright: 3px; -webkit-border-top-right-radius: 5px; -webkit-border-top-left-radius: 5px;">
                                                                        <h1 style="color: #333333; font: bold 22px Arial, Helvetica, sans-serif; margin: 0; display: block !important;">
                                                                        <!-- To have a header image/logo replace the name below with your img tag -->
                                                                        <!-- Email clients will render the images when the message is read so any image -->
                                                                        <!-- must be made available on a public server, so that all recipients can load the image. -->
                                                                        <a href="http://community.jboss.org/index.jspa" style="text-decoration: none; color: #E1E1E1">JBoss Community</a></h1>
                                                                </td>

                                                        </tr>
                                                        <tr>
                                                                <td bgcolor="#FFFFFF" style="font: normal 12px Arial, Helvetica, sans-serif; color:#333333; padding: 20px;  -moz-border-radius-bottomleft: 4px; -moz-border-radius-bottomright: 4px; -webkit-border-bottom-right-radius: 5px; -webkit-border-bottom-left-radius: 5px;"><h3 style="margin: 10px 0 5px; font-size: 17px; font-weight: normal;">
    Problems when debug EJB intercepted by JBoss AOP
</h3>
<span style="margin-bottom: 10px;">
    created by <a href="http://community.jboss.org/people/gustavo.gomesc">Gustavo Gomes</a> in <i>JBoss AOP</i> - <a href="http://community.jboss.org/message/622277#622277">View the full discussion</a>
</span>
<hr style="margin: 20px 0; border: none; background-color: #dadada; height: 1px;">

<div class="jive-rendered-content"><p>I am using the JBoss AOP for intercept a static method.</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>The jboss-aop.xml used is:</p><p>&lt;?xml version="1.0" encoding="UTF-8"?&gt;</p><p>&lt;aop xmlns="urn:jboss:aop-beans:1.0"&gt;</p><p>&#160;&#160;&#160; &lt;interceptor class="com.prana.tools.jee.log.LogInterceptor" </p><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; scope="PER_VM" /&gt;</p><p>&#160;&#160;&#160; </p><p>&#160;&#160;&#160; &lt;bind pointcut="call(* com.prana.tools.jee.log.Log-&gt;getMessageKey(java.lang.Object))</p><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; OR call(* com.prana.tools.jee.log.Log-&gt;key(java.lang.Object))"&gt;</p><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;interceptor-ref name="com.prana.tools.jee.log.LogInterceptor" /&gt;</p><p>&#160;&#160;&#160; &lt;/bind&gt;</p><p>&lt;/aop&gt;</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>The <span class="short_text" id="result_box" lang="en"><span class="hps">EJB class that will be intercepted is:</span></span></p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>@Stateless</p><p>public class TesteMkImpl implements TesteMkLocal, TesteMkRemote {</p><p>&#160;&#160;&#160; private CampoMonetario teste1;</p><p>&#160;&#160;&#160; private CampoTexto teste2, teste3;</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>&#160;&#160;&#160; public TesteMkImpl() {</p><p>&#160;&#160;&#160; }</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>&#160;&#160;&#160; private String test(int a, int b) {</p><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160; return Boolean.toString(a &gt; b);</p><p>&#160;&#160;&#160; }</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>&#160;&#160;&#160; public void executaTeste() throws TesteMkException {</p><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160; teste1 = new CampoMonetario(10);</p><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160; teste2 = new CampoTexto("N");</p><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160; teste3 = new CampoTexto("B./ID 9004915410/32460");</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160; validaNroControleParticipante2();</p><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160; validaNroControleParticipante(teste1, teste2, teste3);</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160; if (!teste1.isPreenchido()</p><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; || teste1.getValorBigDecimal().toString().equalsIgnoreCase("")) {</p><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; Object[] param = { "Teste", "Teste2" };</p><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; throw new TesteMkException(<strong>Log.getMessageKey("teste")</strong>, param);</p><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160; }</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160; if (!teste1.isPreenchido()</p><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; || teste1.getValorBigDecimal().toString().equalsIgnoreCase("")) {</p><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; Object[] param = { "Teste", "Teste2" };</p><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; throw new TesteMkException(<strong>Log.getMessageKey("teste")</strong>, param);</p><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160; }</p><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160; if (test(5, 6).equalsIgnoreCase("XPTO")) {</p><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; Object[] param = { "Teste", "Teste2" };</p><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; throw new TesteMkException(<strong>Log.getMessageKey("teste")</strong>, param);</p><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160; }</p><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160; if (test(6, 7).equalsIgnoreCase("XPTO")) {</p><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; Object[] param = { "Teste", "Teste2" };</p><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; throw new TesteMkException(<strong>Log.getMessageKey("teste")</strong>, param);</p><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160; }</p><p>&#160;&#160;&#160; }</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>&#160;&#160;&#160; private void execute() throws TesteMkException {</p><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160; int i = 1;</p><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160; Object[] param = null;</p><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160; </p><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160; if (Boolean.parseBoolean(test(1, 2))</p><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; || (test(3, 4).equalsIgnoreCase("XPTO"))</p><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; || test(5, 6).equalsIgnoreCase("XYZ")) {</p><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; param = new Object[] { "Teste" + i, "Teste" + (i * 2) };</p><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160; }</p><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160; i++;</p><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160; if (Boolean.parseBoolean(test(1, 2))</p><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; || (test(3, 4).equalsIgnoreCase("XPTO"))</p><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; || test(5, 6).equalsIgnoreCase("XYZ")) {</p><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; param = new Object[] { "Teste" + i, "Teste" + (i * 2) };</p><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160; }</p><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160; i++;</p><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160; if (Boolean.parseBoolean(test(1, 2))</p><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; || (test(3, 4).equalsIgnoreCase("XPTO"))</p><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; || test(5, 6).equalsIgnoreCase("XYZ")) {</p><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; param = new Object[] { "Teste" + i, "Teste" + (i * 2) };</p><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160; }</p><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160; i++;</p><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160; if (Boolean.parseBoolean(test(1, 2))</p><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; || (test(3, 4).equalsIgnoreCase("XPTO"))</p><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; || test(5, 6).equalsIgnoreCase("XYZ")) {</p><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; param = new Object[] { "Teste" + i, "Teste" + (i * 2) };</p><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160; }</p><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160; i++;</p><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160; ...</p><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160; repeat this if condition some times.</p><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; ... </p><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160; if (Boolean.parseBoolean(test(1, 2))</p><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; || (test(3, 4).equalsIgnoreCase("XPTO"))</p><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; || test(5, 6).equalsIgnoreCase("XYZ")) {</p><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; param = new Object[] { "Teste" + i, "Teste" + (i * 2) };</p><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160; }</p><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160; i++;</p><p>... repe</p><p>&#160;&#160; }</p><p>}</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>And the class that test this EJB is:</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>public class TesteMkTest {</p><p>&#160;&#160;&#160; private TesteMkRemote testeMk;</p><p>&#160;&#160;&#160; private TestLookup lookup;</p><p>&#160;&#160;&#160; private TesteMkImpl testeMkImpl;</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>&#160;&#160;&#160; public void setUp() throws Exception {</p><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160; lookup = new TestLookup();</p><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160; testeMk = (TesteMkRemote)lookup.getInitialContext().lookup("testeMk/TesteMkImpl/remote");</p><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160; testeMkImpl = new TesteMkImpl();</p><p>&#160;&#160;&#160; }</p><p>&#160;&#160;&#160; </p><p>&#160;&#160;&#160; public void executeRemote() throws TesteMkException{</p><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160; testeMk.execute();</p><p>&#160;&#160;&#160; }</p><p>&#160;&#160;&#160; </p><p>&#160;&#160;&#160; </p><p>&#160;&#160;&#160; public void executeLocal() throws TesteMkException{</p><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160; testeMkImpl.execute();</p><p>&#160;&#160;&#160; }</p><p>&#160;&#160;&#160; </p><p>&#160;&#160;&#160; public static void main(String[] args) throws Exception {</p><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160; TesteMkTest test = new TesteMkTest();</p><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160; test.setUp();</p><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160; test.executeRemote();</p><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160; test.executeLocal();</p><p>&#160;&#160;&#160; }</p><p>}</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>I deploy the EJB with the interception configuration (jboss-aop.xml) in the JBoss AS 5.1.0.GA that uses JBoss AOP 2.1.1.GA in debug mode.</p><p>When I run the test class with a breakpoint on the first line of the method execute of the EJB and step over the method lines, the debug shows the wrong line after some step over on the executeRemote call, but no problems on the executeLocal call.</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p><span class="short_text" id="result_box" lang="en"><span class="hps">Does anyone know if</span> <span class="hps">this is</span> <span class="hps">a</span> <span class="hps">bug?</span></span></p></div>

<div style="background-color: #f4f4f4; padding: 10px; margin-top: 20px;">
    <p style="margin: 0;">Reply to this message by <a href="http://community.jboss.org/message/622277#622277">going to Community</a></p>
        <p style="margin: 0;">Start a new discussion in JBoss AOP at <a href="http://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2027">Community</a></p>
</div></td>
                        </tr>
                    </tbody>
                </table>


                </td>
            </tr>
        </tbody>
    </table>

</div>

</body>
</html>