From 54ec7c6b21eab469110bc0074ebf612fa4bd5902 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hannes=20Walln=C3=B6fer?= Date: Wed, 8 Jun 2016 15:53:22 +0200 Subject: [PATCH] 8159031: jjs throws NoSuchFileException if ~/.jjs.history does not exist Reviewed-by: sundar, mhaupt --- .../share/classes/jdk/nashorn/tools/jjs/Console.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/nashorn/src/jdk.scripting.nashorn.shell/share/classes/jdk/nashorn/tools/jjs/Console.java b/nashorn/src/jdk.scripting.nashorn.shell/share/classes/jdk/nashorn/tools/jjs/Console.java index 49408b43aa0..1a72a88b4f0 100644 --- a/nashorn/src/jdk.scripting.nashorn.shell/share/classes/jdk/nashorn/tools/jjs/Console.java +++ b/nashorn/src/jdk.scripting.nashorn.shell/share/classes/jdk/nashorn/tools/jjs/Console.java @@ -59,7 +59,8 @@ class Console implements AutoCloseable { in.setHandleUserInterrupt(true); in.setBellEnabled(true); in.setCopyPasteDetection(true); - in.setHistory(new EditingHistory(in, Files.readAllLines(historyFile.toPath())) { + final Iterable 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()); }