This repository has been archived by the owner on Jul 9, 2021. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
SQOOP-3435: Avoid NullPointerException due to different JSONObject li…
…brary in classpath
- Loading branch information
e90e244
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
实际编译过程中遇到问题:
错误: 不兼容的类型: Map<? extends Object,? extends Object>无法转换为Map<String,String>
改成下面这样可以编译通过:
private static final Map EMPTY_MAP = new HashMap<String, String>();
public static String getJsonStringforMap(Map<String, String> map) {
Map<String, String> mapToUse = (map == null) ? EMPTY_MAP : map;
JSONObject pathPartMap = new JSONObject(mapToUse);
return pathPartMap.toString();
}