[HUDI-2219] Fix NPE of HoodieConfig (#3342)
This commit is contained in:
@@ -45,19 +45,21 @@ public class ReflectionUtils {
|
|||||||
|
|
||||||
private static final Logger LOG = LogManager.getLogger(ReflectionUtils.class);
|
private static final Logger LOG = LogManager.getLogger(ReflectionUtils.class);
|
||||||
|
|
||||||
private static Map<String, Class<?>> clazzCache = new HashMap<>();
|
private static final Map<String, Class<?>> CLAZZ_CACHE = new HashMap<>();
|
||||||
|
|
||||||
public static Class<?> getClass(String clazzName) {
|
public static Class<?> getClass(String clazzName) {
|
||||||
if (!clazzCache.containsKey(clazzName)) {
|
synchronized (CLAZZ_CACHE) {
|
||||||
try {
|
if (!CLAZZ_CACHE.containsKey(clazzName)) {
|
||||||
Class<?> clazz = Class.forName(clazzName, true,
|
try {
|
||||||
Thread.currentThread().getContextClassLoader());
|
Class<?> clazz = Class.forName(clazzName, true,
|
||||||
clazzCache.put(clazzName, clazz);
|
Thread.currentThread().getContextClassLoader());
|
||||||
} catch (ClassNotFoundException e) {
|
CLAZZ_CACHE.put(clazzName, clazz);
|
||||||
throw new HoodieException("Unable to load class", e);
|
} catch (ClassNotFoundException e) {
|
||||||
|
throw new HoodieException("Unable to load class", e);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return clazzCache.get(clazzName);
|
return CLAZZ_CACHE.get(clazzName);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static <T> T loadClass(String fqcn) {
|
public static <T> T loadClass(String fqcn) {
|
||||||
|
|||||||
Reference in New Issue
Block a user