Skip to content

Commit f202a83

Browse files
authored
Merge pull request itwanger#51 from luanheart/master
这条与上方重复
2 parents 2030158 + d864be8 commit f202a83

File tree

2 files changed

+1
-15
lines changed

2 files changed

+1
-15
lines changed

docs/exception/shijian.md

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -233,20 +233,6 @@ try {
233233

234234
捕获异常的问题是,如果稍后调用的方法为其方法声明添加了新的检查性异常,则开发人员的意图是应该处理具体的新异常。如果你的代码只是捕获异常(或 Throwable),永远不会知道这个变化,以及你的代码现在是错误的,并且可能会在运行时的任何时候中断。
235235

236-
## 在你的方法里抛出定义具体的检查性异常
237-
238-
```
239-
public void foo() throws Exception { //错误方式
240-
}
241-
```
242-
243-
一定要避免出现上面的代码示例,它破坏了检查性异常的目的。 声明你的方法可能抛出的具体检查性异常,如果只有太多这样的检查性异常,你应该把它们包装在你自己的异常中,并在异常消息中添加信息。 如果可能的话,你也可以考虑代码重构。
244-
245-
```
246-
public void foo() throws SpecificException1, SpecificException2 { //正确方式
247-
}
248-
```
249-
250236

251237
## 始终正确包装自定义异常中的异常,以便堆栈跟踪不会丢失
252238

docs/io/char-byte.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ head:
2424

2525
简单一点的说就是:
2626

27-
> 编码:字符(能看懂的)--字节(看不懂的)
27+
> 编码:字符(能看懂的)-->字节(看不懂的)
2828
>
2929
> 解码:字节(看不懂的)-->字符(能看懂的)
3030

0 commit comments

Comments
 (0)