changeset 11702:267a03dfb105

Merge
author kevinw
date Mon, 06 Jun 2016 22:39:03 +0000
parents 1d346a5b8a11 7ced0993caf4
children 444346a90b1e
files
diffstat 2 files changed, 23 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/src/share/classes/com/sun/tools/example/debug/tty/EventHandler.java	Tue Jun 07 00:29:22 2016 +0300
+++ b/src/share/classes/com/sun/tools/example/debug/tty/EventHandler.java	Mon Jun 06 22:39:03 2016 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1998, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -133,6 +133,10 @@
             if (!vmDied) {
                 vmDisconnectEvent(event);
             }
+            /*
+             * Inform jdb command line processor that jdb is being shutdown. JDK-8154144.
+             */
+            ((TTY)notifier).setShuttingDown(true);
             Env.shutdown(shutdownMessageKey);
             return false;
         } else {
--- a/src/share/classes/com/sun/tools/example/debug/tty/TTY.java	Tue Jun 07 00:29:22 2016 +0300
+++ b/src/share/classes/com/sun/tools/example/debug/tty/TTY.java	Mon Jun 06 22:39:03 2016 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1998, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -56,6 +56,16 @@
      */
     private static final String progname = "jdb";
 
+    private volatile boolean shuttingDown = false;
+
+    public void setShuttingDown(boolean s) {
+       shuttingDown = s;
+    }
+
+    public boolean isShuttingDown() {
+        return shuttingDown;
+    }
+
     @Override
     public void vmStartEvent(VMStartEvent se)  {
         Thread.yield();  // fetch output
@@ -750,7 +760,13 @@
             while (true) {
                 String ln = in.readLine();
                 if (ln == null) {
-                    MessageOutput.println("Input stream closed.");
+                    /*
+                     *  Jdb is being shutdown because debuggee exited, ignore any 'null'
+                     *  returned by readLine() during shutdown. JDK-8154144.
+                     */
+                    if (!isShuttingDown()) {
+                        MessageOutput.println("Input stream closed.");
+                    }
                     ln = "quit";
                 }