1 25 26 package org.objectweb.jonas_ejb.lib; 27 28 import org.objectweb.jorm.api.PException; 29 import org.objectweb.medor.api.MedorException; 30 31 34 public class ExceptionHelper { 35 36 public static void printException(Exception e) { 37 if (e instanceof PException 38 && ((PException) e).getNestedException()!=null) { 39 printException(((PException) e).getNestedException()); 40 } 41 else if (e instanceof MedorException 42 && ((MedorException) e).getNestedException()!=null) { 43 System.out.println(e.getMessage()); 44 printException(((MedorException) e).getNestedException()); 45 } 46 else 47 e.printStackTrace(); 48 } 49 50 public static Exception getException(Exception e) { 51 if (e instanceof PException 52 && ((PException) e).getNestedException()!=null) { 53 return getException(((PException) e).getNestedException()); 54 } 55 else if (e instanceof MedorException 56 && ((MedorException) e).getNestedException()!=null) { 57 return getException(((MedorException) e).getNestedException()); 58 } 59 else 60 return e; 61 } 62 } 63 | Popular Tags |