--- a/src/jdk.jpackage/share/classes/jdk/jpackage/internal/resources/MainResources.properties Mon Jul 01 18:31:16 2019 -0400
+++ b/src/jdk.jpackage/share/classes/jdk/jpackage/internal/resources/MainResources.properties Mon Jul 01 18:43:02 2019 -0400
@@ -82,3 +82,4 @@
ERR_NoEntryPoint=Error: creating application image requires --main-jar or --module Option.
ERR_InputNotDirectory=Error: Input directory specified is not a directory: {0}.
ERR_CannotReadInputDir=Error: No permission to read from input directory: {0}.
+ERR_CannotParseOptions=Error: Processing @filename option: {0}.
--- a/src/jdk.jpackage/share/classes/jdk/jpackage/internal/resources/MainResources_ja.properties Mon Jul 01 18:31:16 2019 -0400
+++ b/src/jdk.jpackage/share/classes/jdk/jpackage/internal/resources/MainResources_ja.properties Mon Jul 01 18:43:02 2019 -0400
@@ -82,3 +82,4 @@
ERR_NoEntryPoint=Error: creating application image requires --main-jar or --module Option.
ERR_InputNotDirectory=Error: Input directory specified is not a directory: {0}.
ERR_CannotReadInputDir=Error: No permission to read from input directory: {0}.
+ERR_CannotParseOptions=Error: Processing @filename option: {0}.
--- a/src/jdk.jpackage/share/classes/jdk/jpackage/internal/resources/MainResources_zh_CN.properties Mon Jul 01 18:31:16 2019 -0400
+++ b/src/jdk.jpackage/share/classes/jdk/jpackage/internal/resources/MainResources_zh_CN.properties Mon Jul 01 18:43:02 2019 -0400
@@ -82,3 +82,4 @@
ERR_NoEntryPoint=Error: creating application image requires --main-jar or --module Option.
ERR_InputNotDirectory=Error: Input directory specified is not a directory: {0}.
ERR_CannotReadInputDir=Error: No permission to read from input directory: {0}.
+ERR_CannotParseOptions=Error: Processing @filename option: {0}.
--- a/src/jdk.jpackage/share/classes/jdk/jpackage/main/CommandLine.java Mon Jul 01 18:31:16 2019 -0400
+++ b/src/jdk.jpackage/share/classes/jdk/jpackage/main/CommandLine.java Mon Jul 01 18:43:02 2019 -0400
@@ -25,19 +25,22 @@
package jdk.jpackage.main;
+import java.io.FileNotFoundException;
import java.io.IOException;
+import java.io.File;
import java.io.Reader;
import java.nio.charset.Charset;
import java.nio.file.Files;
+import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
/**
- * This file is direct copy of CommandLine.java in com.sun.tools.javac.main.
+ * This file was originally a copy of CommandLine.java in
+ * com.sun.tools.javac.main.
* It should track changes made to that file.
- * It is modified only to remove content not used by jpackage
*/
/**
@@ -84,6 +87,9 @@
}
private static void loadCmdFile(String name, List<String> args) throws IOException {
+ if (!Files.isReadable(Path.of(name))) {
+ throw new FileNotFoundException(name);
+ }
try (Reader r = Files.newBufferedReader(Paths.get(name), Charset.defaultCharset())) {
Tokenizer t = new Tokenizer(r);
String s;
--- a/src/jdk.jpackage/share/classes/jdk/jpackage/main/Main.java Mon Jul 01 18:31:16 2019 -0400
+++ b/src/jdk.jpackage/share/classes/jdk/jpackage/main/Main.java Mon Jul 01 18:43:02 2019 -0400
@@ -29,11 +29,13 @@
import jdk.jpackage.internal.CLIHelp;
import java.io.PrintWriter;
import java.util.ResourceBundle;
+import java.io.FileNotFoundException;
import java.io.IOException;
+import java.text.MessageFormat;
public class Main {
- private static final ResourceBundle bundle = ResourceBundle.getBundle(
+ private static final ResourceBundle I18N = ResourceBundle.getBundle(
"jdk.jpackage.internal.resources.MainResources");
/**
@@ -73,6 +75,10 @@
String[] newArgs;
try {
newArgs = CommandLine.parse(args);
+ } catch (FileNotFoundException fnfe) {
+ Log.error(MessageFormat.format(I18N.getString(
+ "ERR_CannotParseOptions"), fnfe.getMessage()));
+ return 1;
} catch (IOException ioe) {
Log.error(ioe.getMessage());
return 1;