unwrapThrowable
2017-05-26 13:16
218 查看
package org.apache.ibatis.reflection; import java.lang.reflect.InvocationTargetException; import java.lang.reflect.UndeclaredThrowableException; /** * @author Clinton Begin */ public class ExceptionUtil { private ExceptionUtil() { // Prevent Instantiation } public static Throwable unwrapThrowable(Throwable wrapped) { Throwable unwrapped = wrapped; while (true) { if (unwrapped instanceof InvocationTargetException) { unwrapped = ((InvocationTargetException) unwrapped).getTargetException(); } else if (unwrapped instanceof UndeclaredThrowableException) { unwrapped = ((UndeclaredThrowableException) unwrapped).getUndeclaredThrowable(); } else { return unwrapped; } } } }
相关文章推荐
- Caffe+Visual Studio 2015编译可以有多简单?
- 网站流量统计工具介绍
- html--列表
- Eclipse 提示 The given project is not a virtual component project
- 《大型网站技术架构:核心原理与案例分析》拜读总结,第五章——万无一失:网站的高可用架构
- linux服务器上部署JavaWeb项目
- visual studio 2010 “LNK1123: 转换到 COFF 期间失败: 文件无效或损坏” 问题解决方法
- Rails4 ActionCable的使用
- 拼图3x3最短路径
- Android-Terminal-Emulator
- Android返回键处理、任务和home键处理
- android 开源框架之——下拉刷新,上拉加载更多总结
- google 翻译python版本
- 【HDU5187】contest
- 剑指offer 面试题14 调整数组顺序使奇数位于偶数前面
- (数字IC)低功耗设计入门(四)——RTL级低功耗设计
- sed用法
- 数组反序列化
- Win7系统电脑将鼠标停留在桌面图标上不出现提示信息的原因及解决方法图文教程
- Android之——自己定义TextView