diff options
author | Harald Musum <musum@yahooinc.com> | 2022-01-03 15:14:16 +0100 |
---|---|---|
committer | Harald Musum <musum@yahooinc.com> | 2022-01-03 15:14:16 +0100 |
commit | bacce0c7b6f523492e0007ed6340089cead65974 (patch) | |
tree | 736ad12fda22907d67575ef1391858306ed81125 /vespajlib/src/main/java/com/yahoo/io/IOUtils.java | |
parent | 1f3e5d1003a33d9a7076575eab8059c582611cdb (diff) |
Explicitly verify that source exists
Diffstat (limited to 'vespajlib/src/main/java/com/yahoo/io/IOUtils.java')
-rw-r--r-- | vespajlib/src/main/java/com/yahoo/io/IOUtils.java | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/vespajlib/src/main/java/com/yahoo/io/IOUtils.java b/vespajlib/src/main/java/com/yahoo/io/IOUtils.java index df432e4f787..54cdf5c7b40 100644 --- a/vespajlib/src/main/java/com/yahoo/io/IOUtils.java +++ b/vespajlib/src/main/java/com/yahoo/io/IOUtils.java @@ -227,7 +227,9 @@ public abstract class IOUtils { * @throws IOException if copying any file fails. This will typically result in some files being copied and * others not, i.e this method is not exception safe */ - public static void copyDirectory(File sourceLocation , File targetLocation, int maxRecurseLevel, FilenameFilter filter) throws IOException { + public static void copyDirectory(File sourceLocation, File targetLocation, int maxRecurseLevel, FilenameFilter filter) throws IOException { + if ( ! sourceLocation.exists()) throw new IllegalArgumentException(sourceLocation.getAbsolutePath() + " does not exist"); + if ( ! sourceLocation.isDirectory()) { // copy file InputStream in=null; OutputStream out=null; |