Repository: oozie
Updated Branches:
  refs/heads/master 8463f228d -> 9b6f0c91e


OOZIE-3019 Remove getPasswordMethod in ConfigurationService (gezapeti)


Project: http://git-wip-us.apache.org/repos/asf/oozie/repo
Commit: http://git-wip-us.apache.org/repos/asf/oozie/commit/9b6f0c91
Tree: http://git-wip-us.apache.org/repos/asf/oozie/tree/9b6f0c91
Diff: http://git-wip-us.apache.org/repos/asf/oozie/diff/9b6f0c91

Branch: refs/heads/master
Commit: 9b6f0c91eca1ef73332b82bec9198c2723c8c598
Parents: 8463f22
Author: Gezapeti Cseh <gezap...@gmail.com>
Authored: Mon Jul 31 15:37:58 2017 +0200
Committer: Gezapeti Cseh <gezap...@gmail.com>
Committed: Mon Jul 31 15:38:38 2017 +0200

----------------------------------------------------------------------
 .../oozie/service/ConfigurationService.java     | 29 ++++----------------
 release-log.txt                                 |  1 +
 2 files changed, 7 insertions(+), 23 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/oozie/blob/9b6f0c91/core/src/main/java/org/apache/oozie/service/ConfigurationService.java
----------------------------------------------------------------------
diff --git 
a/core/src/main/java/org/apache/oozie/service/ConfigurationService.java 
b/core/src/main/java/org/apache/oozie/service/ConfigurationService.java
index 9fe179e..a519330 100644
--- a/core/src/main/java/org/apache/oozie/service/ConfigurationService.java
+++ b/core/src/main/java/org/apache/oozie/service/ConfigurationService.java
@@ -101,8 +101,6 @@ public class ConfigurationService implements Service, 
Instrumentable {
     private static final Set<String> MASK_PROPS = new HashSet<String>();
     private static Map<String,String> defaultConfigs = new 
HashMap<String,String>();
 
-    private static Method getPasswordMethod;
-
     static {
 
         //all this properties are seeded as system properties, no need to log 
changes
@@ -123,14 +121,6 @@ public class ConfigurationService implements Service, 
Instrumentable {
         // These properties should be masked when displayed because they 
contain sensitive info (e.g. password)
         MASK_PROPS.add(JPAService.CONF_PASSWORD);
         MASK_PROPS.add("oozie.authentication.signature.secret");
-
-        try {
-            // Only supported in Hadoop 2.6.0+
-            getPasswordMethod = Configuration.class.getMethod("getPassword", 
String.class);
-        } catch (NoSuchMethodException e) {
-            // Not supported
-            getPasswordMethod = null;
-        }
     }
 
     public static final String DEFAULT_CONFIG_FILE = "oozie-default.xml";
@@ -596,19 +586,12 @@ public class ConfigurationService implements Service, 
Instrumentable {
     }
 
     public static String getPassword(Configuration conf, String name, String 
defaultValue) {
-        if (getPasswordMethod != null) {
-            try {
-                char[] pass = (char[]) getPasswordMethod.invoke(conf, name);
-                return pass == null ? defaultValue : new String(pass);
-            } catch (IllegalAccessException e) {
-                log.error(e);
-                throw new IllegalArgumentException("Could not load password 
for [" + name + "]", e);
-            } catch (InvocationTargetException e) {
-                log.error(e);
-                throw new IllegalArgumentException("Could not load password 
for [" + name + "]", e);
-            }
-        } else {
-            return conf.get(name);
+        try {
+            char[] pass = conf.getPassword(name);
+            return pass == null ? defaultValue : new String(pass);
+        } catch (IOException e) {
+            log.error(e);
+            throw new IllegalArgumentException("Could not load password for [" 
+ name + "]", e);
         }
     }
 

http://git-wip-us.apache.org/repos/asf/oozie/blob/9b6f0c91/release-log.txt
----------------------------------------------------------------------
diff --git a/release-log.txt b/release-log.txt
index 9d69cef..4d39c34 100644
--- a/release-log.txt
+++ b/release-log.txt
@@ -1,5 +1,6 @@
 -- Oozie 5.0.0 release (trunk - unreleased)
 
+OOZIE-3019 Remove getPasswordMethod in ConfigurationService (gezapeti)
 OOZIE-3009 Number of Oozie tests executed dropped after OOZIE-2854 
(andras.piros via asasvari)
 OOZIE-2961 Build contains multiple warnings for is not a parameter name (Artem 
Ervits via gezapeti)
 OOZIE-3018 Use Hadoop's CredentialProvider for passwords in 
SchemaCheckerService (andras.piros via gezapeti)

Reply via email to