You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have encountered a bug in Discord4J that appears to have been introduced with the upgrade to 3.1.0. Namely, it concerns (to my knowledge) embeds and their properties:
To Reproduce:
Generate a message with an embed without e.g. author icon
Read that message using Discord4J and look at the embed
Expected Behavior:
Embed.Author#getIconUrl returns an empty Optional<String>, null or similar
Actual Behavior:
A java.util.NoSuchElementException exception is thrown
Version: 3.1.0
Other: I've only come across the issue with the author icon out in the wild so far, but I'd expect more fields to actually be optional.
The text was updated successfully, but these errors were encountered:
There's a few Possible::get() uses in Embed that were overlooked. Ideally they would've been mapped to Optional and the return types would be changed. Not sure what the best course of action is here since 3.1 is released.
quanticc pointed out we can annotate these methods as @Nullable and change the implementation to fallback to null. While we generally try to avoid that in core, I think it's the best option here until 3.2. That was the previous behavior anyways, we just didn't know.
Will be fixed in 3.1.1 with the @Nullable solution and with some incompatible Optional changes in 3.2. If you need the fix before release, you can use a snapshot of either branch.
Thanks for the speedy solution @darichey! I've worked around the issue for now by manually catching the exception and mapping it to null (which is fine by me, as I'm using it from Kotlin, anyway), so looking forward to the fixed version!
I have encountered a bug in Discord4J that appears to have been introduced with the upgrade to 3.1.0. Namely, it concerns (to my knowledge) embeds and their properties:
To Reproduce:
Expected Behavior:
Embed.Author#getIconUrl
returns an emptyOptional<String>
,null
or similarActual Behavior:
java.util.NoSuchElementException
exception is thrownVersion: 3.1.0
Other: I've only come across the issue with the author icon out in the wild so far, but I'd expect more fields to actually be optional.
The text was updated successfully, but these errors were encountered: