Bug#1854 - Exit command in console causing OOM. 97/11197/1
authorSharon Aicler <saichler@cisco.com>
Mon, 15 Sep 2014 17:17:23 +0000 (10:17 -0700)
committerSharon Aicler <saichler@cisco.com>
Mon, 15 Sep 2014 17:17:23 +0000 (10:17 -0700)
Change-Id: I20606d7918b730c6b3d7e77a85227bc6a87a59b0
Signed-off-by: Sharon Aicler <saichler@cisco.com>
opendaylight/md-sal/sal-dom-xsql/src/main/java/org/opendaylight/controller/md/sal/dom/xsql/XSQLAdapter.java

index 96ddb9e..d1f11ba 100644 (file)
@@ -492,13 +492,15 @@ public class XSQLAdapter extends Thread implements SchemaContextListener {
                     out.print(prompt);
                     char c = 0;
                     byte data[] = new byte[1];
-                    while (c != '\n') {
+                    while (!socket.isClosed() && socket.isConnected() && !socket.isInputShutdown() && c != '\n') {
                         try {
                             in.read(data);
                             c = (char) data[0];
                             inputString.append(c);
                         } catch (Exception err) {
                             err.printStackTrace(out);
+                            stopped = true;
+                            break;
                         }
                     }