You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@paimon.apache.org by lz...@apache.org on 2023/04/21 08:07:32 UTC
[incubator-paimon] branch master updated: [hotfix] Fix FileIOUtils.checkAccess to avoid NPE
This is an automated email from the ASF dual-hosted git repository.
lzljs3620320 pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-paimon.git
The following commit(s) were added to refs/heads/master by this push:
new 662fe7c7c [hotfix] Fix FileIOUtils.checkAccess to avoid NPE
662fe7c7c is described below
commit 662fe7c7c54fd0554c5f1b66def39034fd63f5ec
Author: JingsongLi <lz...@aliyun.com>
AuthorDate: Fri Apr 21 16:07:22 2023 +0800
[hotfix] Fix FileIOUtils.checkAccess to avoid NPE
---
paimon-common/src/main/java/org/apache/paimon/fs/FileIO.java | 4 ++--
paimon-common/src/main/java/org/apache/paimon/fs/FileIOUtils.java | 8 ++++++--
2 files changed, 8 insertions(+), 4 deletions(-)
diff --git a/paimon-common/src/main/java/org/apache/paimon/fs/FileIO.java b/paimon-common/src/main/java/org/apache/paimon/fs/FileIO.java
index b401c454a..04990ab63 100644
--- a/paimon-common/src/main/java/org/apache/paimon/fs/FileIO.java
+++ b/paimon-common/src/main/java/org/apache/paimon/fs/FileIO.java
@@ -251,12 +251,12 @@ public interface FileIO extends Serializable {
// load fallbackIO
FileIOLoader fallbackIO = config.fallbackIO();
if (loader == null) {
- loader = checkAccess(fallbackIO, path);
+ loader = checkAccess(fallbackIO, path, config);
}
// load hadoopIO
if (loader == null) {
- loader = checkAccess(new HadoopFileIOLoader(), path);
+ loader = checkAccess(new HadoopFileIOLoader(), path, config);
}
if (loader == null) {
diff --git a/paimon-common/src/main/java/org/apache/paimon/fs/FileIOUtils.java b/paimon-common/src/main/java/org/apache/paimon/fs/FileIOUtils.java
index 3a7670501..94e595142 100644
--- a/paimon-common/src/main/java/org/apache/paimon/fs/FileIOUtils.java
+++ b/paimon-common/src/main/java/org/apache/paimon/fs/FileIOUtils.java
@@ -18,19 +18,23 @@
package org.apache.paimon.fs;
+import org.apache.paimon.catalog.CatalogContext;
+
import java.io.IOException;
/** Utils for {@link FileIO}. */
public class FileIOUtils {
- public static FileIOLoader checkAccess(FileIOLoader fileIO, Path path) {
+ public static FileIOLoader checkAccess(FileIOLoader fileIO, Path path, CatalogContext config) {
try {
if (fileIO == null) {
return null;
}
// check access
- fileIO.load(path).exists(path);
+ FileIO io = fileIO.load(path);
+ io.configure(config);
+ io.exists(path);
return fileIO;
} catch (IOException ignore) {
return null;