Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NullPointerException when searching #19

Closed
GideonLeGrange opened this issue Aug 28, 2016 · 6 comments
Closed

NullPointerException when searching #19

GideonLeGrange opened this issue Aug 28, 2016 · 6 comments

Comments

@GideonLeGrange
Copy link

GideonLeGrange commented Aug 28, 2016

I'm experiencing a NullPointerException in certain instances when calling searchSeries(). I'm not exactly sure why this is, but I suspect that the problem may be todo with getValidWebpage() returning null and getEventDocFromUrl() not checking it.

Here is code to reproduce the error:

import com.omertron.thetvdbapi.TheTVDBApi;
import com.omertron.thetvdbapi.model.Episode;
import com.omertron.thetvdbapi.model.Series;
import java.util.List;

public class NullPointerExample {

    private static final String API_KEY = "YOUR API KEY HERE";

    public static void main(String...args) throws Exception { 
        TheTVDBApi tvDB = new TheTVDBApi(API_KEY);
        List<Series> results = tvDB.searchSeries("Fairly odd parents", "en");
        for (Series series : results) {
            System.out.println(series.getId() + " " + series.getSeriesName());
            List<Episode> episodes = tvDB.getAllEpisodes(series.getId(), "en");
            for (Episode ep : episodes) {
                System.out.println(ep.getEpisodeNumber() + " " + ep.getEpisodeName());
            }
        }

    }

}

Here is the stack trace from the error:

Exception in thread "main" java.lang.NullPointerException
    at com.omertron.thetvdbapi.tools.DOMHelper.getEventDocFromUrl(DOMHelper.java:122)
    at com.omertron.thetvdbapi.tools.TvdbParser.getSeriesList(TvdbParser.java:256)
    at com.omertron.thetvdbapi.TheTVDBApi.searchSeries(TheTVDBApi.java:362)
    at NullPointerExample.main(NullPointerExample.java:13)
@GideonLeGrange
Copy link
Author

GideonLeGrange commented Aug 28, 2016

I see I may have reported the same problem as #17. I'm testing against current master to see if it's better than 1.8.

@GideonLeGrange
Copy link
Author

Seems to work correctly in 1.9-SNAPSHOT, so this is a duplicate of #17. Time for a 1.9 release to Maven Central (hint hint) 😀

@Omertron
Copy link
Owner

Thank you, I will release today/tomorrow

@Omertron
Copy link
Owner

And released

@GideonLeGrange
Copy link
Author

Awesome, thank you. Did you push it to Central? They're only showing up to 1.8 currently.

screen shot 2016-08-31 at 18 32 00

@Omertron
Copy link
Owner

Dang! Forgot to do that step. It's done now.

On 31 August 2016 at 17:33, Gideon le Grange notifications@github.com
wrote:

Awesome, thank you. Did you push it to Central? They're only showing up to
1.8 currently.

[image: screen shot 2016-08-31 at 18 32 00]
https://cloud.githubusercontent.com/assets/1131028/18137610/5223caaa-6fa9-11e6-82b5-53f4bf77f21f.png


You are receiving this because you commented.
Reply to this email directly, view it on GitHub
#19 (comment),
or mute the thread
https://github.com/notifications/unsubscribe-auth/ABXdFYCOvn0o3Swdg065Pr7QH98m-k2Cks5qlay-gaJpZM4Ju5Fa
.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants