This is an automated email from the ASF dual-hosted git repository.
dongjoon pushed a commit to branch branch-2.0
in repository https://gitbox.apache.org/repos/asf/orc.git
The following commit(s) were added to refs/heads/branch-2.0 by this push:
new 2823cb507 ORC-1642: Avoid `System.exit(0)` in `scan` command
2823cb507 is described below
commit 2823cb50764732b1f5815d5e16784a5eaa410db5
Author: sychen <[email protected]>
AuthorDate: Thu Feb 29 21:24:10 2024 -0800
ORC-1642: Avoid `System.exit(0)` in `scan` command
### What changes were proposed in this pull request?
This PR aims to avoid `System.exit(0)` in `scan` command.
### Why are the changes needed?
`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 #1832 from cxzl25/ORC-1642.
Authored-by: sychen <[email protected]>
Signed-off-by: Dongjoon Hyun <[email protected]>
(cherry picked from commit 207085de3722054485e685811f8e5f2e11aa4deb)
Signed-off-by: Dongjoon Hyun <[email protected]>
---
java/tools/src/java/org/apache/orc/tools/ScanData.java | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/java/tools/src/java/org/apache/orc/tools/ScanData.java
b/java/tools/src/java/org/apache/orc/tools/ScanData.java
index 9640cd2b1..eefe7af6a 100644
--- a/java/tools/src/java/org/apache/orc/tools/ScanData.java
+++ b/java/tools/src/java/org/apache/orc/tools/ScanData.java
@@ -215,7 +215,10 @@ public class ScanData {
}
}
}
- System.exit(badFiles.size());
+ if (!badFiles.isEmpty()) {
+ System.err.println(badFiles + " bad ORC files found.");
+ System.exit(1);
+ }
}
}
}