You are viewing a plain text version of this content. The canonical link for it is here.
Posted to common-issues@hadoop.apache.org by "Steve Loughran (JIRA)" <ji...@apache.org> on 2015/12/17 16:22:46 UTC

[jira] [Commented] (HADOOP-12654) Move FileSystem.initialize to constructor

    [ https://issues.apache.org/jira/browse/HADOOP-12654?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15062181#comment-15062181 ] 

Steve Loughran commented on HADOOP-12654:
-----------------------------------------

doing that makes a mess of subclasses.

Specifically, if you put initialize() in the base constructor, then when FileSystem.initialize is called from it, subclasses won't have had their constructor fully executed/fields set up. You will not eliminate NPEs, merely move them.

Why not use {{FileSystem.get()}} to get an FS instance, the way most people do?

> Move FileSystem.initialize to constructor
> -----------------------------------------
>
>                 Key: HADOOP-12654
>                 URL: https://issues.apache.org/jira/browse/HADOOP-12654
>             Project: Hadoop Common
>          Issue Type: Improvement
>          Components: fs
>    Affects Versions: 2.7.1
>            Reporter: Dennis Harmath
>            Priority: Minor
>
> After calling the FileSystem constructor, the instance is not initialized yet, but FileSystem#initialize has to be called, otherwise an NPE is thrown when using the instance. The constructor should create a valid instance instead.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)