Skip to content

Commit 33f1726

Browse files
Bricks-Manralf0131
authored andcommitted
Fix for loop reference test pass on protostuff (#3252)
1 parent e07038b commit 33f1726

File tree

3 files changed

+10
-19
lines changed

3 files changed

+10
-19
lines changed

dubbo-serialization/dubbo-serialization-protostuff/src/main/java/org/apache/dubbo/common/serialize/protostuff/ProtostuffObjectInput.java

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -17,17 +17,15 @@
1717

1818
package org.apache.dubbo.common.serialize.protostuff;
1919

20-
import org.apache.dubbo.common.serialize.ObjectInput;
21-
import org.apache.dubbo.common.serialize.protostuff.utils.WrapperUtils;
22-
23-
import io.protostuff.ProtobufIOUtil;
20+
import io.protostuff.GraphIOUtil;
2421
import io.protostuff.Schema;
2522
import io.protostuff.runtime.RuntimeSchema;
26-
2723
import java.io.DataInputStream;
2824
import java.io.IOException;
2925
import java.io.InputStream;
3026
import java.lang.reflect.Type;
27+
import org.apache.dubbo.common.serialize.ObjectInput;
28+
import org.apache.dubbo.common.serialize.protostuff.utils.WrapperUtils;
3129

3230
/**
3331
* Protostuff object input implementation
@@ -63,12 +61,12 @@ public Object readObject() throws IOException, ClassNotFoundException {
6361
if (WrapperUtils.needWrapper(clazz)) {
6462
Schema<Wrapper> schema = RuntimeSchema.getSchema(Wrapper.class);
6563
Wrapper wrapper = schema.newMessage();
66-
ProtobufIOUtil.mergeFrom(bytes, wrapper, schema);
64+
GraphIOUtil.mergeFrom(bytes, wrapper, schema);
6765
result = wrapper.getData();
6866
} else {
6967
Schema schema = RuntimeSchema.getSchema(clazz);
7068
result = schema.newMessage();
71-
ProtobufIOUtil.mergeFrom(bytes, result, schema);
69+
GraphIOUtil.mergeFrom(bytes, result, schema);
7270
}
7371

7472
return result;

dubbo-serialization/dubbo-serialization-protostuff/src/main/java/org/apache/dubbo/common/serialize/protostuff/ProtostuffObjectOutput.java

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -17,17 +17,15 @@
1717

1818
package org.apache.dubbo.common.serialize.protostuff;
1919

20-
import org.apache.dubbo.common.serialize.ObjectOutput;
21-
import org.apache.dubbo.common.serialize.protostuff.utils.WrapperUtils;
22-
20+
import io.protostuff.GraphIOUtil;
2321
import io.protostuff.LinkedBuffer;
24-
import io.protostuff.ProtobufIOUtil;
2522
import io.protostuff.Schema;
2623
import io.protostuff.runtime.RuntimeSchema;
27-
2824
import java.io.DataOutputStream;
2925
import java.io.IOException;
3026
import java.io.OutputStream;
27+
import org.apache.dubbo.common.serialize.ObjectOutput;
28+
import org.apache.dubbo.common.serialize.protostuff.utils.WrapperUtils;
3129

3230
/**
3331
* Protostuff object output implementation
@@ -52,11 +50,11 @@ public void writeObject(Object obj) throws IOException {
5250
if (WrapperUtils.needWrapper(obj)) {
5351
Schema<Wrapper> schema = RuntimeSchema.getSchema(Wrapper.class);
5452
Wrapper wrapper = new Wrapper(obj);
55-
bytes = ProtobufIOUtil.toByteArray(wrapper, schema, buffer);
53+
bytes = GraphIOUtil.toByteArray(wrapper, schema, buffer);
5654
classNameBytes = Wrapper.class.getName().getBytes();
5755
} else {
5856
Schema schema = RuntimeSchema.getSchema(obj.getClass());
59-
bytes = ProtobufIOUtil.toByteArray(obj, schema, buffer);
57+
bytes = GraphIOUtil.toByteArray(obj, schema, buffer);
6058
classNameBytes = obj.getClass().getName().getBytes();
6159
}
6260
} finally {

dubbo-serialization/dubbo-serialization-test/src/test/java/org/apache/dubbo/common/serialize/protostuff/ProtostuffSerializationTest.java

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,4 @@ public class ProtostuffSerializationTest extends AbstractSerializationTest {
2525
serialization = new ProtostuffSerialization();
2626
}
2727

28-
@Override
29-
@Test
30-
public void test_LoopReference() throws Exception {
31-
// FIXME: cannot make this test pass on protostuff
32-
}
3328
}

0 commit comments

Comments
 (0)