This is an automated email from the ASF dual-hosted git repository.
hongze pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/incubator-gluten.git
The following commit(s) were added to refs/heads/main by this push:
new 27e7e66c9a [CORE] Some nit changes for ResourceUtil.scala (#10020)
27e7e66c9a is described below
commit 27e7e66c9ab988268790188e4bdecf202b4cb99a
Author: Hongze Zhang <[email protected]>
AuthorDate: Mon Jun 23 10:26:45 2025 +0800
[CORE] Some nit changes for ResourceUtil.scala (#10020)
---
.../java/org/apache/gluten/utils/ResourceUtil.java | 18 ++++++------------
1 file changed, 6 insertions(+), 12 deletions(-)
diff --git
a/gluten-core/src/main/java/org/apache/gluten/utils/ResourceUtil.java
b/gluten-core/src/main/java/org/apache/gluten/utils/ResourceUtil.java
index 89f48d4984..437ef6e80e 100644
--- a/gluten-core/src/main/java/org/apache/gluten/utils/ResourceUtil.java
+++ b/gluten-core/src/main/java/org/apache/gluten/utils/ResourceUtil.java
@@ -25,14 +25,10 @@ import org.slf4j.LoggerFactory;
import java.io.File;
import java.io.IOException;
import java.net.URL;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.Enumeration;
-import java.util.List;
+import java.util.*;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import java.util.zip.ZipEntry;
-import java.util.zip.ZipException;
import java.util.zip.ZipFile;
/**
@@ -108,14 +104,12 @@ public class ResourceUtil {
final ZipFile zf;
try {
zf = new ZipFile(jarFile);
- } catch (final ZipException e) {
- throw new RuntimeException(e);
} catch (final IOException e) {
- throw new RuntimeException(e);
+ throw new GlutenException(e);
}
- final Enumeration e = zf.entries();
+ final Enumeration<? extends ZipEntry> e = zf.entries();
while (e.hasMoreElements()) {
- final ZipEntry ze = (ZipEntry) e.nextElement();
+ final ZipEntry ze = e.nextElement();
final String fileName = ze.getName();
if (!fileName.startsWith(dir)) {
continue;
@@ -130,13 +124,13 @@ public class ResourceUtil {
try {
zf.close();
} catch (final IOException e1) {
- throw new RuntimeException(e1);
+ throw new GlutenException(e1);
}
}
private static void getResourcesFromDirectory(
final File root, final File directory, final Pattern pattern, final
List<String> buffer) {
- final File[] fileList = directory.listFiles();
+ final File[] fileList = Objects.requireNonNull(directory.listFiles());
for (final File file : fileList) {
if (file.isDirectory()) {
getResourcesFromDirectory(root, file, pattern, buffer);
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]