KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > jboss > portal > common > util > Exceptions


1 /*****************************************
2  * *
3  * JBoss Portal: The OpenSource Portal *
4  * *
5  * Distributable under LGPL license. *
6  * See terms of license at gnu.org. *
7  * *
8  *****************************************/

9 package org.jboss.portal.common.util;
10
11 /**
12  * @author <a HREF="mailto:julien@jboss.org">Julien Viet</a>
13  * @version $Revision: 1.1.1.1 $
14  */

15 public class Exceptions
16 {
17
18    public static Throwable JavaDoc unwrap(Throwable JavaDoc throwable) throws IllegalArgumentException JavaDoc
19    {
20       if (throwable == null)
21       {
22          throw new IllegalArgumentException JavaDoc("Cannot unwrap null throwable");
23       }
24       for (Throwable JavaDoc current = throwable;current != null;current = current.getCause())
25       {
26          throwable = current;
27       }
28       return throwable;
29    }
30
31 }
32
Popular Tags