fury icon indicating copy to clipboard operation
fury copied to clipboard

NullPointerException occurred

Open GimoXie opened this issue 1 year ago • 3 comments

Search before asking

  • [x] I had searched in the issues and found no similar issues.

Version

Fury Version: 0.7.1 JDK Version: 21

Component(s)

Java

Minimal reproduce step

public class FuryTest {

@Test
public void testFurySerialize2() throws IOException {
    Fury fury = Fury.builder()
            .withLanguage(Language.JAVA)
            .withRefTracking(true)
            .withCompatibleMode(CompatibleMode.COMPATIBLE)
            .withDeserializeNonexistentClass(true)
            .requireClassRegistration(false)
            .withAsyncCompilation(true)
            .build();

    List<Data> dataList = new ArrayList<>();
    dataList.add(null);
    DataHolder holder = new DataHolder();
    holder.setDataList(dataList);

    FuryTestResponse response = new FuryTestResponse();
    response.setHolderList(Lists.newArrayList(holder));
    fury.serialize(new CountingOutputStream(newOutputStream(Paths.get("test"))), response);
}

@Getter
@Setter
class Data {
    private String message;
}

@Getter
@Setter
class DataHolder {
    private List<Data> dataList;

}

@Getter
@Setter
class FuryTestResponse {
    private List<DataHolder> holderList;
}

}

What did you expect to see?

I hope the program runs normally.

What did you see instead?

java.lang.NullPointerException at org.apache.fury.resolver.ClassResolver.createSerializer(ClassResolver.java:1177) at org.apache.fury.resolver.ClassResolver.getClassInfo(ClassResolver.java:1108) at org.apache.fury.serializer.collection.AbstractCollectionSerializer.writeTypeHeader(AbstractCollectionSerializer.java:203) at org.apache.fury.serializer.collection.AbstractCollectionSerializer.writeElementsHeader(AbstractCollectionSerializer.java:135) at org.apache.fury.serializer.collection.AbstractCollectionSerializer.writeElements(AbstractCollectionSerializer.java:310) at org.apache.fury.serializer.collection.AbstractCollectionSerializer.write(AbstractCollectionSerializer.java:305) at org.apache.fury.Fury.writeNonRef(Fury.java:475) at org.apache.fury.serializer.ObjectSerializer.writeContainerFieldValue(ObjectSerializer.java:213) at org.apache.fury.serializer.ObjectSerializer.writeContainerFields(ObjectSerializer.java:195) at org.apache.fury.serializer.ObjectSerializer.write(ObjectSerializer.java:146) at org.apache.fury.serializer.collection.AbstractCollectionSerializer.writeSameTypeElements(AbstractCollectionSerializer.java:404) at org.apache.fury.serializer.collection.AbstractCollectionSerializer.generalJavaWrite(AbstractCollectionSerializer.java:391) at org.apache.fury.serializer.collection.AbstractCollectionSerializer.javaWriteWithGenerics(AbstractCollectionSerializer.java:369) at org.apache.fury.serializer.collection.AbstractCollectionSerializer.writeElements(AbstractCollectionSerializer.java:318) at org.apache.fury.serializer.collection.AbstractCollectionSerializer.write(AbstractCollectionSerializer.java:305) at org.apache.fury.Fury.writeNonRef(Fury.java:475) at org.apache.fury.serializer.ObjectSerializer.writeContainerFieldValue(ObjectSerializer.java:213) at org.apache.fury.serializer.ObjectSerializer.writeContainerFields(ObjectSerializer.java:195) at org.apache.fury.serializer.ObjectSerializer.write(ObjectSerializer.java:146) at org.apache.fury.Fury.writeData(Fury.java:584) at org.apache.fury.Fury.write(Fury.java:347) at org.apache.fury.Fury.serialize(Fury.java:269) at org.apache.fury.Fury.lambda$serialize$0(Fury.java:285) at org.apache.fury.Fury.serializeToStream(Fury.java:1427) at org.apache.fury.Fury.serialize(Fury.java:285) at com.ctrip.fury.FuryTest.testFurySerialize2(FuryTest.java:50) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50) at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12) at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47) at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17) at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325) at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78) at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57) at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290) at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71) at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288) at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58) at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268) at org.junit.runners.ParentRunner.run(ParentRunner.java:363) at org.junit.runner.JUnitCore.run(JUnitCore.java:137) at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:69) at com.intellij.rt.junit.IdeaTestRunner$Repeater$1.execute(IdeaTestRunner.java:38) at com.intellij.rt.execution.junit.TestsRepeater.repeat(TestsRepeater.java:11) at com.intellij.rt.junit.IdeaTestRunner$Repeater.startRunnerWithArgs(IdeaTestRunner.java:35) at com.intellij.rt.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:232) at com.intellij.rt.junit.JUnitStarter.main(JUnitStarter.java:55)

Anything Else?

No response

Are you willing to submit a PR?

  • [ ] I'm willing to submit a PR!

GimoXie avatar Mar 19 '25 06:03 GimoXie

@GimoXie Could you try 0.9.0 out?

chaokunyang avatar Mar 19 '25 07:03 chaokunyang

@GimoXie Could you try 0.9.0 out?

@chaokunyang Image It looks like the same problem is present in version 0.9.0 too.

GimoXie avatar Mar 19 '25 07:03 GimoXie

Thanks for reporting this issue, I fixed it in #2111. We plan to cut a release in this weekend

chaokunyang avatar Mar 19 '25 17:03 chaokunyang