Never ending deserialize
See original GitHub issuePlease ensure you have given all the following requested information in your report.
Issue details
Never ending deserialize
Client send object to server correctly
In server:
try { String str=new String(message.array(), "UTF-8"); System.out.println(str); System.out.println("New object kk"); o = new Json().fromJson(null, str); System.out.println("New object kk2"); } catch (UnsupportedEncodingException e) { e.printStackTrace(); }
Console:
New object 2
java.nio.HeapByteBuffer[pos=0 lim=36 cap=36]
{class:"dDev.tech.SpaceLoader",x:15}
New object kk
As you can see never prints new object kk2
Class of Space Loader
`public class SpaceLoader {
public int x=0;
/* public SpaceLoader(){
x=6;
}*/
public SpaceLoader(int x){
this.x=x;
}
public int getX() {
return x;
}
public void setX(int x) {
this.x = x;
}
}`
EDIT: If i put the commented constructor it works. It's weird
#### Reproduction steps/code
#### Version of LibGDX and/or relevant dependencies
Last verison
#### Stacktrace
```java
//Please provide the stacktrace if applicable
Please select the affected platforms
- [ x] Android
- iOS
- [x ] HTML/GWT
- [x ] Windows
- [ x] Linux
- [x ] MacOS
Issue Analytics
- State:
- Created 2 years ago
- Comments:21 (8 by maintainers)
Top Results From Across the Web
json - Await deserializing Task never ends c# - Stack Overflow
Problem is that the file can end up being very large, so deserializing asynchronously is a must. What I serialize and deserialize is...
Read more >Serialization & Deserialization in c#.net - Learning Never Ends
In C#, Serialization is the process of converting an object into a stream of bytes to store the object it to memory, a...
Read more >Serialization and deserialization in Java | Snyk Blog
Java serialization is a mechanism to transform an object into a byte stream. Java deserialization, on the other hand, allows us to recreate ......
Read more >Deserialization - OWASP Cheat Sheet Series
Deserialization is the reverse of that process, taking data structured from some format, and rebuilding it into an object. Today, the most popular...
Read more >Infinite loop when direct deserializing a List · Issue #61 - GitHub
When I try to deserialize the List of Message inside the Deserialize method of Packet the serializer never ends.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
That is completely expected, you are using different constructors that populate the fields with different values, so the serialized representation of those instances would be different.
I suggest you use the discord if you need assistance, this is an issue tracker.
https://github.com/libgdx/libgdx/wiki/Getting-help
UPDATE: the previous problem was magically solver. However I came up with another bug/problem: This is my serializable class
If I use: String s=new JsonSerializer().serializeAsString(new SpaceLoader()); It prints: {class:“dDev.tech.serialized.SpaceLoader”}
However if I use the int constructor and not the default String s=new JsonSerializer().serializeAsString(new SpaceLoader(5)); It prints: {class:“dDev.tech.serialized.SpaceLoader”,x:5}
This is strange, right?