From 07cc3b3fad2b0ce67f22bbb18673a8d1f1a35636 Mon Sep 17 00:00:00 2001 From: Hari Shreedharan Date: Wed, 6 Nov 2013 10:36:43 -0800 Subject: [PATCH] SQOOP-1228. Method Configuration#unset is not available on Hadoop < 1.2.0 (Jarek Jarcec Cecho via Hari Shreedharan) --- .../apache/sqoop/util/password/CryptoFileLoader.java | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/java/org/apache/sqoop/util/password/CryptoFileLoader.java b/src/java/org/apache/sqoop/util/password/CryptoFileLoader.java index 54d2cf56..7241aa5c 100644 --- a/src/java/org/apache/sqoop/util/password/CryptoFileLoader.java +++ b/src/java/org/apache/sqoop/util/password/CryptoFileLoader.java @@ -156,9 +156,13 @@ public String loadPassword(String p, Configuration configuration) throws IOExcep @Override public void cleanUpConfiguration(Configuration configuration) { - configuration.unset(PROPERTY_CRYPTO_PASSPHRASE); - configuration.unset(PROPERTY_CRYPTO_SALT); - configuration.unset(PROPERTY_CRYPTO_KEY_LEN); - configuration.unset(PROPERTY_CRYPTO_ITERATIONS); + // Usage of Configuration#unset would be much better here, sadly + // this particular API is not available in Hadoop 0.20 and < 1.2.0 + // that we are still supporting. Hence we are overriding the configs + // with default values. + configuration.set(PROPERTY_CRYPTO_PASSPHRASE, "REMOVED"); + configuration.set(PROPERTY_CRYPTO_SALT, DEFAULT_SALT); + configuration.setInt(PROPERTY_CRYPTO_KEY_LEN, DEFAULT_KEY_LEN); + configuration.setInt(PROPERTY_CRYPTO_ITERATIONS, DEFAULT_ITERATIONS); } }