You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@orc.apache.org by do...@apache.org on 2024/02/27 05:10:37 UTC

(orc) branch main updated: ORC-1638: Avoid `System.exit(0)` in `count` command

This is an automated email from the ASF dual-hosted git repository.

dongjoon pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/orc.git


The following commit(s) were added to refs/heads/main by this push:
     new b511d13c5 ORC-1638: Avoid `System.exit(0)` in `count` command
b511d13c5 is described below

commit b511d13c5e404f690df9d1d06a09b4e6a4bde41a
Author: sychen <sy...@ctrip.com>
AuthorDate: Mon Feb 26 21:10:28 2024 -0800

    ORC-1638: Avoid `System.exit(0)` in `count` command
    
    ### What changes were proposed in this pull request?
    This PR aims to avoid `System.exit(0)` in `count` command.
    
    ### Why are the changes needed?
    https://github.com/apache/orc/pull/1817#discussion_r1503572991
    
    `System.exit(0)` is not conducive to testing, especially in Java17 and above. Without `System.exit(0)`, the program can exit normally.
    
    ### How was this patch tested?
    local test
    
    ### Was this patch authored or co-authored using generative AI tooling?
    No
    
    Closes #1825 from cxzl25/ORC-1638.
    
    Authored-by: sychen <sy...@ctrip.com>
    Signed-off-by: Dongjoon Hyun <do...@apache.org>
---
 java/tools/src/java/org/apache/orc/tools/RowCount.java | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/java/tools/src/java/org/apache/orc/tools/RowCount.java b/java/tools/src/java/org/apache/orc/tools/RowCount.java
index c7c6014a5..fce0db3f4 100644
--- a/java/tools/src/java/org/apache/orc/tools/RowCount.java
+++ b/java/tools/src/java/org/apache/orc/tools/RowCount.java
@@ -66,7 +66,9 @@ public class RowCount {
         }
       }
     }
-    System.exit(bad == 0 ? 0 : 1);
+    if (bad > 0) {
+      System.exit(1);
+    }
   }
 
   public static void main(String[] args) throws Exception {