8159031: jjs throws NoSuchFileException if ~/.jjs.history does not exist
Reviewed-by: sundar, mhaupt
--- a/nashorn/src/jdk.scripting.nashorn.shell/share/classes/jdk/nashorn/tools/jjs/Console.java Tue Jun 07 19:13:26 2016 +0530
+++ b/nashorn/src/jdk.scripting.nashorn.shell/share/classes/jdk/nashorn/tools/jjs/Console.java Wed Jun 08 15:53:22 2016 +0200
@@ -59,7 +59,8 @@
in.setHandleUserInterrupt(true);
in.setBellEnabled(true);
in.setCopyPasteDetection(true);
- in.setHistory(new EditingHistory(in, Files.readAllLines(historyFile.toPath())) {
+ final Iterable<String> existingHistory = historyFile.exists() ? Files.readAllLines(historyFile.toPath()) : null;
+ in.setHistory(new EditingHistory(in, existingHistory) {
@Override protected boolean isComplete(CharSequence input) {
return completer.isComplete(input.toString());
}