question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

stackoverflow when serializing an object with list

See original GitHub issue

I met stackoverflow when pass an object with arraylist, code is as blew:

  List<SerializablePerson> list = new ArrayList<SerializablePerson>();

        list.add(new SerializablePerson());
        list.add(new SerializablePerson());
        list.add(new SerializablePerson());

       PersonList obj = new PersonList(list);

       Schema schema = RuntimeSchema.getSchema(obj.getClass());
// both two toByteArray method will cause stackoverflow.
       bytes = GraphIOUtil.toByteArray(obj, schema, buffer);
       bytes = ProtobufIOUtil.toByteArray(obj, schema, buffer);
       classNameBytes = obj.getClass().getName().getBytes();

Was it wrong about the usage?

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
dyucommented, Aug 19, 2019

Since that is an inner class, mark it static: private static class LocalTimeList That test will now pass.

0reactions
Moriadry-zzcommented, Aug 19, 2019

Thanks!

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to serialize List<List<object>>? - Stack Overflow
1 Answer 1 ... Use the Type property to specify an overridden type for a public field or public read/write property value. If...
Read more >
Stackoverflow Exception when serializing certain objects that ...
I encountered a stackoverflow exception while serializing an object who's purpose is to convey a tree structure.
Read more >
1.16.5 - Serializing objects - StackOverFlow Error | SpigotMC
I'm trying to serialize the following object: public class ObjectExample implements Serializable { private final CInventory cInventory; ...
Read more >
Java Serialization and Deserialization Examples - Mkyong.com
In Java, Serialization means converting Java objects into a byte stream; Deserialization means converting the serialized object's byte ...
Read more >
Spring Boot and Jackson: How to Get Around That Infinite ...
... Jackson: How to Get Around That Infinite Recursion or StackOverflow Problem. Spring Boot. Having a problem using Jackson to serialize your Java...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found