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 207085de3 ORC-1642: Avoid `System.exit(0)` in `scan` command
207085de3 is described below
commit 207085de3722054485e685811f8e5f2e11aa4deb
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]>
---
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);
+ }
}
}
}