Java异常处理: 一个男人和一个女人的故事
2009-08-05 00:18
507 查看
1. If you can't handle an exception, don't catch it.
如果你不能好好对待她,不要骚扰她。
2. Catch an exception as close as possible to its source.
如果你想追求她,首先你要靠近她。
3. If you catch an exception, don't swallow it.
如果你已得到她,就要善待她。
4. Log an exception where you catch it, unless you plan to re-throw it.
如果你已得到她,就要好好了解她,除非你想抛弃她。
5. Never throw unchecked exceptions in your methods just because they clutter the method signature.
如果你已抛弃她,就要提醒别人继续追求她。
6. Preserve the stack trace when you re-throw the exception by wrapping the original exception in the new one.
如果你想抛弃一个全新的她,请尽量保留那个旧的她,以便别人还能够认出她。
如果你不能好好对待她,不要骚扰她。
2. Catch an exception as close as possible to its source.
如果你想追求她,首先你要靠近她。
3. If you catch an exception, don't swallow it.
如果你已得到她,就要善待她。
4. Log an exception where you catch it, unless you plan to re-throw it.
如果你已得到她,就要好好了解她,除非你想抛弃她。
5. Never throw unchecked exceptions in your methods just because they clutter the method signature.
如果你已抛弃她,就要提醒别人继续追求她。
6. Preserve the stack trace when you re-throw the exception by wrapping the original exception in the new one.
如果你想抛弃一个全新的她,请尽量保留那个旧的她,以便别人还能够认出她。
相关文章推荐
- 对java异常处理的一个测试实例
- 一个男人和一个女人的故事
- java在线聊天项目0.7版 连接多个客户端问题,开启多个客户端后服务器端只接收到一个 对各种异常的补充处理
- Java 的异常处理与C#异常处理的一个小区别
- Java:使用 Java 开发的一个异常处理框架
- java中异常处理的一个小知识点
- 一个异常的处理java.lang.IllegalStateException
- 用Java实现的一个密码验证 以及Java异常处理流程和runtime异常以及checked异常之间的区别
- android 异常处理--java.io.IOException: 您的主机中的软件中止了一个已建立的连接
- .NET:再论异常处理,一个真实的故事
- 理解Java异常处理机制——Java异常处理的一个综合实例
- java面向对象-异常处理的一个例子
- android 异常处理--java.io.IOException: 您的主机中的软件中止了一个已建立的连接
- 处理了一个以前写的java小程序的异常
- java异常处理的简单实例和解释,自定义一个异常类
- java在线聊天项目1.0版 异常处理——开启多个客户端,关闭一个客户端后,在其他客户端中再发出信息会出现异常的处理
- Java的异常处理机制的一个例子-读后定能对异常理解深刻
- 理解Java异常处理机制——Java异常处理的一个综合实例
- java 异常处理的一个小错误
- .NET:再论异常处理,一个真实的故事