diff options
author | Harald Musum <musum@yahooinc.com> | 2023-09-21 08:44:19 +0200 |
---|---|---|
committer | Harald Musum <musum@yahooinc.com> | 2023-09-21 08:44:19 +0200 |
commit | 34c1ec6db07d5ab9c20f98e6f466694199e1958a (patch) | |
tree | e8cc718e39fd49cd299b686c7043f18e9865ec5d /config-model | |
parent | 92d656cb14e33c4aea1677241aa687bdc70d5bc1 (diff) |
Print relative path in error message
Diffstat (limited to 'config-model')
-rw-r--r-- | config-model/src/main/java/com/yahoo/vespa/model/filedistribution/UserConfiguredFiles.java | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/config-model/src/main/java/com/yahoo/vespa/model/filedistribution/UserConfiguredFiles.java b/config-model/src/main/java/com/yahoo/vespa/model/filedistribution/UserConfiguredFiles.java index 0196ffc7ce9..6d1de4bbc0a 100644 --- a/config-model/src/main/java/com/yahoo/vespa/model/filedistribution/UserConfiguredFiles.java +++ b/config-model/src/main/java/com/yahoo/vespa/model/filedistribution/UserConfiguredFiles.java @@ -15,7 +15,6 @@ import com.yahoo.yolean.Exceptions; import java.io.File; import java.io.Serializable; -import java.nio.file.Files; import java.util.Collection; import java.util.HashMap; import java.util.Map; @@ -142,10 +141,8 @@ public class UserConfiguredFiles implements Serializable { } File file = path.toFile(); - if (file.isDirectory()) { - if (file.listFiles() == null || file.listFiles().length == 0) - throw new IllegalArgumentException("Directory '" + path + "' is empty"); - } + if (file.isDirectory() && (file.listFiles() == null || file.listFiles().length == 0)) + throw new IllegalArgumentException("Directory '" + path.getRelative() + "' is empty"); FileReference reference = registeredFiles.get(path); if (reference == null) { @@ -153,7 +150,7 @@ public class UserConfiguredFiles implements Serializable { registeredFiles.put(path, reference); } if (reference == null) - throw new IllegalArgumentException("No such file or directory '" + path + "'"); + throw new IllegalArgumentException("No such file or directory '" + path.getRelative() + "'"); if (isModelType) { var model = ModelReference.valueOf(builder.getValue()); |