5
0
mirror of https://github.com/apache/sqoop.git synced 2025-05-10 02:59:30 +08:00

SQOOP-2786: Sqoop2: If AUTHENTICATION_KERBEROS_KEYTAB is not found in the properties throw a meaningful exception

(Abraham Fine via Jarek Jarcec Cecho)
This commit is contained in:
Jarek Jarcec Cecho 2016-01-21 10:48:28 +01:00
parent 80b1790b9d
commit 22b1a05137

View File

@ -17,6 +17,7 @@
*/
package org.apache.sqoop.common;
import org.apache.log4j.Logger;
import org.apache.sqoop.classification.InterfaceAudience;
import org.apache.sqoop.classification.InterfaceStability;
@ -33,6 +34,8 @@
@InterfaceStability.Unstable
public class MapContext implements ImmutableContext {
private static final Logger LOG = Logger.getLogger(MapContext.class);
private final Map<String, String> options;
public MapContext(Map<String, String> options) {
@ -48,7 +51,11 @@ protected Map<String, String> getOptions() {
*/
@Override
public String getString(String key) {
return options.get(key);
String value = options.get(key);
if (value == null || value.trim().length() == 0) {
LOG.debug("Value not found in configuration for key: " + key);
}
return value;
}
@Override
@ -80,6 +87,7 @@ public boolean getBoolean(String key, boolean defaultValue) {
@Override
public long getLong(String key, long defaultValue) {
if (!options.containsKey(key)) {
LOG.debug("Value not found in configuration for key: " + key);
return defaultValue;
}
@ -94,6 +102,7 @@ public long getLong(String key, long defaultValue) {
@Override
public int getInt(String key, int defaultValue) {
if (!options.containsKey(key)) {
LOG.debug("Value not found in configuration for key: " + key);
return defaultValue;
}
@ -116,6 +125,10 @@ public Map<String, String> getNestedProperties(String prefix) {
}
}
if (subProps.isEmpty()) {
LOG.debug("Value not found in configuration for prefix: " + prefix);
}
return subProps;
}
@ -137,6 +150,11 @@ public Map<String, String> getValByRegex(String regex) {
result.put(item, getString(item));
}
}
if (result.isEmpty()) {
LOG.debug("Value not found in configuration for regex: " + regex);
}
return result;
}