HashMap<UUID, any> is not properly decoded
See original GitHub issueDescribe the bug
HashMap<UUID, any>
objects encode perfectly and are stored in Mongo as expected. When decoding, Morphia will use strings as the key instead of UUIDs, despite there being a UUID Converter.
To Reproduce Steps to reproduce the behavior:
- Create a
HashMap<UUID, String>
and put anything in it. - Save the object using
datastore.save(map)
- Load the object with Morphia.
- Try
map.get(uuid)
. Returns null. Try `map.forEach(uid -> System.out.println(uid.toString())) Generates cast error from string to UUID.
Expected behavior I expected the HashMap to properly load with UUID objects as the key.
** Please complete the following information: **
- Server Version: 4.0.0
- Driver Version: 3.12.5
- Morphia Version: 1.6.0
I cannot use version 2.0.0 as currently Java 8 is required. I see this issue was raised and fixed in 2013, but it appears to not be working.
Issue Analytics
- State:
- Created 3 years ago
- Comments:23 (13 by maintainers)
Top Results From Across the Web
Resolve damaged document error when opening PDF files
Workarounds to open PDF files that do not open in Adobe Acrobat after ... it was sent as an email attachment and wasn't...
Read more >File incorrectly decoded - Microsoft Community
Every time I boot-up my pc this message appears "Adobe Acrobat reader could not open "ed0ac.f952c1 this file ed0ac.f952c1 is the one decoded...
Read more >Unable to open pdf [Solved] - CCM
It was sent as an email attachment and wasn't correctly decoded; Pdf email attachment not correctly decoded - Best answers; Pdf wasn't correctly...
Read more >Cannot Open Damaged File - Acrobat Answers
I have repaired Acrobat Reader XI to no avail. ... the file has been damaged (for example, it was sent as an email...
Read more >Error message: "Adobe Reader could not open..." - Library FAQ
... is either not a supported file type or because the file has been damaged (for example) it was sent as an email...
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 Free
Top 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
OK. I’ll see what I can do to recreate this and see about detecting the UUID type. If it saves, it should load. That seems a reasonable minimum expectation. 😃
1.6.1 is live in central now. You’ll still need to manually add the converter. I toyed with adding it by default but that converter saves values as
String
s where the driver chose to write toBinary
. Since adding the converter might trip up on existing data in someone’s database, I opted to keep it off by default just to be safe.