flink-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From zhangminglei <...@git.apache.org>
Subject [GitHub] flink pull request #4219: [FLINK-6842] [runtime] Uncomment and activate code...
Date Thu, 06 Jul 2017 13:21:30 GMT
Github user zhangminglei commented on a diff in the pull request:

    https://github.com/apache/flink/pull/4219#discussion_r125896588
  
    --- Diff: flink-runtime/src/main/java/org/apache/flink/runtime/fs/hdfs/HadoopFileSystem.java
---
    @@ -459,17 +459,14 @@ public boolean isDistributedFS() {
     	@Override
     	public Class<?> getHadoopWrapperClassNameForFileSystem(String scheme) {
     		Configuration hadoopConf = getHadoopConfiguration();
    -		Class<? extends org.apache.hadoop.fs.FileSystem> clazz;
    -		// We can activate this block once we drop Hadoop1 support (only hd2 has the getFileSystemClass-method)
    -//		try {
    -//			clazz = org.apache.hadoop.fs.FileSystem.getFileSystemClass(scheme, hadoopConf);
    -//		} catch (IOException e) {
    -//			LOG.info("Flink could not load the Hadoop File system implementation for scheme
"+scheme);
    -//			return null;
    -//		}
    -		clazz = hadoopConf.getClass("fs." + scheme + ".impl", null, org.apache.hadoop.fs.FileSystem.class);
    -
    -		if (clazz != null && LOG.isDebugEnabled()) {
    +		Class<? extends org.apache.hadoop.fs.FileSystem> clazz = null;
    +		try {
    +			clazz = org.apache.hadoop.fs.FileSystem.getFileSystemClass(scheme, hadoopConf);
    +		} catch (IOException e) {
    +			LOG.info("Flink could not load the Hadoop File system implementation for scheme "
+ scheme);
    +		}
    +
    +		if(LOG.isDebugEnabled()) {
    --- End diff --
    
    Since clazz is null here is unreachable. ```getFileSystemClass``` will check null condition.
And if ```clazz``` is null, ```getFileSystemClass``` will give a ```throw new IOException("No
FileSystem for scheme: " + scheme); ``` instead. Another question, you said this style ? like
```if( LOG.isDebugEnabled() )``` ?


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

Mime
View raw message