This is an automated email from the ASF dual-hosted git repository.
chaokunyang 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 062bd769 chore(doc): fix doc example code (#1666)
062bd769 is described below
commit 062bd769bed656937115318783767491d9170ca5
Author: wangjie <[email protected]>
AuthorDate: Fri May 31 18:12:09 2024 +0800
chore(doc): fix doc example code (#1666)
## What does this PR do?
according to comments, should set `requireClassRegistration` to false
## Related issues
## Does this PR introduce any user-facing change?
- [ ] 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.
-->
---
README.md | 4 ----
docs/guide/java_serialization_guide.md | 13 ++++++-------
2 files changed, 6 insertions(+), 11 deletions(-)
diff --git a/README.md b/README.md
index b619eeb4..ae35f375 100644
--- a/README.md
+++ b/README.md
@@ -159,8 +159,6 @@ public class Example {
// multiple serializations of different objects.
{
Fury fury = Fury.builder().withLanguage(Language.JAVA)
- // Allow to deserialize objects unknown types, more flexible
- // but may be insecure if the classes contains malicious code.
.requireClassRegistration(true)
.build();
// Registering types can reduce class name serialization overhead, but
not mandatory.
@@ -171,8 +169,6 @@ public class Example {
}
{
ThreadSafeFury fury = Fury.builder().withLanguage(Language.JAVA)
- // Allow to deserialize objects unknown types, more flexible
- // but may be insecure if the classes contains malicious code.
.requireClassRegistration(true)
.buildThreadSafeFury();
// Registering types can reduce class name serialization overhead, but
not mandatory.
diff --git a/docs/guide/java_serialization_guide.md
b/docs/guide/java_serialization_guide.md
index ec9fdf38..4869d836 100644
--- a/docs/guide/java_serialization_guide.md
+++ b/docs/guide/java_serialization_guide.md
@@ -30,8 +30,6 @@ public class Example {
// Note that Fury instances should be reused between
// multiple serializations of different objects.
Fury fury = Fury.builder().withLanguage(Language.JAVA)
- // Allow to deserialize objects unknown types, more flexible
- // but may be insecure if the classes contains malicious code.
.requireClassRegistration(true)
.build();
// Registering types can reduce class name serialization overhead, but not
mandatory.
@@ -80,11 +78,12 @@ import org.apache.fury.config.*;
public class Example {
// reuse fury.
- private static final ThreadSafeFury fury = Fury.builder()
- // Allow to deserialize objects unknown types, more flexible
- // but may be insecure if the classes contains malicious code.
- .requireClassRegistration(true)
- .buildThreadSafeFury();
+ private static final ThreadSafeFury fury = new ThreadLocalFury(classLoader
-> {
+ Fury f = Fury.builder().withLanguage(Language.JAVA)
+ .withClassLoader(classLoader).build();
+ f.register(SomeClass.class);
+ return f;
+ });
public static void main(String[] args) {
SomeClass object = new SomeClass();
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]