diff --git a/src/main/java/com/caucho/hessian/io/SerializerFactory.java b/src/main/java/com/caucho/hessian/io/SerializerFactory.java index 3579822..32bfa59 100644 --- a/src/main/java/com/caucho/hessian/io/SerializerFactory.java +++ b/src/main/java/com/caucho/hessian/io/SerializerFactory.java @@ -760,12 +760,20 @@ protected static void addAbstractStringBuilderSupport() { } } - private static boolean isZoneId(Class cl) { + private static Class ZONE_ID_CLASS_CACHE = null; + + static { try { - return isHigherThanJdk8 && Class.forName("java.time.ZoneId").isAssignableFrom(cl); + ZONE_ID_CLASS_CACHE = Class.forName("java.time.ZoneId"); } catch (ClassNotFoundException e) { // ignore } + } + + private static boolean isZoneId(Class cl) { + if (ZONE_ID_CLASS_CACHE != null) { + return isHigherThanJdk8 && ZONE_ID_CLASS_CACHE.isAssignableFrom(cl); + } return false; } }