Skip to content

NullPointer EmbeddedMedia even on v1.1.0 #300

@andehr

Description

@andehr

Hi,
I'm getting the follow error:

java.lang.NullPointerException: Null type
	at net.dean.jraw.models.$AutoValue_EmbeddedMedia_OEmbed.<init>($AutoValue_EmbeddedMedia_OEmbed.java:45)
	at net.dean.jraw.models.AutoValue_EmbeddedMedia_OEmbed.<init>(AutoValue_EmbeddedMedia_OEmbed.java:16)
	at net.dean.jraw.models.AutoValue_EmbeddedMedia_OEmbed$MoshiJsonAdapter.fromJson(AutoValue_EmbeddedMedia_OEmbed.java:142)
	at net.dean.jraw.models.AutoValue_EmbeddedMedia_OEmbed$MoshiJsonAdapter.fromJson(AutoValue_EmbeddedMedia_OEmbed.java:19)

Which looks like it was resolved in version 1.1.0 (which I'm using via maven central) according to this issue: #227

Any idea how to fix or why this could be happening?

I can even see the code that patched it in my IDE:

@AutoValue
public abstract class EmbeddedMedia implements Serializable {
    /**
     * This is generally the OEmbed provider. Can also be the string {@code liveupdate} for a live reddit thread. Null
     * when {@link #getRedditVideo() is not}
     */
    @Nullable
    public abstract String getType();

Could AutoValue not be pulled in correctly?

In the autogenerated class $AutoValue_EmbeddedMedia_OEmbed I see this:

$AutoValue_EmbeddedMedia_OEmbed(String type, String version, @Nullable String title, @Nullable String authorName, @Nullable String authorUrl, @Nullable String providerName, @Nullable String providerUrl, @Nullable Long cacheAge, @Nullable String thumbnailUrl, @Nullable Integer thumbnailWidth, @Nullable Integer thumbnailHeight, @Nullable String url, @Nullable Integer width, @Nullable Integer height, @Nullable String embedHtml) {
        if (type == null) {
            throw new NullPointerException("Null type");
        }

This happens in a call to subreddits(...).posts(), after collecting about 44000 "NEW" posts from across ~80 subreddits. If I skip that page by catching the NullPointer, all subsequent calls to ".next()" result in the same error.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions