From 680aa95dbb2a97f20a9ba6d59ab8bfb1c1ce75d5 Mon Sep 17 00:00:00 2001 From: Jim Laskey Date: Mon, 7 Nov 2016 14:36:27 -0400 Subject: [PATCH] 8155756: Better context for some jlink exceptions Reviewed-by: mchung --- .../share/classes/jdk/tools/jlink/internal/DirArchive.java | 2 +- .../share/classes/jdk/tools/jlink/internal/TaskHelper.java | 2 +- .../share/classes/jdk/tools/jlink/resources/jlink.properties | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/DirArchive.java b/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/DirArchive.java index 7b8c2c88655..84fee1b4710 100644 --- a/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/DirArchive.java +++ b/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/DirArchive.java @@ -92,7 +92,7 @@ public class DirArchive implements Archive { public DirArchive(Path dirPath, Consumer log) { Objects.requireNonNull(dirPath); if (!Files.isDirectory(dirPath)) { - throw new IllegalArgumentException("Not a directory"); + throw new IllegalArgumentException(dirPath + " is not a directory"); } chop = dirPath.toString().length() + 1; this.moduleName = Objects.requireNonNull(dirPath.getFileName()).toString(); diff --git a/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/TaskHelper.java b/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/TaskHelper.java index f5f74001d9c..083bf048724 100644 --- a/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/TaskHelper.java +++ b/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/TaskHelper.java @@ -212,7 +212,7 @@ public final class TaskHelper { mainOptions.add(new PlugOption(true, (task, opt, arg) -> { Path path = Paths.get(arg); if (!Files.exists(path) || !Files.isDirectory(path)) { - throw newBadArgs("err.image.must.exist"); + throw newBadArgs("err.image.must.exist", path); } existingImage = path.toAbsolutePath(); }, true, POST_PROCESS)); diff --git a/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/resources/jlink.properties b/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/resources/jlink.properties index 556e0b20c66..ac4a86293a6 100644 --- a/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/resources/jlink.properties +++ b/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/resources/jlink.properties @@ -91,7 +91,7 @@ err.modulepath.must.be.specified:--module-path must be specified err.mods.must.be.specified:no modules specified to {0} err.path.not.found=path not found: {0} err.path.not.valid=invalid path: {0} -err.image.must.exist=image does not exist or is not a directory +err.image.must.exist=image {0} does not exist or is not a directory err.existing.image.invalid=existing image is not valid err.file.not.found=cannot find file: {0} err.file.error=cannot access file: {0}