mirror of
https://github.com/apache/sqoop.git
synced 2025-05-03 04:11:44 +08:00
SQOOP-3435 Avoid NullPointerException due to different JSONObject library in classpath
Sqoop is expecting the classpath to have org.json [1] as the dependency but if one uses HADOOP_CLASSPATH to initialize sqoop executor with com.tdunning open json [2] as the resolution of org.json.JSONObject. it failed with NullPointerException 1. https://mvnrepository.com/artifact/org.json/json/20090211 2. https://github.com/tdunning/open-json/blob/rc1.8/src/main/java/org/json/JSONObject.java#L141-L155
This commit is contained in:
parent
0216f7fbb7
commit
e8971b9f51
@ -40,7 +40,8 @@ private SqoopJsonUtil() {
|
||||
}
|
||||
|
||||
public static String getJsonStringforMap(Map<String, String> map) {
|
||||
JSONObject pathPartMap = new JSONObject(map);
|
||||
Map<String, String> mapToUse = (map == null) ? Collections.emptyMap() : map;
|
||||
JSONObject pathPartMap = new JSONObject(mapToUse);
|
||||
return pathPartMap.toString();
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user