cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jbel...@apache.org
Subject svn commit: r1158006 - /cassandra/trunk/src/java/org/apache/cassandra/cli/CliClient.java
Date Mon, 15 Aug 2011 20:50:47 GMT
Author: jbellis
Date: Mon Aug 15 20:50:47 2011
New Revision: 1158006

URL: http://svn.apache.org/viewvc?rev=1158006&view=rev
Log:
fix loading cli help outside command execution loop
patch by jbellis

Modified:
    cassandra/trunk/src/java/org/apache/cassandra/cli/CliClient.java

Modified: cassandra/trunk/src/java/org/apache/cassandra/cli/CliClient.java
URL: http://svn.apache.org/viewvc/cassandra/trunk/src/java/org/apache/cassandra/cli/CliClient.java?rev=1158006&r1=1158005&r2=1158006&view=diff
==============================================================================
--- cassandra/trunk/src/java/org/apache/cassandra/cli/CliClient.java (original)
+++ cassandra/trunk/src/java/org/apache/cassandra/cli/CliClient.java Mon Aug 15 20:50:47 2011
@@ -17,7 +17,6 @@
  */
 package org.apache.cassandra.cli;
 
-import java.io.IOError;
 import java.io.IOException;
 import java.io.InputStream;
 import java.net.InetAddress;
@@ -58,7 +57,6 @@ import org.yaml.snakeyaml.Yaml;
 // Cli Client Side Library
 public class CliClient
 {
-
     /**
      * Available value conversion functions
      * Used by convertValueByFunction(Tree functionCall) method
@@ -163,6 +161,13 @@ public class CliClient
 
     private CliUserHelp getHelp()
     {
+        if (help == null)
+            help = loadHelp();
+        return help;
+    }
+
+    private CliUserHelp loadHelp()
+    {
         final InputStream is = CliClient.class.getClassLoader().getResourceAsStream("org/apache/cassandra/cli/CliHelp.yaml");
         assert is != null;
 
@@ -182,7 +187,7 @@ public class CliClient
 
     public void printBanner()
     {
-        sessionState.out.println(help.banner);
+        sessionState.out.println(getHelp().banner);
     }
 
     // Execute a CLI Statement 
@@ -315,13 +320,10 @@ public class CliClient
 
     private void executeHelp(Tree tree)
     {
-        if (help == null)
-            help = getHelp();
-
         if (tree.getChildCount() > 0)
         {
             String token = tree.getChild(0).getText();
-            for (CliCommandHelp ch : help.commands)
+            for (CliCommandHelp ch : getHelp().commands)
             {
                 if (token.equals(ch.name))
                 {
@@ -332,7 +334,7 @@ public class CliClient
         }
         else
         {
-            sessionState.out.println(help.help);
+            sessionState.out.println(getHelp().help);
         }
     }
 



Mime
View raw message