diff options
author | Henning Baldersheim <balder@yahoo-inc.com> | 2022-01-03 17:10:29 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-01-03 17:10:29 +0100 |
commit | 246176a4cbc4820f3831d0bc48b40b2e45161a0a (patch) | |
tree | 00624c9d37267ce1b42da9ddef1566eab5c162c6 | |
parent | 96ede726dd237b16ea2b3a0f1b1c1c0a9cce835e (diff) | |
parent | bacce0c7b6f523492e0007ed6340089cead65974 (diff) |
Merge pull request #20635 from vespa-engine/hmusum/verify-that-source-exists
Explicitly verify that source exists
-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; |