Avi-Levi / kryo

Automatically exported from code.google.com/p/kryo
BSD 3-Clause "New" or "Revised" License
0 stars 0 forks source link

deserialization failed #56

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
public class CircleTest extends KryoTestCase {
    public void test () {
        Kryo k = new Kryo();
        Output o = new Output(2048);
        k.writeClassAndObject(o, new A());
        o.flush();

        byte[] buffer = o.getBuffer();
        Input i = new Input(buffer);
        Object object = k.readClassAndObject(i);
    }

    static class A{
        String name="aaa";
        B b=new B(this);

        static class B{
            A owner;

            public B(){}

            public B(A owner) {
                super();
                this.owner = owner;
            }

        }
    }
}

What is the expected output? What do you see instead?
expected:deserialized successful.
instead:
com.esotericsoftware.kryo.KryoException: Encountered unregistered class ID: 95
Serialization trace:
b (com.esotericsoftware.kryo.CircleTest$A)
b (com.esotericsoftware.kryo.CircleTest$A)
owner (com.esotericsoftware.kryo.CircleTest$A$B)
b (com.esotericsoftware.kryo.CircleTest$A)
    at com.esotericsoftware.kryo.Kryo.readClass(Kryo.java:517)
    at com.esotericsoftware.kryo.serializers.FieldSerializer.read(FieldSerializer.java:208)
    at com.esotericsoftware.kryo.Kryo.readObject(Kryo.java:560)
    at com.esotericsoftware.kryo.serializers.FieldSerializer.read(FieldSerializer.java:211)
    at com.esotericsoftware.kryo.Kryo.readObject(Kryo.java:560)
    at com.esotericsoftware.kryo.serializers.FieldSerializer.read(FieldSerializer.java:211)
    at com.esotericsoftware.kryo.Kryo.readObject(Kryo.java:560)
    at com.esotericsoftware.kryo.serializers.FieldSerializer.read(FieldSerializer.java:211)
    at com.esotericsoftware.kryo.Kryo.readClassAndObject(Kryo.java:643)
    at com.esotericsoftware.kryo.CircleTest.test(CircleTest.java:17)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at junit.framework.TestCase.runTest(TestCase.java:168)
    at junit.framework.TestCase.runBare(TestCase.java:134)
    at junit.framework.TestResult$1.protect(TestResult.java:110)
    at junit.framework.TestResult.runProtected(TestResult.java:128)
    at junit.framework.TestResult.run(TestResult.java:113)
    at junit.framework.TestCase.run(TestCase.java:124)
    at junit.framework.TestSuite.runTest(TestSuite.java:232)
    at junit.framework.TestSuite.run(TestSuite.java:227)
    at org.junit.internal.runners.JUnit38ClassRunner.run(JUnit38ClassRunner.java:91)
    at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:50)
    at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)

What version of the Kryo are you using?
kryo2

Please provide any additional information below.

Original issue reported on code.google.com by vylo...@gmail.com on 17 Apr 2012 at 9:08

GoogleCodeExporter commented 9 years ago
please help.:)

Original comment by vylo...@gmail.com on 17 Apr 2012 at 9:22

GoogleCodeExporter commented 9 years ago
Your test succeeds using SVN trunk. I suggest running from SVN, else I will do 
a 2.05 release probably tomorrow.

Original comment by nathan.s...@gmail.com on 17 Apr 2012 at 10:18

GoogleCodeExporter commented 9 years ago
It is true.Thanks.I will update my projects to use kryo2.05 soon.:)

Original comment by vylo...@gmail.com on 18 Apr 2012 at 8:37