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

suiliangliang pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/incubator-fury.git


The following commit(s) were added to refs/heads/main by this push:
     new bf7f3646 fix(java): skip register unexisted skip class (#1601)
bf7f3646 is described below

commit bf7f3646620c78a43f121cc15984c226a9f18cd6
Author: Shawn Yang <[email protected]>
AuthorDate: Sun May 5 15:37:04 2024 +0800

    fix(java): skip register unexisted skip class (#1601)
    
    ## What does this PR do?
    
    skip register unexisted skip class if `deserializeUnexistedClass` not
    enabled
    
    ## Related issues
    #1600
    
    ## Does this PR introduce any user-facing change?
    
    <!--
    If any user-facing interface changes, please [open an
    issue](https://github.com/apache/incubator-fury/issues/new/choose)
    describing the need to do so and update the document if necessary.
    -->
    
    - [ ] Does this PR introduce any public API change?
    - [ ] Does this PR introduce any binary protocol compatibility change?
    
    
    ## Benchmark
    
    <!--
    When the PR has an impact on performance (if you don't know whether the
    PR will have an impact on performance, you can submit the PR first, and
    if it will have impact on performance, the code reviewer will explain
    it), be sure to attach a benchmark data here.
    -->
---
 .../org/apache/fury/resolver/ClassResolver.java    | 24 ++++++++++++----------
 1 file changed, 13 insertions(+), 11 deletions(-)

diff --git 
a/java/fury-core/src/main/java/org/apache/fury/resolver/ClassResolver.java 
b/java/fury-core/src/main/java/org/apache/fury/resolver/ClassResolver.java
index 7e45b1a0..a5e542d4 100644
--- a/java/fury-core/src/main/java/org/apache/fury/resolver/ClassResolver.java
+++ b/java/fury-core/src/main/java/org/apache/fury/resolver/ClassResolver.java
@@ -336,17 +336,19 @@ public class ClassResolver {
     if (fury.getConfig().registerGuavaTypes()) {
       GuavaCollectionSerializers.registerDefaultSerializers(fury);
     }
-    if (metaContextShareEnabled) {
-      addDefaultSerializer(
-          UnexistedMetaSharedClass.class, new UnexistedClassSerializer(fury, 
null));
-      // Those class id must be known in advance, here is two bytes, so
-      // `UnexistedClassSerializer.writeClassDef`
-      // can overwrite written classinfo and replace with real classinfo.
-      short classId =
-          
Objects.requireNonNull(classInfoMap.get(UnexistedMetaSharedClass.class)).classId;
-      Preconditions.checkArgument(classId > 63 && classId < 8192, classId);
-    } else {
-      register(UnexistedSkipClass.class);
+    if (fury.getConfig().deserializeUnexistedClass()) {
+      if (metaContextShareEnabled) {
+        addDefaultSerializer(
+            UnexistedMetaSharedClass.class, new UnexistedClassSerializer(fury, 
null));
+        // Those class id must be known in advance, here is two bytes, so
+        // `UnexistedClassSerializer.writeClassDef`
+        // can overwrite written classinfo and replace with real classinfo.
+        short classId =
+            
Objects.requireNonNull(classInfoMap.get(UnexistedMetaSharedClass.class)).classId;
+        Preconditions.checkArgument(classId > 63 && classId < 8192, classId);
+      } else {
+        register(UnexistedSkipClass.class);
+      }
     }
   }
 


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to