You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@dolphinscheduler.apache.org by we...@apache.org on 2022/06/28 14:51:17 UTC
[dolphinscheduler] branch dev updated: [Fix-10641] [Common] Fix the hdfs NPE (#10642)
This is an automated email from the ASF dual-hosted git repository.
wenjun pushed a commit to branch dev
in repository https://gitbox.apache.org/repos/asf/dolphinscheduler.git
The following commit(s) were added to refs/heads/dev by this push:
new e0b0f986f7 [Fix-10641] [Common] Fix the hdfs NPE (#10642)
e0b0f986f7 is described below
commit e0b0f986f72e3fe4f7b5dea5a80c0366131ba0cd
Author: juzimao <57...@qq.com>
AuthorDate: Tue Jun 28 22:51:09 2022 +0800
[Fix-10641] [Common] Fix the hdfs NPE (#10642)
Fix the hdfs NPE (#10642)
---
.../dolphinscheduler/common/utils/HadoopUtils.java | 28 ++++++++++++----------
1 file changed, 16 insertions(+), 12 deletions(-)
diff --git a/dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/utils/HadoopUtils.java b/dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/utils/HadoopUtils.java
index 49425d5557..21f6b9d110 100644
--- a/dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/utils/HadoopUtils.java
+++ b/dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/utils/HadoopUtils.java
@@ -129,21 +129,25 @@ public class HadoopUtils implements Closeable, StorageOperate {
}
String defaultFS = configuration.get(Constants.FS_DEFAULT_FS);
+
+ if (StringUtils.isBlank(defaultFS)){
+ defaultFS= PropertyUtils.getString(Constants.FS_DEFAULT_FS);
+ }
+
//first get key from core-site.xml hdfs-site.xml ,if null ,then try to get from properties file
// the default is the local file system
- if (defaultFS.startsWith("file")) {
- String defaultFSProp = PropertyUtils.getString(Constants.FS_DEFAULT_FS);
- if (StringUtils.isNotBlank(defaultFSProp)) {
- Map<String, String> fsRelatedProps = PropertyUtils.getPrefixedProperties("fs.");
- configuration.set(Constants.FS_DEFAULT_FS, defaultFSProp);
- fsRelatedProps.forEach((key, value) -> configuration.set(key, value));
- } else {
- logger.error("property:{} can not to be empty, please set!", Constants.FS_DEFAULT_FS);
- throw new NullPointerException(
- String.format("property: %s can not to be empty, please set!", Constants.FS_DEFAULT_FS)
- );
- }
+ if (StringUtils.isNotBlank(defaultFS)) {
+ Map<String, String> fsRelatedProps = PropertyUtils.getPrefixedProperties("fs.");
+ configuration.set(Constants.FS_DEFAULT_FS, defaultFS);
+ fsRelatedProps.forEach((key, value) -> configuration.set(key, value));
} else {
+ logger.error("property:{} can not to be empty, please set!", Constants.FS_DEFAULT_FS);
+ throw new NullPointerException(
+ String.format("property: %s can not to be empty, please set!", Constants.FS_DEFAULT_FS)
+ );
+ }
+
+ if (!defaultFS.startsWith("file")) {
logger.info("get property:{} -> {}, from core-site.xml hdfs-site.xml ", Constants.FS_DEFAULT_FS, defaultFS);
}