Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[<Fury component: Java>] Example in readme has runtime exception #653

Closed
yeoleobun opened this issue Jul 15, 2023 · 2 comments · Fixed by #654
Closed

[<Fury component: Java>] Example in readme has runtime exception #653

yeoleobun opened this issue Jul 15, 2023 · 2 comments · Fixed by #654
Labels
bug Something isn't working

Comments

@yeoleobun
Copy link

Describe the bug

Code example of Cross-language object graph serialization in Java has Runtime exception.

https://github.com/alipay/fury/blob/main/README.md?plain=1#L176

Expected behavior

Complete without exception.

To Reproduce

mvn exec:java -Dexec.mainClass="io.fury.examples.ReferenceExample"

Screenshots

[ERROR] Failed to execute goal org.codehaus.mojo:exec-maven-plugin:3.1.0:java (default-cli) on project fury: An exception occurred while executing the Java class. class com.google.common.collect.RegularImmutableMap is not registered, if it's not the type you want to serialize, it may be a vulnerability. If it's not a vulnerability, registering class by Fury#register will have better performance, otherwise class name will be serialized too. -> [Help 1]

Environment (please complete the following information):

openjdk 17.0.7

Fix

fury.register(Class.forName("com.google.common.collect.RegularImmutableMap"),"com.google.common.collect.RegularImmutableMap");

@yeoleobun yeoleobun added the bug Something isn't working label Jul 15, 2023
@chaokunyang
Copy link
Collaborator

@yeoleobun Thanks for filing this issue, the example enabled secure mode, but we didn't register guava types in advance, since common guava types are not public. I submit a PR to register those type in advance in #654, the example works fine with that pr.

@chaokunyang
Copy link
Collaborator

Feel free to reopen this issue if it still throws exception

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants