Repository: incubator-sentry Updated Branches: refs/heads/master 184968e81 -> 598849509
SENTRY-244: Sentry deprecated properties do not work (Prasad Mujumdar via Jarek Jarcec Cecho) Project: http://git-wip-us.apache.org/repos/asf/incubator-sentry/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-sentry/commit/59884950 Tree: http://git-wip-us.apache.org/repos/asf/incubator-sentry/tree/59884950 Diff: http://git-wip-us.apache.org/repos/asf/incubator-sentry/diff/59884950 Branch: refs/heads/master Commit: 5988495099432a977de9f161843b97e72c97cc98 Parents: 184968e Author: Jarek Jarcec Cecho <[email protected]> Authored: Sat Jun 21 11:31:15 2014 -0700 Committer: Jarek Jarcec Cecho <[email protected]> Committed: Sat Jun 21 11:31:15 2014 -0700 ---------------------------------------------------------------------- .../org/apache/sentry/binding/hive/conf/HiveAuthzConf.java | 8 ++++++++ .../org/apache/sentry/binding/hive/TestHiveAuthzConf.java | 2 ++ 2 files changed, 10 insertions(+) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-sentry/blob/59884950/sentry-binding/sentry-binding-hive/src/main/java/org/apache/sentry/binding/hive/conf/HiveAuthzConf.java ---------------------------------------------------------------------- diff --git a/sentry-binding/sentry-binding-hive/src/main/java/org/apache/sentry/binding/hive/conf/HiveAuthzConf.java b/sentry-binding/sentry-binding-hive/src/main/java/org/apache/sentry/binding/hive/conf/HiveAuthzConf.java index c126743..eb9ef00 100644 --- a/sentry-binding/sentry-binding-hive/src/main/java/org/apache/sentry/binding/hive/conf/HiveAuthzConf.java +++ b/sentry-binding/sentry-binding-hive/src/main/java/org/apache/sentry/binding/hive/conf/HiveAuthzConf.java @@ -183,6 +183,11 @@ public class HiveAuthzConf extends Configuration { @Override public String get(String varName) { + return get(varName, null); + } + + @Override + public String get(String varName, String defaultVal) { String retVal = super.get(varName); if (retVal == null) { // check if the deprecated value is set here @@ -196,6 +201,9 @@ public class HiveAuthzConf extends Configuration { " instead of " + varName); } } + if (retVal == null) { + retVal = defaultVal; + } return retVal; } http://git-wip-us.apache.org/repos/asf/incubator-sentry/blob/59884950/sentry-binding/sentry-binding-hive/src/test/java/org/apache/sentry/binding/hive/TestHiveAuthzConf.java ---------------------------------------------------------------------- diff --git a/sentry-binding/sentry-binding-hive/src/test/java/org/apache/sentry/binding/hive/TestHiveAuthzConf.java b/sentry-binding/sentry-binding-hive/src/test/java/org/apache/sentry/binding/hive/TestHiveAuthzConf.java index 1942e03..06b97e6 100644 --- a/sentry-binding/sentry-binding-hive/src/test/java/org/apache/sentry/binding/hive/TestHiveAuthzConf.java +++ b/sentry-binding/sentry-binding-hive/src/test/java/org/apache/sentry/binding/hive/TestHiveAuthzConf.java @@ -60,6 +60,8 @@ public class TestHiveAuthzConf { public void testDeprecatedConfig() { for (AuthzConfVars currentVar : currentProps) { Assert.assertEquals("deprecated", authzDepConf.get(currentVar.getVar())); + Assert.assertEquals("deprecated", + authzDepConf.get(currentVar.getVar(), "foobar")); } }
