<?xml version="1.0" encoding="utf-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:georss="http://www.georss.org/georss" 	>
<channel>
	<title>Comments on: after() throwing(Exception e) : serviceMethod() { mail(e); }</title>
	<atom:link href="http://blog.arendsen.net/index.php/2006/11/02/after-throwingexception-e-servicemethod-mailexceptione/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.arendsen.net/index.php/2006/11/02/after-throwingexception-e-servicemethod-mailexceptione/</link>
	<description>Scribble, scribble, scribble...</description>
	<lastBuildDate>Wed, 28 Jul 2010 15:10:07 +0200</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.4</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: Raj</title>
		<link>http://blog.arendsen.net/index.php/2006/11/02/after-throwingexception-e-servicemethod-mailexceptione/comment-page-1/#comment-304293</link>
		<dc:creator>Raj</dc:creator>
		<pubDate>Tue, 29 Jun 2010 14:25:19 +0000</pubDate>
		<guid isPermaLink="false">http://blog.arendsen.net/index.php/2006/11/02/after-throwingexception-e-servicemethod-mailexceptione/#comment-304293</guid>
		<description>missed some code 


    
    
	
    






public class TFPExceptions{
	public void translateException(Exception t) throws Throwable {
		System.out.println(&quot;TEST EXCEPTION HANDLED.....&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;3333333&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt; &quot; );	
	}	
}</description>
		<content:encoded><![CDATA[<p>missed some code </p>
<p>public class TFPExceptions{<br />
	public void translateException(Exception t) throws Throwable {<br />
		System.out.println(&#8221;TEST EXCEPTION HANDLED&#8230;..&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;3333333&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt; &#8221; );<br />
	}<br />
}</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Raj</title>
		<link>http://blog.arendsen.net/index.php/2006/11/02/after-throwingexception-e-servicemethod-mailexceptione/comment-page-1/#comment-304292</link>
		<dc:creator>Raj</dc:creator>
		<pubDate>Tue, 29 Jun 2010 14:22:41 +0000</pubDate>
		<guid isPermaLink="false">http://blog.arendsen.net/index.php/2006/11/02/after-throwingexception-e-servicemethod-mailexceptione/#comment-304292</guid>
		<description>Hi Greg, 

        I am trying to wrap all my service exceptions to my customize exception but the problem is after the point cut also myExceptionTranslator it not getting called , following is the code 

	
	    
	    
	        
	    
	



public class TFPExceptions{
	public void translateException(Exception t) throws Throwable {
		System.out.println(&quot;TEST EXCEPTION HANDLED..... &quot; );	
	}	
}

I am throwing a nullpointerException from my service 
but after exception also it is not coming into translateException method,

Any comments much appreciated.

Raj</description>
		<content:encoded><![CDATA[<p>Hi Greg, </p>
<p>        I am trying to wrap all my service exceptions to my customize exception but the problem is after the point cut also myExceptionTranslator it not getting called , following is the code </p>
<p>public class TFPExceptions{<br />
	public void translateException(Exception t) throws Throwable {<br />
		System.out.println(&#8221;TEST EXCEPTION HANDLED&#8230;.. &#8221; );<br />
	}<br />
}</p>
<p>I am throwing a nullpointerException from my service<br />
but after exception also it is not coming into translateException method,</p>
<p>Any comments much appreciated.</p>
<p>Raj</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: make more money online</title>
		<link>http://blog.arendsen.net/index.php/2006/11/02/after-throwingexception-e-servicemethod-mailexceptione/comment-page-1/#comment-304235</link>
		<dc:creator>make more money online</dc:creator>
		<pubDate>Tue, 29 Jun 2010 03:31:17 +0000</pubDate>
		<guid isPermaLink="false">http://blog.arendsen.net/index.php/2006/11/02/after-throwingexception-e-servicemethod-mailexceptione/#comment-304235</guid>
		<description>Your blog is very good, my blog is about how to increase website revenue knowledge. You are welcome to spend a little time to patronize.</description>
		<content:encoded><![CDATA[<p>Your blog is very good, my blog is about how to increase website revenue knowledge. You are welcome to spend a little time to patronize.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: hewett</title>
		<link>http://blog.arendsen.net/index.php/2006/11/02/after-throwingexception-e-servicemethod-mailexceptione/comment-page-1/#comment-287409</link>
		<dc:creator>hewett</dc:creator>
		<pubDate>Mon, 23 Nov 2009 12:12:13 +0000</pubDate>
		<guid isPermaLink="false">http://blog.arendsen.net/index.php/2006/11/02/after-throwingexception-e-servicemethod-mailexceptione/#comment-287409</guid>
		<description>The toughest thing about success is that you&#039;ve got to keep on being a success. Talent is only a starting point in this business. You&#039;ve got to keep on working that talent. Someday I&#039;ll reach for it and it won&#039;t be there.</description>
		<content:encoded><![CDATA[<p>The toughest thing about success is that you&#8217;ve got to keep on being a success. Talent is only a starting point in this business. You&#8217;ve got to keep on working that talent. Someday I&#8217;ll reach for it and it won&#8217;t be there.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Dharmesh</title>
		<link>http://blog.arendsen.net/index.php/2006/11/02/after-throwingexception-e-servicemethod-mailexceptione/comment-page-1/#comment-237526</link>
		<dc:creator>Dharmesh</dc:creator>
		<pubDate>Mon, 02 Feb 2009 16:22:18 +0000</pubDate>
		<guid isPermaLink="false">http://blog.arendsen.net/index.php/2006/11/02/after-throwingexception-e-servicemethod-mailexceptione/#comment-237526</guid>
		<description>Thanks for spring 1.x code snippet for throw advice.</description>
		<content:encoded><![CDATA[<p>Thanks for spring 1.x code snippet for throw advice.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Sateesh Thumma</title>
		<link>http://blog.arendsen.net/index.php/2006/11/02/after-throwingexception-e-servicemethod-mailexceptione/comment-page-1/#comment-156380</link>
		<dc:creator>Sateesh Thumma</dc:creator>
		<pubDate>Mon, 14 Apr 2008 13:05:00 +0000</pubDate>
		<guid isPermaLink="false">http://blog.arendsen.net/index.php/2006/11/02/after-throwingexception-e-servicemethod-mailexceptione/#comment-156380</guid>
		<description>I am using Spring AOP interceptor for a transaction as a business process. Plese guide me to immplement exceptions handleing to intrupt the interceptior stack by throwing exception

Regards
Sateesh Thumma</description>
		<content:encoded><![CDATA[<p>I am using Spring AOP interceptor for a transaction as a business process. Plese guide me to immplement exceptions handleing to intrupt the interceptior stack by throwing exception</p>
<p>Regards<br />
Sateesh Thumma</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Greg</title>
		<link>http://blog.arendsen.net/index.php/2006/11/02/after-throwingexception-e-servicemethod-mailexceptione/comment-page-1/#comment-119338</link>
		<dc:creator>Greg</dc:creator>
		<pubDate>Thu, 06 Dec 2007 20:12:30 +0000</pubDate>
		<guid isPermaLink="false">http://blog.arendsen.net/index.php/2006/11/02/after-throwingexception-e-servicemethod-mailexceptione/#comment-119338</guid>
		<description>Hi Alef,

With my &#039;after-throwing&#039; advice working I want to understand how ordering comes to play. The application I am working on has a few other aspects implementing around, before and now my after impl. I am not sure how ordering works implementing the Ordered interface and when I need to be concerned about ordering aspects.

Is ordering only applicable to the same advice type being invoked on the same pointcut? For example if the application has several after-throwing aspects on the same pointcut I can see ordering working as the one with the lowest order value is invoked first ect...

However, in this case the application has an around aspect providing Authorization on user role and method being invoked. If the user is not authorized to access the specified method an AuthorizationException is thrown. In this case I don&#039;t want my after-throwing to convert this exception so I implemented the after-throwing advice to be aware of this AuthorizationException and simply rethrow. But, could I have used ordering to resolve this?

We also have aspect &#039;arround&#039; advices providing method argument validation, transaction management ect. The application has one central AspectsOrderingConstants providing all the aspect ordering. But I am not sure how my after-throwing advice needs to respect the ordering if at all???

Any comments much appreciated.

Thanks,

Greg</description>
		<content:encoded><![CDATA[<p>Hi Alef,</p>
<p>With my &#8216;after-throwing&#8217; advice working I want to understand how ordering comes to play. The application I am working on has a few other aspects implementing around, before and now my after impl. I am not sure how ordering works implementing the Ordered interface and when I need to be concerned about ordering aspects.</p>
<p>Is ordering only applicable to the same advice type being invoked on the same pointcut? For example if the application has several after-throwing aspects on the same pointcut I can see ordering working as the one with the lowest order value is invoked first ect&#8230;</p>
<p>However, in this case the application has an around aspect providing Authorization on user role and method being invoked. If the user is not authorized to access the specified method an AuthorizationException is thrown. In this case I don&#8217;t want my after-throwing to convert this exception so I implemented the after-throwing advice to be aware of this AuthorizationException and simply rethrow. But, could I have used ordering to resolve this?</p>
<p>We also have aspect &#8216;arround&#8217; advices providing method argument validation, transaction management ect. The application has one central AspectsOrderingConstants providing all the aspect ordering. But I am not sure how my after-throwing advice needs to respect the ordering if at all???</p>
<p>Any comments much appreciated.</p>
<p>Thanks,</p>
<p>Greg</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Alef</title>
		<link>http://blog.arendsen.net/index.php/2006/11/02/after-throwingexception-e-servicemethod-mailexceptione/comment-page-1/#comment-119333</link>
		<dc:creator>Alef</dc:creator>
		<pubDate>Thu, 06 Dec 2007 19:51:17 +0000</pubDate>
		<guid isPermaLink="false">http://blog.arendsen.net/index.php/2006/11/02/after-throwingexception-e-servicemethod-mailexceptione/#comment-119333</guid>
		<description>No problem Greg,

glad I could help.</description>
		<content:encoded><![CDATA[<p>No problem Greg,</p>
<p>glad I could help.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Greg</title>
		<link>http://blog.arendsen.net/index.php/2006/11/02/after-throwingexception-e-servicemethod-mailexceptione/comment-page-1/#comment-119326</link>
		<dc:creator>Greg</dc:creator>
		<pubDate>Thu, 06 Dec 2007 19:26:13 +0000</pubDate>
		<guid isPermaLink="false">http://blog.arendsen.net/index.php/2006/11/02/after-throwingexception-e-servicemethod-mailexceptione/#comment-119326</guid>
		<description>Thanks Alef, works like a charm :-).

Much appreciated,

Greg</description>
		<content:encoded><![CDATA[<p>Thanks Alef, works like a charm <img src='http://blog.arendsen.net/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> .</p>
<p>Much appreciated,</p>
<p>Greg</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Alef</title>
		<link>http://blog.arendsen.net/index.php/2006/11/02/after-throwingexception-e-servicemethod-mailexceptione/comment-page-1/#comment-116850</link>
		<dc:creator>Alef</dc:creator>
		<pubDate>Fri, 30 Nov 2007 00:06:08 +0000</pubDate>
		<guid isPermaLink="false">http://blog.arendsen.net/index.php/2006/11/02/after-throwingexception-e-servicemethod-mailexceptione/#comment-116850</guid>
		<description>

Hi Greg,

this is not very difficult: when using Spring 2.0 (I would definitely recommend this) you would have to the following inside a Spring XML file:

&lt;aop :config&gt;
    &lt;!-- 1. Identify places where you think this is going to happen (in other words: where the exception should be &#039;translated&#039; or &#039;rethrown&#039;). This is what you call a pointcut. --&gt;
    &lt;/aop&gt;&lt;aop :aspect ref=&quot;myExceptionTranslator&quot;&gt;
        &lt;aop :pointcut id=&quot;serviceOperation&quot; expression=&quot;execution(* com.mycompany.service..*.*(..))&quot;/&gt;
        &lt;aop :after-throwing throwing=&quot;exception&quot; method=&quot;translate&quot;/&gt;
    &lt;/aop&gt;


&lt;bean id=&quot;myExceptionTranslator&quot; class=&quot;com.mycompany.util.MyExceptionTranslator&quot;/&gt;

&lt;bean id=&quot;myService&quot; class=&quot;com.mycompany.service.MyService&quot;/&gt;

public class MyExceptionTranslator {

  public void translate(MyFunnyRuntimeException e) {
	throw new MyOtherFunnyRuntimeException(e);
  }
}

Now remember: if you use Spring AOP, the advice will ONLY be applied to managed Spring beans (not to objects created by new()).

For more info on the pointcut expression language and AOP 2.0, look at the reference manual (http://static.springframework.org/spring/docs/2.5.x/reference/aop.html).

Let me know if you have any issues with it.

regards,
Alef</description>
		<content:encoded><![CDATA[<p>Hi Greg,</p>
<p>this is not very difficult: when using Spring 2.0 (I would definitely recommend this) you would have to the following inside a Spring XML file:</p>
<p>&lt;aop :config&gt;<br />
    &lt;!&#8211; 1. Identify places where you think this is going to happen (in other words: where the exception should be &#8216;translated&#8217; or &#8216;rethrown&#8217;). This is what you call a pointcut. &#8211;&gt;<br />
    &lt;/aop&gt;&lt;aop :aspect ref=&#8221;myExceptionTranslator&#8221;&gt;<br />
        &lt;aop :pointcut id=&#8221;serviceOperation&#8221; expression=&#8221;execution(* com.mycompany.service..*.*(..))&#8221;/&gt;<br />
        &lt;aop :after-throwing throwing=&#8221;exception&#8221; method=&#8221;translate&#8221;/&gt;<br />
    &lt;/aop&gt;</p>
<p>&lt;bean id=&#8221;myExceptionTranslator&#8221; class=&#8221;com.mycompany.util.MyExceptionTranslator&#8221;/&gt;</p>
<p>&lt;bean id=&#8221;myService&#8221; class=&#8221;com.mycompany.service.MyService&#8221;/&gt;</p>
<p>public class MyExceptionTranslator {</p>
<p>  public void translate(MyFunnyRuntimeException e) {<br />
	throw new MyOtherFunnyRuntimeException(e);<br />
  }<br />
}</p>
<p>Now remember: if you use Spring AOP, the advice will ONLY be applied to managed Spring beans (not to objects created by new()).</p>
<p>For more info on the pointcut expression language and AOP 2.0, look at the reference manual (<a href="http://static.springframework.org/spring/docs/2.5.x/reference/aop.html)" rel="nofollow" onclick="pageTracker._trackPageview('/outgoing/static.springframework.org/spring/docs/2.5.x/reference/aop.html?referer=');">http://static.springframework.org/spring/docs/2.5.x/reference/aop.html)</a>.</p>
<p>Let me know if you have any issues with it.</p>
<p>regards,<br />
Alef</p>
]]></content:encoded>
	</item>
</channel>
</rss>
