[3.0] Upgrade hessian lite version (#8386)

* Upgrade hessian lite version

* fix RuntimeException

* fix RuntimeException

* support list
This commit is contained in:
Albumen Kevin 2021-08-04 18:46:25 +08:00 committed by GitHub
parent 63baa5c043
commit d1f100e14e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 11 additions and 4 deletions

View File

@ -157,7 +157,7 @@
<activation_version>1.2.0</activation_version>
<test_container_version>1.15.3</test_container_version>
<etcd_launcher_version>0.5.3</etcd_launcher_version>
<hessian_lite_version>3.2.8</hessian_lite_version>
<hessian_lite_version>3.2.10</hessian_lite_version>
<swagger_version>1.5.24</swagger_version>
<roaringbitmap_version>0.9.0</roaringbitmap_version>

View File

@ -23,6 +23,8 @@ import com.alibaba.com.caucho.hessian.io.SerializerFactory;
public class DefaultHessian2FactoryInitializer extends AbstractHessian2FactoryInitializer {
@Override
protected SerializerFactory createSerializerFactory() {
return new Hessian2SerializerFactory();
Hessian2SerializerFactory hessian2SerializerFactory = new Hessian2SerializerFactory();
hessian2SerializerFactory.getClassFactory().allow(RuntimeException.class.getName());
return hessian2SerializerFactory;
}
}

View File

@ -35,15 +35,20 @@ public class WhitelistHessian2FactoryInitializer extends AbstractHessian2Factory
serializerFactory.getClassFactory().setWhitelist(true);
String allowPattern = ConfigurationUtils.getProperty(ALLOW);
if (StringUtils.isNotEmpty(allowPattern)) {
serializerFactory.getClassFactory().allow(allowPattern);
for (String pattern : allowPattern.split(";")) {
serializerFactory.getClassFactory().allow(pattern);
}
}
} else {
serializerFactory.getClassFactory().setWhitelist(false);
String denyPattern = ConfigurationUtils.getProperty(DENY);
if (StringUtils.isNotEmpty(denyPattern)) {
serializerFactory.getClassFactory().deny(denyPattern);
for (String pattern : denyPattern.split(";")) {
serializerFactory.getClassFactory().deny(pattern);
}
}
}
serializerFactory.getClassFactory().allow(RuntimeException.class.getName());
return serializerFactory;
}