mirror of
https://gitee.com/chinabugotech/hutool.git
synced 2025-04-19 03:01:48 +08:00
修复PathMover对目标已存在且只读文件报错错误问题
This commit is contained in:
parent
9ef714ad53
commit
17a9701349
@ -2,7 +2,7 @@
|
|||||||
# 🚀Changelog
|
# 🚀Changelog
|
||||||
|
|
||||||
-------------------------------------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------------------------------------
|
||||||
# 5.8.27(2024-02-26)
|
# 5.8.27(2024-03-05)
|
||||||
|
|
||||||
### 🐣新特性
|
### 🐣新特性
|
||||||
* 【extra 】 FreemarkerEngine修改默认版本参数
|
* 【extra 】 FreemarkerEngine修改默认版本参数
|
||||||
@ -10,6 +10,7 @@
|
|||||||
* 【core 】 HexUtil#format方法增加prefix参数(issue#I93PU9@Gitee)
|
* 【core 】 HexUtil#format方法增加prefix参数(issue#I93PU9@Gitee)
|
||||||
|
|
||||||
### 🐞Bug修复
|
### 🐞Bug修复
|
||||||
|
* 【core 】 修复PathMover对目标已存在且只读文件报错错误问题(issue#I95CLT@Gitee)
|
||||||
|
|
||||||
-------------------------------------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------------------------------------
|
||||||
# 5.8.26(2024-02-10)
|
# 5.8.26(2024-02-10)
|
||||||
|
@ -101,9 +101,10 @@ public class PathMover {
|
|||||||
try {
|
try {
|
||||||
return Files.move(src, target, options);
|
return Files.move(src, target, options);
|
||||||
} catch (final IOException e) {
|
} catch (final IOException e) {
|
||||||
if (e instanceof FileAlreadyExistsException) {
|
if (e instanceof FileAlreadyExistsException || e instanceof AccessDeniedException) {
|
||||||
// 目标文件已存在,直接抛出异常
|
// issue#I4QV0L@Gitee issue#I95CLT@Gitee
|
||||||
// issue#I4QV0L@Gitee
|
// FileAlreadyExistsException 目标已存在
|
||||||
|
// AccessDeniedException 目标已存在且只读
|
||||||
throw new IORuntimeException(e);
|
throw new IORuntimeException(e);
|
||||||
}
|
}
|
||||||
// 移动失败,可能是跨分区移动导致的,采用递归移动方式
|
// 移动失败,可能是跨分区移动导致的,采用递归移动方式
|
||||||
|
Loading…
x
Reference in New Issue
Block a user