HADOOP-14213. Move Configuration runtime check for hadoop-site.xml to 
initialization. Contributed by Jonathan Eagles


Project: http://git-wip-us.apache.org/repos/asf/hadoop/repo
Commit: http://git-wip-us.apache.org/repos/asf/hadoop/commit/595f62e3
Tree: http://git-wip-us.apache.org/repos/asf/hadoop/tree/595f62e3
Diff: http://git-wip-us.apache.org/repos/asf/hadoop/diff/595f62e3

Branch: refs/heads/HDFS-9806
Commit: 595f62e362c08704d6fb692e21c97b512bc7ec49
Parents: a5a4867
Author: Ravi Prakash <ravip...@altiscale.com>
Authored: Thu Mar 23 09:28:10 2017 -0700
Committer: Ravi Prakash <ravip...@altiscale.com>
Committed: Thu Mar 23 09:28:10 2017 -0700

----------------------------------------------------------------------
 .../org/apache/hadoop/conf/Configuration.java     | 18 ++++++++----------
 1 file changed, 8 insertions(+), 10 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hadoop/blob/595f62e3/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/conf/Configuration.java
----------------------------------------------------------------------
diff --git 
a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/conf/Configuration.java
 
b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/conf/Configuration.java
index bade06e..a9c8d9c 100644
--- 
a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/conf/Configuration.java
+++ 
b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/conf/Configuration.java
@@ -668,21 +668,24 @@ public class Configuration implements 
Iterable<Map.Entry<String,String>>,
     }
   }
  
-  static{
-    //print deprecation warning if hadoop-site.xml is found in classpath
+  static {
+    // Add default resources
+    addDefaultResource("core-default.xml");
+    addDefaultResource("core-site.xml");
+
+    // print deprecation warning if hadoop-site.xml is found in classpath
     ClassLoader cL = Thread.currentThread().getContextClassLoader();
     if (cL == null) {
       cL = Configuration.class.getClassLoader();
     }
-    if(cL.getResource("hadoop-site.xml")!=null) {
+    if (cL.getResource("hadoop-site.xml") != null) {
       LOG.warn("DEPRECATED: hadoop-site.xml found in the classpath. " +
           "Usage of hadoop-site.xml is deprecated. Instead use core-site.xml, "
           + "mapred-site.xml and hdfs-site.xml to override properties of " +
           "core-default.xml, mapred-default.xml and hdfs-default.xml " +
           "respectively");
+      addDefaultResource("hadoop-site.xml");
     }
-    addDefaultResource("core-default.xml");
-    addDefaultResource("core-site.xml");
   }
   
   private Properties properties;
@@ -2638,11 +2641,6 @@ public class Configuration implements 
Iterable<Map.Entry<String,String>>,
       for (String resource : defaultResources) {
         loadResource(properties, new Resource(resource), quiet);
       }
-    
-      //support the hadoop-site.xml as a deprecated case
-      if(getResource("hadoop-site.xml")!=null) {
-        loadResource(properties, new Resource("hadoop-site.xml"), quiet);
-      }
     }
     
     for (int i = 0; i < resources.size(); i++) {


---------------------------------------------------------------------
To unsubscribe, e-mail: common-commits-unsubscr...@hadoop.apache.org
For additional commands, e-mail: common-commits-h...@hadoop.apache.org

Reply via email to