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

protostuff return stackoverflow and other error msg #4861

Closed
2 tasks done
Moriadry-zz opened this issue Aug 17, 2019 · 0 comments · Fixed by #4862
Closed
2 tasks done

protostuff return stackoverflow and other error msg #4861

Moriadry-zz opened this issue Aug 17, 2019 · 0 comments · Fixed by #4862

Comments

@Moriadry-zz
Copy link

Moriadry-zz commented Aug 17, 2019

  • I have searched the issues of this repository and believe that this is not a duplicate.
  • I have checked the FAQ of this repository and believe that this is not a duplicate.

Environment

  • Dubbo version: 2.7.4
  • Operating System version: macos 10.13.6
  • Java version: 1.8

Steps to reproduce this issue

add unit test in ProtostuffObjectOutputTest.class and failed:

    @Test
    public void testListObject() throws IOException, ClassNotFoundException {
        List<SerializablePerson> list = new ArrayList<SerializablePerson>();
        list.add(new SerializablePerson());
        list.add(new SerializablePerson());
        list.add(new SerializablePerson());
        SerializablePersonList personList = new SerializablePersonList(list);
        this.protostuffObjectOutput.writeObject(personList);
        this.flushToInput();

        SerializablePersonList serializedTime = protostuffObjectInput.readObject(SerializablePersonList.class);
        assertThat(serializedTime, is(personList));
    }

 private class SerializablePersonList implements Serializable {
        private static final long serialVersionUID = 1L;

        public List<SerializablePerson> personList;

        public SerializablePersonList() {}

        public SerializablePersonList(List<SerializablePerson> list) {
            this.personList = list;
        }

        @Override
        public boolean equals(Object obj) {
            if (this == obj)
                return true;
            if (obj == null)
                return false;
            if (getClass() != obj.getClass())
                return false;

            SerializablePersonList list = (SerializablePersonList) obj;
            if (list.personList == null && this.personList == null)
                return true;
            if (list.personList == null || this.personList == null)
                return false;
            if (list.personList.size() != this.personList.size())
                return false;
            for (int i =0; i < this.personList.size(); i++) {
                if (!this.personList.get(i).equals(list.personList.get(i)))
                    return false;
            }
            return true;
        }
    }

This is one case, and I have found the reason and raised a pr to fix it, But there is another stackoverflow still exist.

Pls. provide [GitHub address] to reproduce this issue.

Expected Result

What do you expected from the above steps?

test success

Actual Result

What actually happens?

test failed

If there is an exception, please attach the exception trace:

Just put your stack trace here!
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant