You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@dubbo.apache.org by al...@apache.org on 2022/08/27 02:29:56 UTC

[dubbo-hessian-lite] branch 3.2.13-release updated: update deny rule

This is an automated email from the ASF dual-hosted git repository.

albumenj pushed a commit to branch 3.2.13-release
in repository https://gitbox.apache.org/repos/asf/dubbo-hessian-lite.git


The following commit(s) were added to refs/heads/3.2.13-release by this push:
     new e3d40e88 update deny rule
e3d40e88 is described below

commit e3d40e88d256a5f3c98ce782728a670628452508
Author: Albumen Kevin <jh...@gmail.com>
AuthorDate: Sat Aug 27 10:29:46 2022 +0800

    update deny rule
---
 .../com/caucho/hessian/io/SerializerFactory.java     | 20 ++++++++++----------
 1 file changed, 10 insertions(+), 10 deletions(-)

diff --git a/src/main/java/com/alibaba/com/caucho/hessian/io/SerializerFactory.java b/src/main/java/com/alibaba/com/caucho/hessian/io/SerializerFactory.java
index 4be4d0b3..ac3bd182 100644
--- a/src/main/java/com/alibaba/com/caucho/hessian/io/SerializerFactory.java
+++ b/src/main/java/com/alibaba/com/caucho/hessian/io/SerializerFactory.java
@@ -343,11 +343,6 @@ public class SerializerFactory extends AbstractSerializerFactory {
             serializer = factory.getSerializer(cl);
         }
 
-        if (!Serializable.class.isAssignableFrom(cl)
-                && !_isAllowNonSerializable) {
-            throw new IllegalStateException("Serialized class " + cl.getName() + " must implement java.io.Serializable");
-        }
-
         if (serializer != null) {
 
         } else if (isZoneId(cl)) //must before "else if (JavaSerializer.getWriteReplace(cl) != null)"
@@ -419,6 +414,11 @@ public class SerializerFactory extends AbstractSerializerFactory {
         if (_defaultSerializer != null)
             return _defaultSerializer;
 
+        if (!Serializable.class.isAssignableFrom(cl)
+                && !_isAllowNonSerializable) {
+            throw new IllegalStateException("Serialized class " + cl.getName() + " must implement java.io.Serializable");
+        }
+
         return new JavaSerializer(cl, _loader);
     }
 
@@ -453,11 +453,6 @@ public class SerializerFactory extends AbstractSerializerFactory {
             deserializer = factory.getDeserializer(cl);
         }
 
-        if (!Serializable.class.isAssignableFrom(cl)
-                && !_isAllowNonSerializable) {
-            throw new IllegalStateException("Serialized class " + cl.getName() + " must implement java.io.Serializable");
-        }
-
         if (deserializer != null) {
         } else if (Collection.class.isAssignableFrom(cl))
             deserializer = new CollectionDeserializer(cl);
@@ -500,6 +495,11 @@ public class SerializerFactory extends AbstractSerializerFactory {
      * @return a serializer object for the serialization.
      */
     protected Deserializer getDefaultDeserializer(Class cl) {
+        if (!Serializable.class.isAssignableFrom(cl)
+                && !_isAllowNonSerializable) {
+            throw new IllegalStateException("Serialized class " + cl.getName() + " must implement java.io.Serializable");
+        }
+
         return new JavaDeserializer(cl);
     }