You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hive.apache.org by br...@apache.org on 2013/11/07 17:03:17 UTC

svn commit: r1539694 - /hive/trunk/beeline/src/java/org/apache/hive/beeline/Commands.java

Author: brock
Date: Thu Nov  7 16:03:17 2013
New Revision: 1539694

URL: http://svn.apache.org/r1539694
Log:
HIVE-5765 - Beeline throws NPE when -e option is used (Szehon Ho via Brock Noland)

Modified:
    hive/trunk/beeline/src/java/org/apache/hive/beeline/Commands.java

Modified: hive/trunk/beeline/src/java/org/apache/hive/beeline/Commands.java
URL: http://svn.apache.org/viewvc/hive/trunk/beeline/src/java/org/apache/hive/beeline/Commands.java?rev=1539694&r1=1539693&r2=1539694&view=diff
==============================================================================
--- hive/trunk/beeline/src/java/org/apache/hive/beeline/Commands.java (original)
+++ hive/trunk/beeline/src/java/org/apache/hive/beeline/Commands.java Thu Nov  7 16:03:17 2013
@@ -674,7 +674,10 @@ public class Commands {
 
     // use multiple lines for statements not terminated by ";"
     try {
-      while (!(line.trim().endsWith(";")) && beeLine.getOpts().isAllowMultiLineCommand()) {
+      //When using -e, console reader is not initialized and command is a single line
+      while (beeLine.getConsoleReader() != null && !(line.trim().endsWith(";"))
+        && beeLine.getOpts().isAllowMultiLineCommand()) {
+
         StringBuilder prompt = new StringBuilder(beeLine.getPrompt());
         for (int i = 0; i < prompt.length() - 1; i++) {
           if (prompt.charAt(i) != '>') {
@@ -691,6 +694,7 @@ public class Commands {
       beeLine.handleException(e);
     }
 
+
     if (line.endsWith(";")) {
       line = line.substring(0, line.length() - 1);
     }