Deprecate FileSystemUtils

Issue: SPR-15748
This commit is contained in:
Juergen Hoeller 2017-07-10 14:25:13 +02:00
parent 9b5132ce53
commit 3714e7b044
2 changed files with 7 additions and 5 deletions

View File

@ -27,7 +27,9 @@ import org.springframework.lang.Nullable;
* @author Rob Harrop
* @author Juergen Hoeller
* @since 2.5.3
* @deprecated as of Spring Framework 5.0, in favor of native NIO API usage
*/
@Deprecated
public abstract class FileSystemUtils {
/**
@ -60,7 +62,8 @@ public abstract class FileSystemUtils {
* @throws IOException in the case of I/O errors
*/
public static void copyRecursively(@Nullable File src, File dest) throws IOException {
Assert.isTrue(src != null && (src.isDirectory() || src.isFile()), "Source File must denote a directory or file");
Assert.isTrue(src != null && (src.isDirectory() || src.isFile()),
"Source File must denote a directory or file");
Assert.notNull(dest, "Destination File must not be null");
doCopyRecursively(src, dest);
}
@ -88,9 +91,7 @@ public abstract class FileSystemUtils {
dest.createNewFile();
}
catch (IOException ex) {
IOException ioex = new IOException("Failed to create file: " + dest);
ioex.initCause(ex);
throw ioex;
throw new IOException("Failed to create file: " + dest, ex);
}
FileCopyUtils.copy(src, dest);
}

View File

@ -1,5 +1,5 @@
/*
* Copyright 2002-2015 the original author or authors.
* Copyright 2002-2017 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -26,6 +26,7 @@ import static org.junit.Assert.*;
/**
* @author Rob Harrop
*/
@Deprecated
public class FileSystemUtilsTests {
@Test