From 5560402354d7bc573cfba513271da426abf1d69e Mon Sep 17 00:00:00 2001 From: Lei Zhiyuan Date: Fri, 17 Apr 2020 15:29:03 +0800 Subject: [PATCH] feat:clear black list cache (#55) --- .../com/alipay/hessian/NameBlackListFilter.java | 3 +++ .../com/caucho/hessian/io/SerializerFactory.java | 16 ++++++++-------- 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/src/main/java/com/alipay/hessian/NameBlackListFilter.java b/src/main/java/com/alipay/hessian/NameBlackListFilter.java index c84c72f..a914c2d 100644 --- a/src/main/java/com/alipay/hessian/NameBlackListFilter.java +++ b/src/main/java/com/alipay/hessian/NameBlackListFilter.java @@ -169,5 +169,8 @@ protected boolean inBlackList(String className) { public static void setAddBlackPrefixList(List addBlackPrefixList) { NameBlackListFilter.addBlackPrefixList = addBlackPrefixList; + if (resultOfInBlackList != null) { + resultOfInBlackList.clear(); + } } } diff --git a/src/main/java/com/caucho/hessian/io/SerializerFactory.java b/src/main/java/com/caucho/hessian/io/SerializerFactory.java index 18a5522..6b5efef 100644 --- a/src/main/java/com/caucho/hessian/io/SerializerFactory.java +++ b/src/main/java/com/caucho/hessian/io/SerializerFactory.java @@ -456,6 +456,14 @@ public Deserializer getDeserializer(String type) if (type == null || type.equals("")) return null; + if (classNameResolver != null) { + try { + type = classNameResolver.resolve(type); + } catch (Exception e) { + throw new HessianProtocolException(e); + } + } + Deserializer deserializer; deserializer = (Deserializer) _cachedTypeDeserializerMap.get(type); @@ -467,14 +475,6 @@ public Deserializer getDeserializer(String type) if (deserializer != null) return deserializer; - if (classNameResolver != null) { - try { - type = classNameResolver.resolve(type); - } catch (Exception e) { - throw new HessianProtocolException(e); - } - } - if (type.startsWith("[")) { Deserializer subDeserializer = getDeserializer(type.substring(1)); deserializer = new ArrayDeserializer(subDeserializer);