google-code-export / protostuff

Automatically exported from code.google.com/p/protostuff
Apache License 2.0
1 stars 1 forks source link

UUIDs cannot be used with RuntimeSchemas #53

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Build a RuntimeSchema.getSchema(UUID.class)
2. Serialize a UUID instance using ProtostuffIOUtil.toByteArray(uuid, 
Schema<UUID>, serialBuf)
3. Deserialize the byte[] and look at the InstanciationException

What is the expected output? What do you see instead?
A RuntimeSchema.getSchema(x) where x == UUID.class or a serializable empty 
constructor object containing a UUID can be built but not used.

What version of the product are you using? On what operating system?
protostuff-1.0.0.M6

Please provide any additional information below.
java.util.UUID is Serializable but does not provide an empty constructor. 
Additional support is needed in the Runtime jar.

Original issue reported on code.google.com by noize.r...@gmail.com on 7 Feb 2011 at 3:55

GoogleCodeExporter commented 9 years ago
An empty constructor is no longer required in protostuff (trunk).  See Issue 52.
However, since the internal fields of UUID are all transient, it still would 
not work.
I'll add this in.

Original comment by david.yu...@gmail.com on 7 Feb 2011 at 4:15

GoogleCodeExporter commented 9 years ago
Was wrong, fields aren't all transient.
The mostSigBits and leastSigBits are whats needed to construct the UUID.
Therefore, it will work.
I just committed a UUID test-case using UUID.compareTo for equality.
You'll have to test with trunk atm.
Lemme know if you still got issues.

Original comment by david.yu...@gmail.com on 7 Feb 2011 at 4:37

GoogleCodeExporter commented 9 years ago

Original comment by david.yu...@gmail.com on 8 Feb 2011 at 3:03