You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@flink.apache.org by ch...@apache.org on 2018/07/31 10:01:20 UTC

[flink] branch master updated: [FLINK-9996][fs] Wrap exceptions during FS creation

This is an automated email from the ASF dual-hosted git repository.

chesnay pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/flink.git


The following commit(s) were added to refs/heads/master by this push:
     new 2a70d4c  [FLINK-9996][fs] Wrap exceptions during FS creation
2a70d4c is described below

commit 2a70d4cdd790cd59e0974b4272b36afa6904a82a
Author: Chesnay <ch...@apache.org>
AuthorDate: Tue Jul 31 12:01:17 2018 +0200

    [FLINK-9996][fs] Wrap exceptions during FS creation
---
 .../flink/runtime/fs/hdfs/AbstractFileSystemFactory.java   | 14 ++++++++++----
 1 file changed, 10 insertions(+), 4 deletions(-)

diff --git a/flink-filesystems/flink-hadoop-fs/src/main/java/org/apache/flink/runtime/fs/hdfs/AbstractFileSystemFactory.java b/flink-filesystems/flink-hadoop-fs/src/main/java/org/apache/flink/runtime/fs/hdfs/AbstractFileSystemFactory.java
index 201d580..63919ba 100644
--- a/flink-filesystems/flink-hadoop-fs/src/main/java/org/apache/flink/runtime/fs/hdfs/AbstractFileSystemFactory.java
+++ b/flink-filesystems/flink-hadoop-fs/src/main/java/org/apache/flink/runtime/fs/hdfs/AbstractFileSystemFactory.java
@@ -51,10 +51,16 @@ public abstract class AbstractFileSystemFactory implements FileSystemFactory {
 	public FileSystem create(URI fsUri) throws IOException {
 		LOG.debug("Creating Hadoop file system (backed by " + name + ")");
 		LOG.debug("Loading Hadoop configuration for " + name);
-		org.apache.hadoop.conf.Configuration hadoopConfig = hadoopConfigLoader.getOrLoadHadoopConfig();
-		org.apache.hadoop.fs.FileSystem fs = createHadoopFileSystem();
-		fs.initialize(getInitURI(fsUri, hadoopConfig), hadoopConfig);
-		return new HadoopFileSystem(fs);
+		try {
+			org.apache.hadoop.conf.Configuration hadoopConfig = hadoopConfigLoader.getOrLoadHadoopConfig();
+			org.apache.hadoop.fs.FileSystem fs = createHadoopFileSystem();
+			fs.initialize(getInitURI(fsUri, hadoopConfig), hadoopConfig);
+			return new HadoopFileSystem(fs);
+		} catch (IOException ioe) {
+			throw ioe;
+		} catch (Exception e) {
+			throw new IOException(e.getMessage(), e);
+		}
 	}
 
 	protected abstract org.apache.hadoop.fs.FileSystem createHadoopFileSystem();