Repository: phoenix
Updated Branches:
  refs/heads/3.0 ed3e3f55f -> d42866918


PHOENIX-1341 Exit status for PhoenixRuntime

Return a non-zero exit status on a failure in PhoenixRuntime.

Signed-off-by: Gabriel Reid <gabri...@ngdata.com>


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

Branch: refs/heads/3.0
Commit: d42866918448d18e32fbdf3266dd8add7ec1b428
Parents: ed3e3f5
Author: Brian Johnson <git...@brianjohnson.cc>
Authored: Sat Oct 11 14:30:37 2014 -0700
Committer: Gabriel Reid <gabri...@ngdata.com>
Committed: Mon Oct 13 09:57:43 2014 +0200

----------------------------------------------------------------------
 .../src/main/java/org/apache/phoenix/util/PhoenixRuntime.java | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/phoenix/blob/d4286691/phoenix-core/src/main/java/org/apache/phoenix/util/PhoenixRuntime.java
----------------------------------------------------------------------
diff --git 
a/phoenix-core/src/main/java/org/apache/phoenix/util/PhoenixRuntime.java 
b/phoenix-core/src/main/java/org/apache/phoenix/util/PhoenixRuntime.java
index fdcc02a..064ca62 100644
--- a/phoenix-core/src/main/java/org/apache/phoenix/util/PhoenixRuntime.java
+++ b/phoenix-core/src/main/java/org/apache/phoenix/util/PhoenixRuntime.java
@@ -129,6 +129,8 @@ public class PhoenixRuntime {
         ExecutionCommand execCmd = ExecutionCommand.parseArgs(args);
         String jdbcUrl = JDBC_PROTOCOL + JDBC_PROTOCOL_SEPARATOR + 
execCmd.getConnectionString();
 
+        int exitStatus = 0;
+
         PhoenixConnection conn = null;
         try {
             Properties props = new Properties();
@@ -157,6 +159,7 @@ public class PhoenixRuntime {
             }
         } catch (Throwable t) {
             t.printStackTrace();
+            exitStatus = 1;
         } finally {
             if (conn != null) {
                 try {
@@ -165,7 +168,7 @@ public class PhoenixRuntime {
                     //going to shut jvm down anyway. So might as well feast on 
it.
                 }
             }
-            System.exit(0);
+            System.exit(exitStatus);
         }
     }
 
@@ -414,7 +417,7 @@ public class PhoenixRuntime {
                     output.write(QueryConstants.SEPARATOR_BYTE);
                 }
                 type = pkColumns.get(i).getDataType();
-                
+
                 //for fixed width data types like CHAR and BINARY, we need to 
pad values to be of max length.
                 Object paddedObj = type.pad(values[i - offset], 
pkColumns.get(i).getMaxLength());
                 byte[] value = type.toBytes(paddedObj);

Reply via email to