Merge
authorlana
Thu, 20 Oct 2016 20:01:31 +0000
changeset 41617 34adecd02b10
parent 41614 62c4aa12454a (current diff)
parent 41616 89347182c199 (diff)
child 41618 c21a5d772a0d
child 42114 5cecf1898b8d
Merge
--- a/nashorn/src/jdk.scripting.nashorn.shell/share/classes/jdk/nashorn/tools/jjs/Console.java	Thu Oct 20 18:38:11 2016 +0000
+++ b/nashorn/src/jdk.scripting.nashorn.shell/share/classes/jdk/nashorn/tools/jjs/Console.java	Thu Oct 20 20:01:31 2016 +0000
@@ -42,6 +42,8 @@
 import jdk.internal.jline.console.ConsoleReader;
 import jdk.internal.jline.console.KeyMap;
 import jdk.internal.jline.extra.EditingHistory;
+import jdk.internal.misc.Signal;
+import jdk.internal.misc.Signal.Handler;
 
 class Console implements AutoCloseable {
     private static final String DOCUMENTATION_SHORTCUT = "\033\133\132"; //Shift-TAB
@@ -68,6 +70,21 @@
         in.addCompleter(completer);
         Runtime.getRuntime().addShutdownHook(new Thread((Runnable)this::saveHistory));
         bind(DOCUMENTATION_SHORTCUT, (ActionListener)evt -> showDocumentation(docHelper));
+        try {
+            Signal.handle(new Signal("CONT"), new Handler() {
+                @Override public void handle(Signal sig) {
+                    try {
+                        in.getTerminal().reset();
+                        in.redrawLine();
+                        in.flush();
+                    } catch (Exception ex) {
+                        ex.printStackTrace();
+                    }
+                }
+            });
+        } catch (IllegalArgumentException ignored) {
+            //the CONT signal does not exist on this platform
+        }
     }
 
     String readLine(final String prompt) throws IOException {
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/scripting/NashornScriptEngineFactory.java	Thu Oct 20 18:38:11 2016 +0000
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/scripting/NashornScriptEngineFactory.java	Thu Oct 20 20:01:31 2016 +0000
@@ -129,10 +129,11 @@
 
     @Override
     public String getProgram(final String... statements) {
+        Objects.requireNonNull(statements);
         final StringBuilder sb = new StringBuilder();
 
         for (final String statement : statements) {
-            sb.append(statement).append(';');
+            sb.append(Objects.requireNonNull(statement)).append(';');
         }
 
         return sb.toString();