tajo-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jihoon...@apache.org
Subject [2/9] tajo git commit: TAJO-1393: Resolve findbug warnings on Tajo Cli Module
Date Mon, 23 Mar 2015 02:56:11 GMT
TAJO-1393: Resolve findbug warnings on Tajo Cli Module

Closes #417

Signed-off-by: Hyunsik Choi <hyunsik@apache.org>


Project: http://git-wip-us.apache.org/repos/asf/tajo/repo
Commit: http://git-wip-us.apache.org/repos/asf/tajo/commit/e15ac7e5
Tree: http://git-wip-us.apache.org/repos/asf/tajo/tree/e15ac7e5
Diff: http://git-wip-us.apache.org/repos/asf/tajo/diff/e15ac7e5

Branch: refs/heads/index_support
Commit: e15ac7e5596ad03aedc1168e422099e1d0ee9a1d
Parents: 725448c
Author: Dongjoon Hyun <dongjoon@apache.org>
Authored: Fri Mar 13 09:56:46 2015 +0900
Committer: Hyunsik Choi <hyunsik@apache.org>
Committed: Thu Mar 19 18:39:28 2015 -0700

----------------------------------------------------------------------
 CHANGES                                                   |  3 +++
 .../main/java/org/apache/tajo/cli/tools/TajoAdmin.java    |  1 -
 .../main/java/org/apache/tajo/cli/tools/TajoGetConf.java  |  5 -----
 .../main/java/org/apache/tajo/cli/tools/TajoHAAdmin.java  |  5 -----
 .../tajo/cli/tsql/DefaultTajoCliOutputFormatter.java      |  2 +-
 .../main/java/org/apache/tajo/cli/tsql/SimpleParser.java  |  3 ++-
 .../src/main/java/org/apache/tajo/cli/tsql/TajoCli.java   | 10 ++++------
 7 files changed, 10 insertions(+), 19 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tajo/blob/e15ac7e5/CHANGES
----------------------------------------------------------------------
diff --git a/CHANGES b/CHANGES
index 56d77b3..6ae53f6 100644
--- a/CHANGES
+++ b/CHANGES
@@ -79,6 +79,9 @@ Release 0.11.0 - unreleased
 
   SUB TASKS
 
+    TAJO-1393: Resolve findbug warnings on Tajo Cli Module.
+    (Contributed by Dongjoon Hyun, Committed by hyunsik)
+
     TAJO-1337: Implements common modules to handle RESTful API. (jihun)
 
     TAJO-1329: Improve Schema class to support nested struct support.

http://git-wip-us.apache.org/repos/asf/tajo/blob/e15ac7e5/tajo-cli/src/main/java/org/apache/tajo/cli/tools/TajoAdmin.java
----------------------------------------------------------------------
diff --git a/tajo-cli/src/main/java/org/apache/tajo/cli/tools/TajoAdmin.java b/tajo-cli/src/main/java/org/apache/tajo/cli/tools/TajoAdmin.java
index 5497435..98ccc5f 100644
--- a/tajo-cli/src/main/java/org/apache/tajo/cli/tools/TajoAdmin.java
+++ b/tajo-cli/src/main/java/org/apache/tajo/cli/tools/TajoAdmin.java
@@ -71,7 +71,6 @@ public class TajoAdmin {
 
   private TajoConf tajoConf;
   private TajoClient tajoClient;
-  private ServiceTracker serviceTracker;
   private Writer writer;
 
   public TajoAdmin(TajoConf tajoConf, Writer writer) {

http://git-wip-us.apache.org/repos/asf/tajo/blob/e15ac7e5/tajo-cli/src/main/java/org/apache/tajo/cli/tools/TajoGetConf.java
----------------------------------------------------------------------
diff --git a/tajo-cli/src/main/java/org/apache/tajo/cli/tools/TajoGetConf.java b/tajo-cli/src/main/java/org/apache/tajo/cli/tools/TajoGetConf.java
index 756f2ee..0c4a42a 100644
--- a/tajo-cli/src/main/java/org/apache/tajo/cli/tools/TajoGetConf.java
+++ b/tajo-cli/src/main/java/org/apache/tajo/cli/tools/TajoGetConf.java
@@ -40,7 +40,6 @@ public class TajoGetConf {
   }
 
   private TajoConf tajoConf;
-  private TajoClient tajoClient;
   private Writer writer;
 
   public final static String defaultLeftPad = " ";
@@ -53,7 +52,6 @@ public class TajoGetConf {
   public TajoGetConf(TajoConf tajoConf, Writer writer, TajoClient tajoClient) {
     this.tajoConf = tajoConf;
     this.writer = writer;
-    this.tajoClient = tajoClient;
   }
 
   private void printUsage(boolean tsqlMode) {
@@ -115,9 +113,6 @@ public class TajoGetConf {
       return;
     } else if (hostName != null && port != null) {
       tajoConf.setVar(TajoConf.ConfVars.TAJO_MASTER_CLIENT_RPC_ADDRESS, hostName + ":" +
port);
-      tajoClient = new TajoClientImpl(ServiceTrackerFactory.get(tajoConf));
-    } else if (hostName == null && port == null) {
-      tajoClient = new TajoClientImpl(ServiceTrackerFactory.get(tajoConf));
     }
 
     processConfKey(writer, param);

http://git-wip-us.apache.org/repos/asf/tajo/blob/e15ac7e5/tajo-cli/src/main/java/org/apache/tajo/cli/tools/TajoHAAdmin.java
----------------------------------------------------------------------
diff --git a/tajo-cli/src/main/java/org/apache/tajo/cli/tools/TajoHAAdmin.java b/tajo-cli/src/main/java/org/apache/tajo/cli/tools/TajoHAAdmin.java
index 127ee8c..e25d7d4 100644
--- a/tajo-cli/src/main/java/org/apache/tajo/cli/tools/TajoHAAdmin.java
+++ b/tajo-cli/src/main/java/org/apache/tajo/cli/tools/TajoHAAdmin.java
@@ -44,7 +44,6 @@ public class TajoHAAdmin {
   }
 
   private TajoConf tajoConf;
-  private TajoClient tajoClient;
   private Writer writer;
 
   public TajoHAAdmin(TajoConf tajoConf, Writer writer) {
@@ -54,7 +53,6 @@ public class TajoHAAdmin {
   public TajoHAAdmin(TajoConf tajoConf, Writer writer, TajoClient tajoClient) {
     this.tajoConf = tajoConf;
     this.writer = writer;
-    this.tajoClient = tajoClient;
   }
 
   private void printUsage() {
@@ -127,9 +125,6 @@ public class TajoHAAdmin {
       return;
     } else if (hostName != null && port != null) {
       tajoConf.setVar(TajoConf.ConfVars.TAJO_MASTER_CLIENT_RPC_ADDRESS, hostName + ":" +
port);
-      tajoClient = new TajoClientImpl(ServiceTrackerFactory.get(tajoConf));
-    } else if (hostName == null && port == null) {
-      tajoClient = new TajoClientImpl(ServiceTrackerFactory.get(tajoConf));
     }
 
     if (!tajoConf.getBoolVar(TajoConf.ConfVars.TAJO_MASTER_HA_ENABLE)) {

http://git-wip-us.apache.org/repos/asf/tajo/blob/e15ac7e5/tajo-cli/src/main/java/org/apache/tajo/cli/tsql/DefaultTajoCliOutputFormatter.java
----------------------------------------------------------------------
diff --git a/tajo-cli/src/main/java/org/apache/tajo/cli/tsql/DefaultTajoCliOutputFormatter.java
b/tajo-cli/src/main/java/org/apache/tajo/cli/tsql/DefaultTajoCliOutputFormatter.java
index 5cbe77b..aaa411e 100644
--- a/tajo-cli/src/main/java/org/apache/tajo/cli/tsql/DefaultTajoCliOutputFormatter.java
+++ b/tajo-cli/src/main/java/org/apache/tajo/cli/tsql/DefaultTajoCliOutputFormatter.java
@@ -37,7 +37,7 @@ public class DefaultTajoCliOutputFormatter implements TajoCliOutputFormatter
{
   private boolean printPause;
   private boolean printErrorTrace;
   private String nullChar;
-  public static char QUIT_COMMAND = 'q';
+  public static final char QUIT_COMMAND = 'q';
 
   @Override
   public void init(TajoCli.TajoCliContext context) {

http://git-wip-us.apache.org/repos/asf/tajo/blob/e15ac7e5/tajo-cli/src/main/java/org/apache/tajo/cli/tsql/SimpleParser.java
----------------------------------------------------------------------
diff --git a/tajo-cli/src/main/java/org/apache/tajo/cli/tsql/SimpleParser.java b/tajo-cli/src/main/java/org/apache/tajo/cli/tsql/SimpleParser.java
index cc772a3..b8c4c28 100644
--- a/tajo-cli/src/main/java/org/apache/tajo/cli/tsql/SimpleParser.java
+++ b/tajo-cli/src/main/java/org/apache/tajo/cli/tsql/SimpleParser.java
@@ -180,7 +180,7 @@ public class SimpleParser {
             appendToBothStatements(chars, lineStartIdx, idx, 2); // omit two dash characters
'--' from history statement
             int commentStartIdx = idx;
             idx = consumeInlineComment(chars, idx);
-            appendToRawStatement(str.subSequence(commentStartIdx, idx).toString(), true);
+            appendToRawStatement(str.subSequence(commentStartIdx, idx).toString(), false);
             lineStartIdx = idx;
           }
           ///////////////////////////////////////////////////////
@@ -281,6 +281,7 @@ public class SimpleParser {
   private void appendToRawStatement(String str, boolean addLF) {
     if (!str.isEmpty() && !"\n".equals(str) &&
         rawAppender.length() > 0 && addLF && rawAppender.charAt(rawAppender.length()
- 1) != '\n') {
+      rawAppender.append("\n");
       rawAppender.append(str);
     } else {
       rawAppender.append(str);

http://git-wip-us.apache.org/repos/asf/tajo/blob/e15ac7e5/tajo-cli/src/main/java/org/apache/tajo/cli/tsql/TajoCli.java
----------------------------------------------------------------------
diff --git a/tajo-cli/src/main/java/org/apache/tajo/cli/tsql/TajoCli.java b/tajo-cli/src/main/java/org/apache/tajo/cli/tsql/TajoCli.java
index 354f60d..86046c4 100644
--- a/tajo-cli/src/main/java/org/apache/tajo/cli/tsql/TajoCli.java
+++ b/tajo-cli/src/main/java/org/apache/tajo/cli/tsql/TajoCli.java
@@ -665,12 +665,10 @@ public class TajoCli {
     }
     if (reconnect && (t instanceof InvalidClientSessionException ||
         (message != null && message.startsWith("org.apache.tajo.session.InvalidSessionException"))))
{
-      if (client instanceof SessionConnection) {
-        try {
-          ((SessionConnection)client).reconnect();
-        } catch (Exception e) {
-          // ignore
-        }
+      try {
+        ((SessionConnection)client).reconnect();
+      } catch (Exception e) {
+        // ignore
       }
     }
   }


Mime
View raw message