Here you can find the source of getExceptionCause(Throwable e)
Parameter | Description |
---|---|
e | a <code>Throwable</code> instance |
Throwable
instance
public static Throwable getExceptionCause(Throwable e)
//package com.java2s; /*/*from w w w .j av a 2 s .c om*/ * Copyright (c) Open Source Strategies, Inc. * * Opentaps is free software: you can redistribute it and/or modify it * under the terms of the GNU Affero General Public License as published * by the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * Opentaps is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with Opentaps. If not, see <http://www.gnu.org/licenses/>. */ public class Main { /** * Gets the cause from an exception. * * @param e a <code>Throwable</code> instance * @return a <code>Throwable</code> instance */ public static Throwable getExceptionCause(Throwable e) { if (e instanceof java.sql.SQLException) { return e; } else if (e instanceof java.sql.BatchUpdateException) { return e; } else if (e.getCause() != null) { return getExceptionCause(e.getCause()); } else { return e; } } }