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

[Dubbo-master] Fix fail when loop reference test on protostuff #3252

Merged
merged 1 commit into from
Jan 24, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -17,17 +17,15 @@

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

import org.apache.dubbo.common.serialize.ObjectInput;
import org.apache.dubbo.common.serialize.protostuff.utils.WrapperUtils;

import io.protostuff.ProtobufIOUtil;
import io.protostuff.GraphIOUtil;
import io.protostuff.Schema;
import io.protostuff.runtime.RuntimeSchema;

import java.io.DataInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.lang.reflect.Type;
import org.apache.dubbo.common.serialize.ObjectInput;
import org.apache.dubbo.common.serialize.protostuff.utils.WrapperUtils;

/**
* Protostuff object input implementation
Expand Down Expand Up @@ -63,12 +61,12 @@ public Object readObject() throws IOException, ClassNotFoundException {
if (WrapperUtils.needWrapper(clazz)) {
Schema<Wrapper> schema = RuntimeSchema.getSchema(Wrapper.class);
Wrapper wrapper = schema.newMessage();
ProtobufIOUtil.mergeFrom(bytes, wrapper, schema);
GraphIOUtil.mergeFrom(bytes, wrapper, schema);
result = wrapper.getData();
} else {
Schema schema = RuntimeSchema.getSchema(clazz);
result = schema.newMessage();
ProtobufIOUtil.mergeFrom(bytes, result, schema);
GraphIOUtil.mergeFrom(bytes, result, schema);
}

return result;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,17 +17,15 @@

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

import org.apache.dubbo.common.serialize.ObjectOutput;
import org.apache.dubbo.common.serialize.protostuff.utils.WrapperUtils;

import io.protostuff.GraphIOUtil;
import io.protostuff.LinkedBuffer;
import io.protostuff.ProtobufIOUtil;
import io.protostuff.Schema;
import io.protostuff.runtime.RuntimeSchema;

import java.io.DataOutputStream;
import java.io.IOException;
import java.io.OutputStream;
import org.apache.dubbo.common.serialize.ObjectOutput;
import org.apache.dubbo.common.serialize.protostuff.utils.WrapperUtils;

/**
* Protostuff object output implementation
Expand All @@ -52,11 +50,11 @@ public void writeObject(Object obj) throws IOException {
if (WrapperUtils.needWrapper(obj)) {
Schema<Wrapper> schema = RuntimeSchema.getSchema(Wrapper.class);
Wrapper wrapper = new Wrapper(obj);
bytes = ProtobufIOUtil.toByteArray(wrapper, schema, buffer);
bytes = GraphIOUtil.toByteArray(wrapper, schema, buffer);
classNameBytes = Wrapper.class.getName().getBytes();
} else {
Schema schema = RuntimeSchema.getSchema(obj.getClass());
bytes = ProtobufIOUtil.toByteArray(obj, schema, buffer);
bytes = GraphIOUtil.toByteArray(obj, schema, buffer);
classNameBytes = obj.getClass().getName().getBytes();
}
} finally {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,4 @@ public class ProtostuffSerializationTest extends AbstractSerializationTest {
serialization = new ProtostuffSerialization();
}

@Override
@Test
public void test_LoopReference() throws Exception {
// FIXME: cannot make this test pass on protostuff
}
}