8170120: jimage throws IOException when the given file is not a jimage file

Reviewed-by: alanb
This commit is contained in:
Michal Vala 2018-02-19 13:26:41 +00:00 committed by Alan Bateman
parent c2859d192d
commit 04b8b8deff
3 changed files with 4 additions and 2 deletions

View File

@ -386,7 +386,7 @@ class JImageTask {
for (File file : options.jimages) {
if (!file.exists() || !file.isFile()) {
throw TASK_HELPER.newBadArgs("err.not.a.jimage", file.getName());
throw TASK_HELPER.newBadArgs("err.not.a.jimage", file);
}
try (BasicImageReader reader = BasicImageReader.open(file.toPath())) {
@ -431,6 +431,8 @@ class JImageTask {
}
}
}
} catch (IOException ioe) {
throw TASK_HELPER.newBadArgs("err.invalid.jimage", file, ioe.getMessage());
}
}
}

View File

@ -95,6 +95,7 @@ err.not.a.task=task must be one of <extract | info | list | verify>: {0}
err.missing.arg=no value given for {0}
err.not.a.dir=not a directory: {0}
err.not.a.jimage=not a jimage file: {0}
err.invalid.jimage=Unable to open {0}: {1}
err.no.jimage=no jimage provided
err.option.unsupported={0} not supported: {1}
err.unknown.option=unknown option: {0}

View File

@ -466,7 +466,6 @@ tools/launcher/FXLauncherTest.java 8068049 linux-al
tools/jimage/JImageExtractTest.java 8170120 generic-all
tools/jimage/JImageListTest.java 8170120 generic-all
tools/jimage/JImageVerifyTest.java 8170120 generic-all
############################################################################