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.

HashMap<UUID, any> is not properly decoded

See original GitHub issue

Describe 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:

  1. Create a HashMap<UUID, String> and put anything in it.
  2. Save the object using datastore.save(map)
  3. Load the object with Morphia.
  4. 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:closed
  • Created 3 years ago
  • Comments:23 (13 by maintainers)

github_iconTop GitHub Comments

1reaction
evanchoolycommented, Jul 30, 2020

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. 😃

0reactions
evanchoolycommented, Nov 26, 2020

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 Strings where the driver chose to write to Binary. 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.

Read more comments on GitHub >

github_iconTop 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 >

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