summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHenning Baldersheim <balder@yahoo-inc.com>2022-01-03 17:10:29 +0100
committerGitHub <noreply@github.com>2022-01-03 17:10:29 +0100
commit246176a4cbc4820f3831d0bc48b40b2e45161a0a (patch)
tree00624c9d37267ce1b42da9ddef1566eab5c162c6
parent96ede726dd237b16ea2b3a0f1b1c1c0a9cce835e (diff)
parentbacce0c7b6f523492e0007ed6340089cead65974 (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.java4
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;