Based on reading your answer and seeing how you likely came up with it, I believe you think an "exception-in-progress" has "precedence". Keep in mind:

When an new exception is thrown in a catch block or finally block, the current exception is aborted (and forgotten) and the new exception is thrown. The new exception starts unwinding up the stack just like any other exception, aborting out of the current block (the catch or finally block) and subject to any applicable catch or finally blocks along the way.

Note that applicable catch or finally blocks includes:

When a new exception is thrown in a catch block, the new exception is still subject to that catch's finally block, if any.

Now retrace the execution remembering that, whenever you hit throw, you should abort tracing the current exception and start tracing the new exception.

当在catch和finally块中产生新异常, 当前的异常失效并被丢弃,新异常会被后续的catch和finally块处理。

注意: 一个新异常在catch块产生时,会被这个catch匹配的finally处理。

public class A {

    public static void main(String[] args) {
try{
exceptionFunction(); }catch(Exception e){ // print catches which Exception 111, 222, or 333.
System.out.println(e.getMessage());
}
} public static void exceptionFunction(){
try{
throw new IllegalArgumentException("111");
}catch(Exception e){
throw new IllegalArgumentException("222");
}finally{
throw new IllegalArgumentException("333");
}
}
}

above code will print:

333

Exception thrown in catch and finally clause的更多相关文章

  1. Exception thrown by the agent : java.rmi.server.ExportException: Port already in use

    今天有个应用一直起不来,感觉配置都对啊,奇了怪了.看日志发现如下: STATUS | wrapper | 2017/01/04 08:09:31 | Launching a JVM...INFO | ...

  2. Selenium Grid 运行报错 Exception thrown in Navigator.Start first time ->Error forwarding the new session Empty pool of VM for setup Capabilities

    Selenium Grid 运行报错 : Exception thrown in Navigator.Start first time ->Error forwarding the new se ...

  3. openstack-HTTP exception thrown: Maximum number of ports exceeded错误解决方案

    最近几天什么都没动无法创建云主机了,经过一番查询 1.查日志 /data/jumpserver/logs 得到错误 HTTP exception thrown: Maximum number of p ...

  4. Exception thrown on Scheduler.Worker thread. Add `onError` handling

    <html> <head></head> <body> java.lang.IllegalStateException: Exception throw ...

  5. eclipse的jdk版本和spring冲突问题WARN XmlWebApplicationContext:1060 - Exception thrown from LifecycleProcessor on context close

    项目环境: jdk1.8 tomcat7 问题:eclipse启动tomcat后控制台报如下错误: WARN XmlWebApplicationContext:1060 - Exception thr ...

  6. tomcat启动报错“Error: Exception thrown by the agent : java.net.MalformedURLException: Local host name unknown: java.net.UnknownHostException: iZ25fsk1ifk: iZ25fsk1ifk”

    在启动了Tomcat的时候出现下面的错误,导致启动不了,卡在读日志的状态 Error: Exception thrown by the agent : java.net.MalformedURLExc ...

  7. springcloud 集成kafka问题记录,发消息报错:ERROR o.s.kafka.support.LoggingProducerListener - Exception thrown when sending a message with key='null' and payload='{-1,

    在springcloud集成kafka,发送消息时报错: 2018-08-15 16:01:34.159 [http-nio-8081-exec-1] INFO  org.apache.kafka.c ...

  8. 【Java】Exception thrown by the agent : java.rmi.server.ExportException: Port already in use: 1099

    详细信息如下: Error: Exception thrown by the agent : java.rmi.server.ExportException: Port already in use: ...

  9. MyCat启动失败 Error: Exception thrown by the agent : java.net.MalformedURLException: Local host name unknown: java.net.UnknownHostException: rebirth.a: rebirth.a: unknown error

    在使用Nactive连接MyCat的时候发现怎么连接都不ok,明明已经启动了(实际上启动失败了)! 粗心的我,后来看了下日志,果然,启动失败了 Error: Exception thrown by t ...

随机推荐

  1. 开源作品ThinkJDBC—一行代码搞定数据库操作

    1 简介 ThinkJD,又名ThinkJDBC,一个简洁而强大的开源JDBC操作库.你可以使用Java像ThinkPHP框架的M方法一样,一行代码搞定数据库操作.ThinkJD会自动管理数据库连接, ...

  2. 自动驾驶缺人才?听听David Silver怎么说!

    如今自动驾驶在全球范围内的发展势头愈发“凶猛”,该领域人才也一度被视为“香饽饽”. 即使在美国,自动驾驶工程师的起薪也已经突破了25万美元,我国‘“开价”之高更是令人咋舌. 人才.人才.还是人才!重要 ...

  3. POJ3680:Intervals(离散化+最大流最小费用)

    Intervals Time Limit: 5000MS   Memory Limit: 65536K Total Submissions: 9320   Accepted: 4014 题目链接:ht ...

  4. FOJ ——Problem 1759 Super A^B mod C

     Problem 1759 Super A^B mod C Accept: 1368    Submit: 4639Time Limit: 1000 mSec    Memory Limit : 32 ...

  5. bzoj1185 [HNOI2007]最小矩形覆盖 旋转卡壳求凸包

    [HNOI2007]最小矩形覆盖 Time Limit: 10 Sec  Memory Limit: 162 MBSec  Special JudgeSubmit: 2081  Solved: 920 ...

  6. 给dedeCMS自定义模型添加图片集字段

    1.先找到dedecms图片集模型的templets生成图片集的html代码(album_add.htm) <tr>      <td height="24"  ...

  7. 转: wireshark过滤规则

    转: http://blog.sina.com.cn/s/blog_48a0f2740100ka71.html WireShark过滤语法 1.过 滤IP,如来源IP或者目标IP等于某个IP 例子: ...

  8. android hook 框架 ADBI 简介、编译、运行

    Android so注入-libinject2 简介.编译.运行 Android so注入-libinject2  如何实现so注入 Android so注入-Libinject 如何实现so注入 A ...

  9. xen 不同后端存储方案的性能对比

    概述 在xen平台下,一般使用文件来模拟一个磁盘.在xen中使用文件来模拟磁盘有3种方式, blkback 直接操作 blktap2 直接将文件映射为一个裸块设备,这样vm可以直接用phy的方式进行文 ...

  10. (十一)Ubuntu下面怎么找到一个软件安装的目录,卸载软件

    aptitude show packagename 实例: aptitude show sublime-text-installer 可以看到这个软件一系列信息 dpkg命令 dpkg -l //列车 ...