Skip to content

Commit 3714e7b

Browse files
committed
Deprecate FileSystemUtils
Issue: SPR-15748
1 parent 9b5132c commit 3714e7b

File tree

2 files changed

+7
-5
lines changed

2 files changed

+7
-5
lines changed

spring-core/src/main/java/org/springframework/util/FileSystemUtils.java

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,9 @@
2727
* @author Rob Harrop
2828
* @author Juergen Hoeller
2929
* @since 2.5.3
30+
* @deprecated as of Spring Framework 5.0, in favor of native NIO API usage
3031
*/
32+
@Deprecated
3133
public abstract class FileSystemUtils {
3234

3335
/**
@@ -60,7 +62,8 @@ public static boolean deleteRecursively(@Nullable File root) {
6062
* @throws IOException in the case of I/O errors
6163
*/
6264
public static void copyRecursively(@Nullable File src, File dest) throws IOException {
63-
Assert.isTrue(src != null && (src.isDirectory() || src.isFile()), "Source File must denote a directory or file");
65+
Assert.isTrue(src != null && (src.isDirectory() || src.isFile()),
66+
"Source File must denote a directory or file");
6467
Assert.notNull(dest, "Destination File must not be null");
6568
doCopyRecursively(src, dest);
6669
}
@@ -88,9 +91,7 @@ else if (src.isFile()) {
8891
dest.createNewFile();
8992
}
9093
catch (IOException ex) {
91-
IOException ioex = new IOException("Failed to create file: " + dest);
92-
ioex.initCause(ex);
93-
throw ioex;
94+
throw new IOException("Failed to create file: " + dest, ex);
9495
}
9596
FileCopyUtils.copy(src, dest);
9697
}

spring-core/src/test/java/org/springframework/util/FileSystemUtilsTests.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2015 the original author or authors.
2+
* Copyright 2002-2017 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -26,6 +26,7 @@
2626
/**
2727
* @author Rob Harrop
2828
*/
29+
@Deprecated
2930
public class FileSystemUtilsTests {
3031

3132
@Test

0 commit comments

Comments
 (0)